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

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

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

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

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

TitleBar



ابعاد باتن ها در کپشن با تابع 

getsystemmetrics





Type CaptionButton
uCmd As Long ' command to send when clicked(WM_COMMAND)
nRightBorder As Integer ' Pixels between this button and buttons to the right
hBmp As HBITMAP ' Bitmap to display
fPressed As Boolean ' Is the button pressed in or out?
End Type



Type CustomCaption
buttons(MAX_TITLE_BUTTONS) As CaptionButton
nNumButtons As Integer
fMouseDown As Boolean
wpOldProc As LongPtr
iActiveButton  As Integer
End Type


WM_NCPAINT : 


Dim hrgn As LongPtr,temprgn As LongPtr
Dim rc As RECT
GetWindowRect hWnd,rc
If wParam=1 Then 
hrgn=CreateRectRgnIndirect(rc)
Else
hrgn=wParam
End if
For i=1 To ctp.nNumButtons


'A value of TRUE results in window-relative coordintes (from the top-left of the window). A value of FALSE results in screen coordinates.


GetButtonRect ctp,hwnd,i,rc,False ' in screen coord
temprgn=CreateRectRgnIndirect(rc)
CombineRgn hrgn,hrgn,temprgn,RGN_XOR
DeleteObject temprgn
Next



Dim hDc As LongPtr
hDc=GetWindowDc(hWnd)
For i=1 To ctp.nNumButtons
GetButtonRect ctp,hWnd,i,rc,True
if ctp.buttons(i).fPressed Then
DrawFrameControl hdc,rcbtn,DFC_BUTTON,DFCS_BUTTONPUSH+DFCS_PUSHED
Else
DrawFramControl hdc,rcbtn,DFC_BUTTON,DFCS_BUTTONPUSH
End If 
Next
ReleaseDc hDc
if wParam=1 Then DeleteObject hrgn


WM_SETTEXT , WM_NCACTIVATE :



dwStyle=GetWindowLongPtr(hWnd,GWL_STYLE)
SetWindowLongPtr hWnd,GWL_STYLE,dwStyle And WS_VISIBLE
ret=CallWindowProc( ctp.wpOldProc,hWnd,Msg,wParam,lParam)
SetWindowLongPtr hWnd,GWL_STYLE,dwStyle
Caption_NcPaint(hWnd,(HRGN) 1)


WM_NCLBUTTONDOWN : 


Dim i As Integer
Dim rc As RECT
Dim pt AS POINTAPI
'Mouse Coordinate
pt.x=Loword lParam
pt.y=Hiword lParam 
For i=1 To ctp.nNumButtons
' Get Screen Coordinate of each button
GetButtonRect ctp,hWnd,i,rc,False
InflateRect rc,0,2
if PtInRect(rc,pt) Then
ctp.iActiveButton=i
ctp.buttons(i).fPressed=True
ctp.fMouseDown=True
SetCapture hWnd
RedrawCaption hWnd
End if
winProc=0
Next




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


Function  GetWinRect(hWnd) 

Dim rc As RECT

Dim p1 As POINTAPI,p2 As POINTAPI

GetClientRect hWnd,rc

With rc

p1.x=rc.Left : p2.x=rc.Right

p1.y=rc.Top : p2.y=rc.Bottom

ScreenToClient hWnd,p1

ScreenToClient hWnd,p2

.Left=p1.x : .Right=p2.x

.Top=p1.y : .Bottom=p2.y

End With

GetWinRect=rc

End Function




























نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد