做一个类似于DELPHI代码编辑器的东东,但在拦截最大化消息时总有闪烁,请问各位大虾如何去之?(100分)

  • 主题发起人 主题发起人 liusm
  • 开始时间 开始时间
L

liusm

Unregistered / Unconfirmed
GUEST, unregistred user!
我想做一个类似于DELPHI代码编辑器的东东代码如下:<br><br>unit lsm;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; procedure FormShow(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br>USES LIUSM;<br>{$R *.DFM}<br>procedure TForm1.FormShow(Sender: TObject);<br>var<br>&nbsp; Form2: TForm2;<br>begin<br>FORM2:=TFORM2.Create(APPLICATION);<br>FORM2.SHOW;<br>end;<br><br>end.<br><br>unit liusm;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls;<br>type<br>TForm2 = class(TForm)<br>private<br>Procedure WMMyMessage(var Message:TWMSYSCOMMAND);Message WM_SYSCOMMAND;<br>{ Private declarations }<br>public<br>{ Public declarations }<br>end;<br><br>var<br>&nbsp; Form2: TForm2;<br><br>implementation<br><br>uses lsm;<br><br>{$R *.DFM}<br>procedure tform2.WMMyMessage(var Message:TWMSYSCOMMAND);<br>//以下为消息控制的代码<br>VAR<br>SS:TRECT;<br>begin<br>INHERITED;<br>if (MESSAGE.CMDTYPE AND $FFF0=SC_MAXIMIZE) then<br>&nbsp; &nbsp;begin//调用先前的处理函数<br>&nbsp; &nbsp; &nbsp;IF GETWINDOWRECT(FORM1.HANDLE,SS)=TRUE THEN<br>&nbsp; &nbsp; &nbsp; &nbsp; BEGIN<br>&nbsp; &nbsp; &nbsp; &nbsp; if SS.Bottom&lt;screen.height/2 then<br>&nbsp; &nbsp; &nbsp; &nbsp; SetWindowPos(HANDLE,HWND_TOP,0,ss.Bottom,SCREEN.WIDTH,screen.height-ss.Bottom,SWP_SHOWWINDOW);<br>&nbsp; &nbsp; &nbsp; &nbsp; END;<br>&nbsp; &nbsp;END;<br>END;<br>end.<br>
 
代码没传玩,小于号被当作控制符啦!
 
接上面 &nbsp; &nbsp; &nbsp; &nbsp;if SS.Bottom&lt;screen.height/2 then<br>&nbsp; &nbsp; &nbsp; &nbsp; SetWindowPos(HANDLE,HWND_TOP,0,ss.Bottom,SCREEN.WIDTH,screen.height-ss.Bottom,SWP_SHOWWINDOW);<br>&nbsp; &nbsp; &nbsp; &nbsp; END;<br>&nbsp; &nbsp;END;<br>END;
 
&nbsp; &nbsp; &nbsp; &nbsp;if SS.Bottom小于screen.height/2 then<br>&nbsp; &nbsp; &nbsp; &nbsp; SetWindowPos(HANDLE,HWND_TOP,0,ss.Bottom,SCREEN.WIDTH,screen.height-ss.Bottom,SWP_SHOWWINDOW);<br>&nbsp; &nbsp; &nbsp; &nbsp; END;<br>&nbsp; &nbsp;END;<br>END;
 
delphi6.163.com 上有一个叫 syntaxEdit 的编辑器控件,很不错,还有源码,你可以直<br>接用,也可以拿来学习
 
如果您仅想达到"DELPHI代码编辑器"这个功能,而不一定要自己编程,可以考虑装<br>mwedit控件,可以做得和DELPHI代码编辑器一模一样.且有源码.
 
delphi6.163.com上不去,mwedit控件在那儿可以找到
 
delphi6.go.163.com
 
“程序员大本营”(汇翠版)光盘(盗版亦可)上有 mwedit 。
 
多人接受答案了。
 
后退
顶部