为什么创建的coolbar怎么也显示每个band左边的小竖杠?(100分)

  • 主题发起人 主题发起人 smithcouple
  • 开始时间 开始时间
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> &nbsp;CLBTop: HWND; //Coolbar<br> &nbsp;TLBMain: HWND;//Toolbar<br> &nbsp;tbBTNs: array[1..2] of TTBBUTTON;//toolbar按钮<br> &nbsp;tbIML: HIMAGELIST;//toolbar ImageList<br> &nbsp;tbBMP: HBITMAP; // toolbar 按钮图片<br> &nbsp;rbi: TREBARINFO; &nbsp;<br> &nbsp;rbBand: TREBARBANDINFO;<br> &nbsp;icex: TINITCOMMONCONTROLSEX;<br> &nbsp;dwBtnSize: WORD;<br><br><br><br><br><br> &nbsp;CLBTop := CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, '', WS_CHILD or<br> &nbsp; &nbsp;WS_VISIBLE or WS_CLIPSIBLINGS or WS_CLIPCHILDREN or<br> &nbsp; &nbsp;RBS_VARHEIGHT or RBS_DBLCLKTOGGLE or RBS_BANDBORDERS or CCS_NODIVIDER or<br> &nbsp; &nbsp;CCS_NOPARENTALIGN or RBS_AUTOSIZE,<br> &nbsp; &nbsp;0, 0, 462, 30, hWindow, 0, Inst, nil);<br><br> &nbsp;TLBMain := CreateWindowEx(0, TOOLBARCLASSNAME, '', WS_CHILD or<br> &nbsp; &nbsp;TBSTYLE_TRANSPARENT or TBSTYLE_TOOLTIPS or TBSTYLE_BUTTON<br> &nbsp; &nbsp;or TBSTYLE_FLAT,<br> &nbsp; &nbsp;0, 0, 0, 0, hWindow, 0, Inst, nil);<br><br> &nbsp;tbIML := ImageList_Create(16,16,ILC_COLOR24 or ILC_MASK,2,1);<br> &nbsp;tbBMP := LoadImage(Inst,<br> &nbsp; &nbsp;MAKEINTRESOURCE(501), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR or<br> &nbsp; &nbsp;LR_LOADTRANSPARENT or LR_LOADMAP3DCOLORS);<br> &nbsp;ImageList_AddMasked(tbIML,tbBMP, RGB(0,0,0));<br> &nbsp;DeleteObject (tbBMP);<br><br> &nbsp;tbBTNs[1].iBitmap := MAKELONG(0,0);<br> &nbsp;tbBTNs[1].idCommand := IDM_MMHelpAbout;<br> &nbsp;tbBTNs[1].fsState := TBSTATE_ENABLED;<br> &nbsp;tbBTNs[1].fsStyle := TBSTYLE_BUTTON;<br> &nbsp;tbBTNs[1].dwData := 0;<br> &nbsp;tbBTNs[1].iString &nbsp;:= IDM_MMHelpAbout;<br> &nbsp;tbBTNs[2].iBitmap := MAKELONG(1,0);<br> &nbsp;tbBTNs[2].idCommand := IDM_MMHelpAbout;<br> &nbsp;tbBTNs[2].fsState := TBSTATE_ENABLED;<br> &nbsp;tbBTNs[2].fsStyle := TBSTYLE_BUTTON;<br> &nbsp;tbBTNs[2].dwData := 0;<br> &nbsp;tbBTNs[2].iString &nbsp;:= IDM_MMHelpAbout;<br> &nbsp;SendMessage(TLBMain, TB_BUTTONSTRUCTSIZE, SizeOf(TTBBUTTON), 0);<br> &nbsp;SendMessage(TLBMain, TB_SETIMAGELIST, 0, LongInt(tbIML));<br> &nbsp;SendMessage(TLBMain, TB_ADDBUTTONS, Round(SizeOf(tbBTNs) / SizeOf(TTBBUTTON)),<br> &nbsp; &nbsp;LongInt(@tbBTNs));<br><br> &nbsp;rbi.cbSize := SizeOf(TREBARINFO);<br> &nbsp;rbi.fMask := 0;<br> &nbsp;rbi.himl := 0;<br> &nbsp;SendMessage(CLBTop, RB_SETBARINFO, 0, LongInt(@rbi));<br> &nbsp;dwBtnSize := SendMessage(TLBMain, TB_GETBUTTONSIZE, 0,0);<br> &nbsp;rbBand.cbSize := SizeOf(TREBARBANDINFO);<br> &nbsp;rbBand.fMask := RBBIM_COLORS or RBBIM_TEXT or RBBIM_BACKGROUND or<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RBBIM_STYLE or RBBIM_CHILD or RBBIM_CHILDSIZE or<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RBBIM_SIZE;<br> &nbsp;rbBand.fStyle := RBBS_CHILDEDGE or RBBS_GRIPPERALWAYS or RBBS_BREAK;<br> &nbsp;rbBand.lpText := 'ToolBar';<br> &nbsp;rbBand.hwndChild := TLBMain; &nbsp;//如果换成Edit Button 则都正常<br> &nbsp;rbBand.cx := 250;<br> &nbsp;rbBand.cxMinChild := 0;<br> &nbsp;rbBand.cyMinChild := LOWORD(dwBtnSize);<br> &nbsp;SendMessage(CLBTop, RB_INSERTBAND, -1, LongInt(@rbBand));
 
帮顶!<br><br>╭=========================================╮<br><br> &nbsp; 80G海量源代码,控件,书籍全免费狂下不停!<br><br> &nbsp; http://www.source520.com<br> &nbsp;<br>╰=========================================╯
 
使用win32提供的两个函数 queryperformancefrequency 和 queryperformancecounter<br>具体实现我帮你google一下<br>//取毫秒级时间精度(方法一):<br>  var<br>  t1,t2:int64;<br>  r1:int64;<br>  begin<br>  t1:=GetTickCount;//获取开始计数 WINDOWS API<br>  sleep(1000);{do...}//执行要计时的代码<br>  t2:=GetTickCount;//获取结束计数值<br>  r1:=t2-t1;//取得计时时间,单位毫秒(ms)<br>  showmessage(inttostr(r1));<br>  end;<br> <br><br><br><br>   //取毫秒级时间精度(方法二):<br>  //use DateUtils;//引用DateUtils单位<br>  var<br>  t1,t2:tdatetime;<br>  r1:int64;<br>  begin<br>  t1:=now();//获取开始计时时间<br>  sleep(1000);{do...}//执行要计时的代码<br>  t2:=now();//获取结束计时时间<br>  r1:=SecondsBetween(t2,t1);//取得计时时间,单位秒(s)<br>  r1:=MilliSecondsBetween(t2,t1);//取得计时时间,单位毫秒(ms)<br>  showmessage(inttostr(r1));<br>  end;<br><br>  //注:以上两种方式经本人测试好像只能产生0.01秒的计时精度<br><br>  //取系统级时间精度:<br>  var<br>  c1:int64;<br>  t1,t2:int64;<br>  r1:double;<br>  begin<br>  QueryPerformanceFrequency(c1);//WINDOWS API 返回计数频率(Intel86:1193180)(获得系统的高性能频率计数器在一毫秒内的震动次数)<br>  QueryPerformanceCounter(t1);//WINDOWS API 获取开始计数值<br>  sleep(1000);{do...}//执行要计时的代码<br>  QueryPerformanceCounter(t2);//获取结束计数值<br>  r1:=(t2-t1)/c1;//取得计时时间,单位秒(s)<br>  r1:=(t2-t1)/c1*1000;//取得计时时间,单位毫秒(ms)<br>  r1:=(t2-t1)/c1*1000000;//取得计时时间,单位微秒<br>  showmessage(floattostr(r1));<br>  end;
 
没有做过这样的,但可考虑用另一个线程来统计信息!
 
var<br> &nbsp;Form1: TForm1;<br> &nbsp;i:integer;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> &nbsp;j,k:integer;<br>begin<br> &nbsp;Timer1.Enabled:=True;<br> &nbsp;j:=0;<br> &nbsp;//---要计算时间的Procedure<br> &nbsp;for k:=0 to 10000 &nbsp;do<br> &nbsp; &nbsp;j:=j+1;<br> &nbsp;//-------<br> &nbsp;Timer1.Enabled:=False;<br> &nbsp;edit1.Text:=IntToStr(j);<br> &nbsp;edit2.Text:=IntToStr(i);<br> &nbsp;//---edit2显示的为计算所耗费的毫秒数!<br>end;<br>//Timer1的Interval的属性设为1;<br>procedure TForm1.Timer1Timer(Sender: TObject);<br>begin<br> &nbsp;i:=i+1;<br>end;
 
谢谢sdmb,尤其是第三个<br><br>to icelovey: 因为我不用VCL,所以这个用不上了,还是很谢谢你
 
后退
顶部