关于不显示Caption的问题.(100分)

  • 主题发起人 主题发起人 rychu
  • 开始时间 开始时间
R

rychu

Unregistered / Unconfirmed
GUEST, unregistred user!
在C++Builder里,为了不显示Caption,我在form的onCreate句柄中加入<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SetWindowLong(Handle,GWL_STYLE,GetWindowLong(Handle,GWL_STYLE)&amp;~WS_CAPTION);<br>但是窗口仍然有Caption,只是在用鼠标改变窗口大小后Caption才消失.<br><br>这样不行,然后我就重载CreateParams函数,函数申明是:<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;private: &nbsp;void __fastcall CreateParams(TCreateParams&amp;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>函数是:<br>&nbsp; &nbsp; &nbsp; &nbsp; void __fastcall TForm1::CreateParams(TCreateParams &amp; par)<br>&nbsp; &nbsp; &nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TForm::CreateParams(par);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; par.Style &amp;= ~WS_CAPTION;<br>&nbsp; &nbsp; &nbsp; &nbsp; }<br>但是结果和上面的做法一模一样.仍然要动一动鼠标才会有结果.
 
是否可以FormShow时,让Form Invalidate一下,或发Resize的消息
 
procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; SetWindowLong(Form1.Handle,<br>&nbsp; GWL_STYLE,GetWindowLong(Handle,GWL_STYLE) and not WS_CAPTION);<br>&nbsp; Height := ClientHeight;<br>end;
 
也可以<br>procedure TForm1.CreateParams(var Params: TCreateParams);<br>begin<br>&nbsp; inherited createparams(params);<br>&nbsp; with params do<br>&nbsp; begin<br>&nbsp; &nbsp; style:=style and (not ws_caption);<br>&nbsp; &nbsp; style:=style or ws_popup or ws_thickframe or ws_clipchildren;<br>&nbsp; end;<br>end
 
在form的onshow事件中加入form1.refresh应该就可以.
 
时间太久,强制结束。 &nbsp; wjiachun
 

Similar threads

后退
顶部