菜鸟求delphi高手解决CreateParams和showmessage的问题!! ( 积分: 88 )

  • 主题发起人 主题发起人 wanglong
  • 开始时间 开始时间
W

wanglong

Unregistered / Unconfirmed
GUEST, unregistred user!
我把form1设置成了fsStayOnTop,这是我的代码:只要点击button2,showmessage的那句话就会跑到form1窗体的后面去,不注意的人还以为死机了呢,我知道是fsStayOnTop和CreateParams的原因,但我又必须得用fsStayOnTop,CreateParams,showmessage,哪位高手能解决呢??<br>unit&nbsp;Unit1;<br><br>interface<br><br>uses<br>&nbsp;&nbsp;Windows,&nbsp;Messages,&nbsp;SysUtils,&nbsp;Variants,&nbsp;Classes,&nbsp;Graphics,&nbsp;Controls,&nbsp;Forms,<br>&nbsp;&nbsp;Dialogs,&nbsp;StdCtrls;<br><br>type<br>&nbsp;&nbsp;TForm1&nbsp;=&nbsp;class(TForm)<br>&nbsp;&nbsp;&nbsp;&nbsp;Button2:&nbsp;TButton;<br>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;Button2Click(Sender:&nbsp;TObject);<br>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;CreateParams(var&nbsp;Params:&nbsp;TCreateParams);&nbsp;override;<br>&nbsp;&nbsp;private<br>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;Private&nbsp;declarations&nbsp;}<br>&nbsp;&nbsp;public<br>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;Public&nbsp;declarations&nbsp;}<br>&nbsp;&nbsp;end;<br><br>var<br>&nbsp;&nbsp;Form1:&nbsp;TForm1;<br><br>implementation<br><br>uses&nbsp;Unit2;<br><br>{$R&nbsp;*.dfm}<br><br>procedure&nbsp;TForm1.CreateParams(var&nbsp;Params:&nbsp;TCreateParams);<br>begin<br>&nbsp;&nbsp;inherited;<br>&nbsp;&nbsp;Params.WndParent&nbsp;:=&nbsp;0;<br>end;<br><br>procedure&nbsp;TForm1.Button2Click(Sender:&nbsp;TObject);<br>begin<br>&nbsp;&nbsp;showmessage('看看跑没跑后面去');<br>end;<br><br>end.
 
后退
顶部