کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

به اشتراک گذاری اطلاعات کسب شده در اکسس از سایت آفیس و سایت های تخصصی خارجی
کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

به اشتراک گذاری اطلاعات کسب شده در اکسس از سایت آفیس و سایت های تخصصی خارجی

NCCALCSIZE ( محاسبه ی اندازه در Non Client )


اولین  مستطیل یا Rectangle حاوی مختصات جدید پنجره که جابجا یا تغییر سایز شده است طبق داکیومنت زیر 


When the window procedure receives

 the WM_NCCALCSIZE message, the first rectangle contains the new coordinates of a window that has been moved or resized, that is, it is the proposed new window coordinates. The second contains the coordinates of the window before it was moved or resized. The third contains the coordinates of the window's client area before the window was moved or resized


افزایش عرض یا طول مستطیل ( Rectangle )

InflateRect lprc,dx,dy


یک مستطیل را به منطقه به روز رسانی پنجره مشخص اضافه می کند



InvalidateRect hWnd,lpRect,bErase



Also Read   offsetrect


WM_NCCALCSIZE'
(private WmNCCalcSize(ByRef m Ss Message 
Get Window Rect RECT'
Dim formRect As RECT
GetWindowRect m.HWnd,formRect
Check WPARAM'
 if m.WParam<>0 Then 
When TRUE, LPARAM Points to a'
NCCALCSIZE_PARAMS structure'
Dim nccsp As NCCALCSIZE_PARAMS

We're adjusting the size of the client area 'here. Right' 
now, the client area is the whole form

Adding to the Top, Bottom, Left, and Right will size the '
client area.

nccsp.rgrc0.top= formRect.top+30
 Thirty pixel top border'
nccsp.rgrc0.bottom=formRect.bottom-4
Four pixel bottom (resize) border'
nccsp.rgrc0.left=formRect.left+4
Four pixel left (resize) border'

Else 'FALSE
When FALSE,LPARAM Points to a RECT structure'
Dim clnRect As RECT
'Like before, we're adjusting the rectangle...
'Adding to the Top, Bottom, Left, and Right will size the client area. 
(CopyMemory clnRect,Byval lParam,Len(lParam
clnRect.top+=30
Thirty-pixel top border'
clnRect.bottom-=4
Four-pixel bottom (resize) border'
clnRect.left+=4
Four-pixel left (resize) border'
clnRect.right-=4
Four-pixel right (resize) border'
CopyMemory lParam,clnRect,Len
 Ret=0


()Private Sub InvalidateNC

 'refresh or invalidate don't work for the nonclient-area.
 'this sub forces a refresh for NC.    

SetWindowPos(Me.Handle,0,0,0,0,0,SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER Or SWP_NOACTIVATE Or
SWP_FRAMECHANGED)
End Sub 'invalidateNC



WM_NCCALCSIZE return flags
Global Const WVR_ALIGNTOP = &H0010
Global Const WVR_ALIGNLEFT = &H0020
Global Const WVR_ALIGNBOTTOM = &H0040
Global Const WVR_ALIGNRIGHT = &H0080
Global Const WVR_HREDRAW = &H0100
Global Const WVR_VREDRAW = &H0200
Global Const WVR_REDRAW = (WVR_HREDRAW Or WVR_VREDRAW)
Global Const WVR_VALIDRECTS = &H0400

WM_NCCALCSIZE parameter structure'
Type NCCALCSIZE_PARAMS
rgrc As Long
lppos As Long
End Type

Global Const MA_NOACTIVATEANDEAT = 4

Type WINDOWPOS
hwndInsertAfter As Long
hwnd As Long
x As Long
y As Long
cx As Long
cy As Long
flags As Long
End Type

Dim nccs  As NCCALCSIZE_PARAMS
Dim WndPos  As WINDOWPOS
MAGICNUMBER=23

Case WM_NCCALCSIZE


' Adjust the client area size calculation to allow for our tabstrip

 If (wParam <> 0) Then
'nccs->NCCALCSIZE Structure
(CopyMemory nccs,ByVal lParam,Len(nccs

(CopyMemory WndPos,ByVal nccs.lppos,Len(WndPos

  (With nccs.rgrc(0
     Left=nccsPos.x+2.
     Top=nccsPos.y+MAGICNUMBER.
     Right=(nccsPos.x+nccsPos.cX)-2.
     Bottom=nccsPos.y+nccsPos.cY)-2.
End With


(Set nccs.rgrc(1)=nccs.rgrc(0

(CopyMemory ByVal lParam,nccs,Len(nccs

 WndProc=WVR_VALIDRECTS

 
Else

WndProc =CallWindowProc(mlpfnOldWindowProc
(hWnd,uMsg,wParam,lParam,

End If

Case WM_NCPAINT

  GetWindowRect hWnd,WndRect
  GetDCEx(hWnd,wparan,DCX_WINDOW or'
DCX_INTERSECTRGN'
  ( lhDC = GetWindiwDC(hWnd
....  BitBlt
  ReleaseDC hWnd, lhDC
WndProc =CallWindowProc(mlpfnOldWindowProc
(hWnd,uMsg,wParam,lParam

I was about to reply that I had been trying GetWindowDC and GetDCEx also until it occured to me that of course the coordinates are different... it works now Thanks so much



You can respond to the WM_NCCALCSIZEmessage, modify WndProc's default behaviour to remove the invisible border.

As this document and this documentexplain, when wParam > 0, On request wParam.Rgrc[0] contains the new coordinates of the window and when the procedure returns, Response wParam.Rgrc[0] contains the coordinates of the new client rectangle.

:The golang code sample



params.Rgrc(0).Top=params.Rgrc(2).Top params.Rgrc(0).Left=params.Rgrc(0).Left + 1
params.Rgrc(0).Bottom=params.Rgrc(0).Bottom-1
params.Rgrc(0).Right=params.Rgrc(0).Right-1
return 0x0300


Case WM_NCLBUTTONDOWN
            'pt = PointToClient(New Point(m.LParam.ToInt32()))
            'pt.Offset(I.BorderWidthLeft, I.BorderWidthTop)
       

منبع خارجی