S
smithcouple
Unregistered / Unconfirmed
GUEST, unregistred user!
也就是每一个条带(band)最左边那个Gripper<br>我先创建了一个Coolbar,然后创建了一个Toolbar,创建Band,将Toolbar设置到Band中,可怎么就是不能显示那个竖杠,还有Band左侧设置好的文本,但将其它组建放入Band(比如Edit Button)均可以正常显示小竖杠以及Band上面的文本。<br><br>代码如下:注意咯 不是用VCL, 我几乎尝试了所有风格style都没效果,先在这里谢谢大家~~<br><br><br> CLBTop: HWND; //Coolbar<br> TLBMain: HWND;//Toolbar<br> tbBTNs: array[1..2] of TTBBUTTON;//toolbar按钮<br> tbIML: HIMAGELIST;//toolbar ImageList<br> tbBMP: HBITMAP; // toolbar 按钮图片<br> rbi: TREBARINFO; <br> rbBand: TREBARBANDINFO;<br> icex: TINITCOMMONCONTROLSEX;<br> dwBtnSize: WORD;<br><br><br><br><br><br> CLBTop := CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, '', WS_CHILD or<br> WS_VISIBLE or WS_CLIPSIBLINGS or WS_CLIPCHILDREN or<br> RBS_VARHEIGHT or RBS_DBLCLKTOGGLE or RBS_BANDBORDERS or CCS_NODIVIDER or<br> CCS_NOPARENTALIGN or RBS_AUTOSIZE,<br> 0, 0, 462, 30, hWindow, 0, Inst, nil);<br><br> TLBMain := CreateWindowEx(0, TOOLBARCLASSNAME, '', WS_CHILD or<br> TBSTYLE_TRANSPARENT or TBSTYLE_TOOLTIPS or TBSTYLE_BUTTON<br> or TBSTYLE_FLAT,<br> 0, 0, 0, 0, hWindow, 0, Inst, nil);<br><br> tbIML := ImageList_Create(16,16,ILC_COLOR24 or ILC_MASK,2,1);<br> tbBMP := LoadImage(Inst,<br> MAKEINTRESOURCE(501), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR or<br> LR_LOADTRANSPARENT or LR_LOADMAP3DCOLORS);<br> ImageList_AddMasked(tbIML,tbBMP, RGB(0,0,0));<br> DeleteObject (tbBMP);<br><br> tbBTNs[1].iBitmap := MAKELONG(0,0);<br> tbBTNs[1].idCommand := IDM_MMHelpAbout;<br> tbBTNs[1].fsState := TBSTATE_ENABLED;<br> tbBTNs[1].fsStyle := TBSTYLE_BUTTON;<br> tbBTNs[1].dwData := 0;<br> tbBTNs[1].iString := IDM_MMHelpAbout;<br> tbBTNs[2].iBitmap := MAKELONG(1,0);<br> tbBTNs[2].idCommand := IDM_MMHelpAbout;<br> tbBTNs[2].fsState := TBSTATE_ENABLED;<br> tbBTNs[2].fsStyle := TBSTYLE_BUTTON;<br> tbBTNs[2].dwData := 0;<br> tbBTNs[2].iString := IDM_MMHelpAbout;<br> SendMessage(TLBMain, TB_BUTTONSTRUCTSIZE, SizeOf(TTBBUTTON), 0);<br> SendMessage(TLBMain, TB_SETIMAGELIST, 0, LongInt(tbIML));<br> SendMessage(TLBMain, TB_ADDBUTTONS, Round(SizeOf(tbBTNs) / SizeOf(TTBBUTTON)),<br> LongInt(@tbBTNs));<br><br> rbi.cbSize := SizeOf(TREBARINFO);<br> rbi.fMask := 0;<br> rbi.himl := 0;<br> SendMessage(CLBTop, RB_SETBARINFO, 0, LongInt(@rbi));<br> dwBtnSize := SendMessage(TLBMain, TB_GETBUTTONSIZE, 0,0);<br> rbBand.cbSize := SizeOf(TREBARBANDINFO);<br> rbBand.fMask := RBBIM_COLORS or RBBIM_TEXT or RBBIM_BACKGROUND or<br> RBBIM_STYLE or RBBIM_CHILD or RBBIM_CHILDSIZE or<br> RBBIM_SIZE;<br> rbBand.fStyle := RBBS_CHILDEDGE or RBBS_GRIPPERALWAYS or RBBS_BREAK;<br> rbBand.lpText := 'ToolBar';<br> rbBand.hwndChild := TLBMain; //如果换成Edit Button 则都正常<br> rbBand.cx := 250;<br> rbBand.cxMinChild := 0;<br> rbBand.cyMinChild := LOWORD(dwBtnSize);<br> SendMessage(CLBTop, RB_INSERTBAND, -1, LongInt(@rbBand));