Graphic control in resource file
i can't add graphic control to a resource file, so i try to change the style of the label control, but i failed.
this is my code, i use "resed resource editor"(http://www.radasm.com/resed/)
i can't add graphic control to a resource file, so i try to change the style of the label control, but i failed.
this is my code, i use "resed resource editor"(http://www.radasm.com/resed/)
Code:
'Test.bas #Compile Exe "Test.exe" #Dim All #Include "Win32API.INC" #Resource "Test.pbr" %IDC20_GRP1 = 2001 %IDC20_BTN1 = 2002 %IDC_GRAPHIC = 2003 %IDC20_UDC1 = 1001 Global ghInst, ghDlg As Long Global Mehwnd, PassDlg As Long Global hWnd, Pid, idThread, hProcess As Dword 'CallBack CallBack Function MainWndProc Select Case CbMsg Case %WM_INITDIALOG Mehwnd = CbHndl Local lStyle, lExStyle As Long lStyle = %WS_CHILD Or %WS_VISIBLE Or %WS_BORDER Or %SS_OWNERDRAW SetWindowLong GetDlgItem(CbHndl, %IDC20_UDC1), %GWL_STYLE, lStyle SetWindowLong GetDlgItem(CbHndl, %IDC20_UDC1), %GWL_EXSTYLE, lExStyle 'Control Add Graphic, CbHndl, %IDC_GRAPHIC, "", 10, 10, 168, 168, %WS_BORDER Or %SS_OWNERDRAW 'Graphic Attach CbHndl, %IDC_GRAPHIC Case %WM_DESTROY Case %WM_COMMAND Select Case LoWrd(CbWParam) Case %IDC20_BTN1 Graphic Attach CbHndl, %IDC20_UDC1 Graphic Color %White, %Black Graphic Clear Graphic Line (5, 5)-(100, 100), RGB(255, 255, 255) Graphic Line (100, 100)-(5, 100), RGB(255, 255, 255) 'Graphic Save "Test.bmp" End Select Case %WM_SYSCOMMAND Select Case CbWParam Case %SC_CLOSE Dialog End CbHndl Case %SC_MINIMIZE End Select End Select End Function Function WinMain (ByVal CurInst As Dword, _ ByVal PrvInst As Dword, _ ByVal CmdLine As Asciiz Ptr, _ ByVal CmdShow As Long) As Long ghInst = CurInst DialogBox ghInst, "MainDlg", %HWND_DESKTOP, CodePtr(MainWndProc) End Function 'Test.rc #define IDC20_GRP1 2001 #define IDC20_BTN1 2002 #define IDC20_UDC1 1001 #include "Resource.h" MainDlg DIALOGEX 6,5,129,181 CAPTION "Test" FONT 9,"Verdana",400,0,0 STYLE WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|DS_CENTER BEGIN CONTROL "None",IDC20_GRP1,"Button",WS_CHILD|WS_VISIBLE|BS_GROUPBOX,3,1,123,24 CONTROL "Draw",IDC20_BTN1,"Button",WS_CHILD|WS_VISIBLE,43,156,42,17 CONTROL "",IDC20_UDC1,"Static",WS_CHILD|WS_VISIBLE|WS_BORDER,7,41,111,106 END Yes ICON DISCARDABLE "ms.ico"
Comment