Case &H20 ' WM_SETCURSOR
(If GetClassName(wParam) = "Button" Then MsgBox GetWindowText(wParam
( SetWindowTextA Et, "Class : " & GetClassName(wParam) & " Text : " & GetWindowText(wParam
static APPSTARTING := 32650
HAND := 32649
ARROW := 32512
CROSS := 32515
IBEAM := 32513
NO := 32648
SIZE := 32646
SIZENESW := 32643
SIZENS := 32645
SIZENWSE := 32642
SIZEWE := 32644
UPARROW := 32516
WAIT := 32514
SIZEWE_BIG := 32653
SIZEALL_BIG := 32654
SIZEN_BIG := 32655
SIZES_BIG := 32656
SIZEW_BIG := 32657
SIZEE_BIG := 32658
SIZENW_BIG := 32659
SIZENE_BIG := 32660
SIZESW_BIG := 32661
SIZESE_BIG := 32662
با DrawIcon هم می توان آیکونی را در DC صفحه انداخت
// EDITSTYLE class parts and states | |
// | |
#define VSCLASS_EDITSTYLE L"EDITSTYLE" | |
#define VSCLASS_EDIT L"EDIT" | |
enum EDITPARTS { | |
EP_EDITTEXT = 1, | |
EP_CARET = 2, | |
EP_BACKGROUND = 3, | |
EP_PASSWORD = 4, | |
EP_BACKGROUNDWITHBORDER = 5, | |
EP_EDITBORDER_NOSCROLL = 6, | |
EP_EDITBORDER_HSCROLL = 7, | |
EP_EDITBORDER_VSCROLL = 8, | |
EP_EDITBORDER_HVSCROLL = 9, | |
}; | |
#define EDITSTYLEPARTS EDITPARTS; | |
enum EDITTEXTSTATES { | |
ETS_NORMAL = 1, | |
ETS_HOT = 2, | |
ETS_SELECTED = 3, | |
ETS_DISABLED = 4, | |
ETS_FOCUSED = 5, | |
ETS_READONLY = 6, | |
ETS_ASSIST = 7, | |
ETS_CUEBANNER = 8, | |
}; | |
enum BACKGROUNDSTATES { | |
EBS_NORMAL = 1, | |
EBS_HOT = 2, | |
EBS_DISABLED = 3, | |
EBS_FOCUSED = 4, | |
EBS_READONLY = 5, | |
EBS_ASSIST = 6, | |
}; | |
enum BACKGROUNDWITHBORDERSTATES { | |
EBWBS_NORMAL = 1, | |
EBWBS_HOT = 2, | |
EBWBS_DISABLED = 3, | |
EBWBS_FOCUSED = 4, | |
}; استفاده در OpenThemaData و DrawThemBackground |
The button's width has to to be correct, the height gets adjusted afterwards. When handling WM_INITDIALOG,
:call a single function
,reinterpret_cast<UINT_PTR>(hWndButton)
((((reinterpret_cast<DWORD_PTR>(hWndButton
return(FALSE); // Enforce WM_NCCALCSIZE| SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER,
;((SWP_FRAMECHANGED
{تنظیم حاشیه در کنترل EDIT
: wparam
EC_LEFTMARGIN=&H1
EC_RIGHTMARGIN=&H2
: Msg
EM_SETMARGINS=211 '&HD3
دسیمال 211 تبدیل به هگزا - ->> عدد دسیمال تقسیم بر 16 میشود 13 معادل آن D و حاصل تفریق عدد211 و حاصلضرب 13 در 16 میشود 3 .... نهایتا از کنار هم گذاشتن آنها D3 بدست می آید ، در تابع زیر پارامتر هندل Et ذکر شده و منظور گرفتن هندل Edit است که با FindWindowEx انجام شده.
SendMessageA Et, 211, &H1, ByVal 25
SendMessageA Et, 211, &H2, ByVal 65536 * 50
تست شده طبق شکل زیر که تمام تکست داخل EDIT BOX با Ctrl+A انتخاب شده در نتیجه مارجین یا حاشیه مشخص است . البته باید دید تغییر فونت چه تاثیری خواهد گذاشت .
SWP_FRAMECHANGED 0x0020
Applies new frame styles set using the SetWindowLongfunction. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZEis sent only when the window's size is being changed.
Fully redraw the window in its new
.position
SWP_FRAMECHANGED Sends a WM_NCCALCSIZEmessage to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
ارسال آیکون به باتن با پیام BM_SETIMAGE و تابع ارسال پیام به دیالوگ باکس و آیدی باتن که یک است. image_icon=1 , un1=1
EC_LEFTMARGIN =&H1 EC_RIGHTMARGIN =&H2
EM_SETMARGINS=&HD3
: lParam
The HIWORD specifies the new width of the right margin, in pixels. This value is ignoredif wParam does
.notinclude EC_RIGHTMARGIN
ExcludeClipRect(aMessage.WParam, fButton.Left,
top + 1,
fButton.Left + fButton.Width,
fButton.Height);
عدد پی تقسیم بر سینوس یک درجه
3.141592/0.01745240643?
180.009101472661
تمام منابع خارجی
Dim px As POINTAPI
GetCursorPos px
'ClientToScreen hwnd, px
MoveToEx hdc, 120, 30, px
LineTo hdc, 140, 30
MoveToEx hdc, 120, 30, px
LineTo hdc, 135, 15
' Quarter
MoveToEx hdc, 120, 30, px
LineTo hdc, 134, 44
MoveToEx hdc, 120, 30, px
LineTo hdc, 120, 50
' Quarter
MoveToEx hdc, 120, 30, px
LineTo hdc, 105, 44
MoveToEx hdc, 120, 30, px
LineTo hdc, 120, 10
' Quarter
MoveToEx hdc, 120, 30, px
LineTo hdc, 105, 14
MoveToEx hdc, 120, 30, px
LineTo hdc, 100, 30
Rotate
using WM_TIMER
Dim tt As RECT
Static Deg
Deg = Deg + 5
If Deg > 360 Then Deg = 0
Dim xl, yt
xl = 120: yt = 30
tt.Left = 99: tt.Top = 5: tt.right = 141: tt.bottom = 55
(FillRect hdc, tt, GetSysColorBrush(15
طول خط 20
در ربع اول If 0 < Deg < 90 Then ' Quarter
Newx = xl + Sin(Deg * Sin1) * 20
Newy = yt - Cos(Deg * Sin1) * 20
End If
در ربع دوم If 90 < Deg < 180 Then
Newx = xl + Cos(Deg * Sin1) * 20
Newy = yt + Sin(Deg * Sin1) * 20
End If
در ربع سوم If 180 < Deg < 270 Then
Newx = xl - Sin(Deg * Sin1) * 20
Newy = yt + Cos(Deg * Sin1) * 20
End If
در ربع چهارم If 270 < Deg < 360 Then
Newx = xl - Cos(Deg * Sin1) * 20
Newy = yt - Sin(Deg * Sin1) * 20
End If
MoveToEx hdc, 120, 30, px
LineTo hdc, Newx, Newy
xl = 120: yt = 30
tt.Left = 100: tt.Top = 5: tt.right = 140: tt.bottom = 55
(FillRect hdc, tt, GetSysColorBrush(15
Arc hdc, 100, 10, 140, 50, 0, 0, 0, 0
SelectObject hdc, HoldPen
Arc hdc, 115, 25, 125, 35, 0, 0, 0, 0
SelectObject hdc, HoldPen1
Newx = xl + Sin(Deg * Sin1) * 16
Newy = yt - Cos(Deg * Sin1) * 16
MoveToEx hdc, 120, 30, px
LineTo hdc, Newx, Newy
Deg = Deg + 10
DeleteObject HoldPen
DeleteObject HoldPen1
موارد پایین تست شده ... البته اینها موارد ساده ای هستند و پیش پا افتاده
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