F
firstrose
Unregistered / Unconfirmed
GUEST, unregistred user!
大家有用SQL Server吗?看到那个服务管理器的界面吗?上面有3个带图标的按钮。我想做类似的按钮。要求用Win32SDK,不用控件。<br><br>我用的代码:<br><br>Begin<br> Inst:=hInstance; <br> With WinClass do<br> Begin<br> lpfnWndProc:=@DefDlgProc;<br> cbWndExtra:=DLGWINDOWEXTRA;<br> hInstance:=Inst;<br> hCursor:=LoadCursor(0,IDC_ARROW);<br> hbrBackground:=COLOR_WINDOW + 1;<br> lpszClassname:='xxxxxx';<br> End;<br><br> RegisterClassEx(WinClass); <br><br> DialogBoxParam(Inst,MAKEINTRESOURCE(IDD_MAIN),0,@DialogFunc,0); <br>End.<br><br>下面是我用的RC文件。<br><br>#include "resource.h"<br><br>IDD_MAIN DIALOG 0, 0, 190, 141<br>STYLE DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU<br>CAPTION "xxxxx"<br>LANGUAGE LANG_CHINESE, 0x2<br>FONT 9, "宋体"<br>{<br> CONTROL "服务器(&V):", 1010, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 6, 52, 8 <br> CONTROL "", 1000, COMBOBOX, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 61, 4, 122, 60 <br> CONTROL "服务(&R):", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 6, 22, 53, 8 <br> CONTROL "", 1001, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 61, 20, 122, 60 <br> CONTROL "开始/继续(&S)", 1016, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 96, 61, 86, 8 <br> CONTROL "", 1013, BUTTON, BS_PUSHBUTTON | BS_ICON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 68, 58, 18, 14 <br> CONTROL "暂停(&P)", 1017, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 96, 81, 83, 8 <br> CONTROL "", 1014, BUTTON, BS_PUSHBUTTON | BS_ICON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 68, 78, 18, 14 <br> CONTROL "停止(&O)", 1018, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE, 96, 99, 83, 8 <br> CONTROL "", 1015, BUTTON, BS_PUSHBUTTON | BS_ICON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 68, 96, 18, 14 <br> CONTROL "当启动 OS 时自动启动服务(&A)", 1021, BUTTON, BS_AUTOCHECKBOX | BS_MULTILINE | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 6, 112, 182, 16 <br> CONTROL "", 1019, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 16, 61, 49, 49 <br> CONTROL "", 1007, STATIC, SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE, 1, 129, 188, 10 <br> CONTROL "停止(&S)", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 65436, 65491, 16, 8<br> CONTROL "", 1004, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE, 65436, 65436, 40, 14 <br> CONTROL "暂停(&P)", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 65436, 65436, 21, 8 <br> CONTROL "", 1005, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE, 65436, 65436, 40, 14 <br> CONTROL "开始/继续(&C)", -1, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 65436, 65436, 47, 8 <br> CONTROL "", 1006, EDIT, ES_LEFT | WS_CHILD | WS_VISIBLE, 65436, 65436, 40, 14 <br> CONTROL "刷新服务(&H)...", 1023, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 60, 36, 123, 14 <br>}<br><br>IDI_MAIN ICON DISCARDABLE "Main.ICO"<br><br>换而言之,是把<br> CONTROL "", 1013, BUTTON, BS_PUSHBUTTON | BS_ICON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 68, 58, 18, 14 <br>所指的button画上图标,并可以改变!<br><br>说要设置按钮的属性者无分!