ش | ی | د | س | چ | پ | ج |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
با DrawIcon هم می توان آیکونی را در DC صفحه انداخت
موارد پایین تست شده ... البته اینها موارد ساده ای هستند و پیش پا افتاده
Public Function CallWindProc(ByVal hwnd As LongPtr, ByVal Msg As Long, ByVal wParam As LongPtr, ByVal lParam As LongPtr) As LongPtr
Dim hdc As LongPtr
Select Case Msg
Case WM_PAINT
Dim cc As RECT
GetClientRect hwnd, cc
(hdc = GetDC(hwnd
((FillRect hdc, cc, CreateSolidBrush(RGB(255, 0, 255
Case WM_DESTROY
SetWindowLongPtr hwnd, GWL_WNDPROC, OldWindow
End Select
CallWindProc = CallWindowProc(OldWindow, hwnd,
(Msg, wParam, lParam,
End Function
(FillRect hdc, cc, GetSysColorBrush(5
(FillRect hdc, cc, GetSysColorBrush(16
TIMER
Case WM_TIMER
GetClientRect hwnd, rcClient
hdc
(GetDC(hwnd=
DrawText hdc, x, 2, rcClient, DT_CENTER
SetWindowTextA hwnd, x
x = x + 1
ترسیم مستطیل در InputBox
Case WM_TIMER
Dim Et As LongPtr
Dim WinRect As RECT
Et:Edit Handle,WinRect For Edit Control'
GetWindowRect Et, WinRect
( hdc = GetDC(hwnd
rc.Left = 10
rc.Top = 68
rc.right = 70
rc.bottom = 88
rcClear.Left = rc.Left: rcClear.right = GetUpdateRight
rcClear.Top = rc.Top - 3: rcClear.bottom = rc.bottom
rc.Left = rc.Left + x: rc.right = rc.right + x
Fill Rectangle'
( FillRect hdc, rcClear, GetSysColorBrush(15
Draw Rectangle'
Rectangle hdc, rc.Left, rc.Top, rc.right, rc.bottom
FillRect Again GetSysColorBrush(18) ' Black'
Use Offset And FillRect rc With Another Brush'
GetUpdateRight = rc.right + x
If rc.right > WinRect.right - WinRect.Left Then x = 0
تست شده
The WM_PAINT message is sent when the system or another application makes a request to paint a portion
of an application's window
The PAINTSTRUCT
structure contains information that can be used to paint the.client area of a window
حاوی اطلاعاتی برای استفاده در نقاشی ناحیه ی Client پنجره.
Case WM_PAINT
Dim ps As PAINTSTRUCT
( hdc = BeginPaint(lhwnd, ps
Dim rrc As RECT
GetClientRect lhwnd, rrc
(( FillRect hdc, rrc, CreateSolidBrush(RGB(100, 0, 100
SetTextColor hdc, vbRed
TextOutA hdc, 10, 10, "sa", 2
EndPaint lhwnd, ps
ReleaseDC lhwnd, hdc
البته غیر از پیام زیر میشود با پیام WM_CTLCOLORBTN هم رنگ باتن را تغییر داد که lParam میشود هندل باتن و wParam هم هندل DC میشود
Case WM_DRAWITEM
Dim pDIS As DRAWITEMSTRUCT
Dim state
(CopyMemory pDIS, ByVal lParam, Len(pDIS
( hdc = GetDC(pDIS.hdc
Dim p As RECT
p = pDIS.rcItem
state = pDIS.itemState
GetClientRect can, p
If pDIS.CtlID = 2 Then
If state = 272 Then
RoundRect hdc, p.Left, p.Top, p.Right, p.Bottom, 16, 16
ReleaseDC can, hdc
Else
RoundRect hdc, p.Left, p.Top, p.Right, p.Bottom, 4, 4
ReleaseDC can, hdc
End If
End If
(CopyMemory ByVal lParam, pDIS,Len(pDIS