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

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

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

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

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

محصور کردن کرسر به منطقه مستطیل شکل در صفحه




ClipCurSor 
.Confines the cursor to a rectangular area on the screen

Parameters

lpRect

Type: const RECT*

A pointer to the structure that contains the screen coordinates of the upper-left and lower-right corners of the confining rectangle. If this parameter is NULL, 
.the cursor is free to move anywhere on the screen



Dim ptClientUL As POINTAPI  'client area upper lef corner 
Dim ptClientLR As POINTAPI 'client area lower right corner 
Static rcBmp As RECT 

WM_CREATE

(hdc=GetDC(hwnd
(hdcCompat=CreateCompatibleDC(hdc
SelectObject hdcCompat, hbmp
((hpenDot=CreatePen(PS_DOT,1,RGB(0, 0, 0
SetRect rcBmp, 1, 1, 34, 34

WM_PAINT

BeginPaint hwnd,ps
Rectangle ps.hdc,rcBmp.left,rcBmp.top,rcBmp.right, rcBmp.bottom
StretchBlt ps.hdc,rcBmp.left+1,rcBmp.top+1,(rcBmp.right-rcBmp.left)-2,(rcBmp.bottom-rcBmp.top)-2, hdcCompat,0,0,32,32,SRCCOPY
EndPaint hwnd,ps

WM_MOVE,WM_SIZE

'Convert the client coordinates of the client-area rectangle to screen coordinates and save them in a rectangle.The rectangle is passed to the ClipCursor function during WM_LBUTTONDOWN processing. 

GetClientRect hwnd,rcClient
ptClientUL.x = rcClient.left
ptClientUL.y = rcClient.top
ptClientLR.x = rcClient.right
ptClientLR.y = rcClient.bottom ClientToScreen hwnd,ptClientUL ClientToScreen hwnd,ptClientLR
SetRect rcClient,ptClientUL.x, ptClientUL.y,ptClientLR.x,ptClientLR.y)

WM_LBUTTONDOWN

ClipCursor rcClient
pt.x = (LONG) LOWORD(lParam) 
pt.y = (LONG) HIWORD(lParam)
if (PtInRect(&rcBmp, pt)) Then 
hdc=GetDC(hwnd)
SelectObject hdc,hpenDot
Rectangle hdc,rcBmp.left,rcBmp.top, rcBmp.right,rcBmp.bottom)
fDragRect=TRUE
ReleaseDC hwnd,hdc

WM_LBUTTONUP

' Release the mouse cursor.
ClipCursor  0

NCCALCSIZE TO MAKE A SPACE





WVR_ALIGNBOTTOM = 64
WVR_ALIGNLEFT = 32
WVR_ALIGNRIGHT = 128
WVR_ALIGNTOP = 16
WVR_HREDRAW = 256
WVR_REDRAW = WVR_HREDRAW + WVR_VREDRAW
WVR_VALIDRECTS = 1024
WVR_VREDRAW = 512


Type RECT

left As Long

right As Long

top As Long

bottom As Long

End Typd


Type NCCALCSIZE_PARAMS

rgrc(3) As RECT

lppos As WINDOWPOS

End Type 


Type WINDOWPOS

x As Long

y As Long

cx As Long    ' width

cy As Long    ' heigth

End Type



Dim tNCR As NCCALCSIZE_PARAMS 
Dim tWP As WINDOWPOS
If wParam <> 0 Then
 lParam containts a pointer to the'
 NCCALCSIZE_PARAMS structure: 
(CopyMemory tNCR,ByVal lParam, Len(tNCR
 the NCCALCSIZE_PARAMS structure contains'
 a pointer to the WINDOWPOS structure: 
(CopyMemory tWP,ByVal tNCR.lppos, Len(tWP
 Set the first rectangle to the WINDOWPOS ' size'
(With tNCR.rgrc(0
Left=tWP.x.
Top=tWP.y.
Right=tWP.x+tWP.cx.
Bottom = tWP.y + tWP.cy.
End With

Now modify the rectangle if we're showing tabs'
 to allow space for the tab strip itself'
If (m_bShowTabs) Then 
tNCR.rgrc(0).Left=tNCR.rgrc(0).Left+2
tNCR.rgrc(0).Right=tNCR.rgrc(0).Right-2
If (m_eTabAlign=TabAlignBottom) Then
tNCR.rgrc(0).Top=tNCR.rgrc(0).Top+2
tNCR.rgrc(0).Bottom=tNCR.rgrc(0).Bottom-m_lTabHeight
Else
tNCR.rgrc(0).Top=tNCR.rgrc(0).Top+m_lTabHeight
tNCR.rgrc(0).Bottom=tNCR.rgrc(0).Bottom-2 
End If 
End If


 Set the second rectangle to equal the first'
(tNCR.rgrc(1)=tNCR.rgrc(0
CopyMemory ByVal lParam,tNCR, Len(tNCR) ' Tell 
 :Windows we've modified the size'
ISubclass_WindowProc=WVR_VALIDRECTS

Once this is done, there will be a space for the tabs




Case WM_NCPAINT 
 Ensure the standard mon-client drawing is' 
:completed
(ISubclass_WindowProc=CallOldWindowProc(hWnd,iMsg,wParam,lParam
 Do custom drawing: first get a DC to the non-client' 
:area
Dim lhDC As Long 
(lhDC=GetWindowDC(hWnd
'.... Now can draw in the area we've cleared'
  Clear up DC '
ReleaseDC lHDC, hWnd


Check the actual source code for the details of drawing the tabs. The code uses an EnumWindowsProc callback function to determine all of the windows within the MDIClient area, and the WM_MDIGETACTIVEmessage to determine which 
.(window is the currently selected MDI child (if any

Finally, we need to intercept the user clicking on a tab or button within the tab control. There are two messages Windows sends to the non-client area to allow you to 
:check for mouse events

WM_NCHITTEST
This message allows you to tell Windows that a non-client area should be treated in a particular way, such as title bar or size gripper.
WM_SETCURSOR
This message is used by Windows to determine which cursor to display, however, since it provides the type of mouse action being performed you can use it to determine mouse movement and button presses in the 
.area





lParam LoWord/HiWord



 Dim pt As POINTAPI
    Dim rrr As RECT
           
   
          (pt.x = CLng(lParam And 65535
         ( pt.y = CLng(lParam / 65535
          
           ClientToScreen hwnd, pt
           GetWindowRect hwnd, rrr