为什么没有显示?(0分)

  • 主题发起人 主题发起人 zhengxb
  • 开始时间 开始时间
Z

zhengxb

Unregistered / Unconfirmed
GUEST, unregistred user!
我抄书上的程序,但运行时没有显示,书上是旋转的文字显示<br><br>unit Unit1;<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 FormMouseUp(Sender:TObject;Button:TMouseButton;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Shift:TShiftState;x,y:integer);<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; &nbsp; procedure FormClose(Sender: TObject; var Action: TCloseAction);<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>&nbsp; m_LF:LOGFONT;<br>&nbsp; NewFont:HGDIOBJ;<br>&nbsp; OrgFont:HGDIOBJ;<br>&nbsp; hdc1:HDC;<br>implementation<br><br>{$R *.DFM}<br>procedure Tform1.FormMouseUp(Sender:TObject;Button:TMouseButton;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Shift:TShiftState;x,y:integer);<br>var<br>&nbsp; i:integer;<br>begin<br>&nbsp; i:=0;<br>&nbsp; while (i&lt;3600) do<br>&nbsp; begin<br>&nbsp; &nbsp; m_LF.lfEscapement:=i;<br>&nbsp; &nbsp; NewFont:=CreateFontIndirect(m_LF);<br>&nbsp; &nbsp; OrgFont:=SelectObject(hdc1,NewFont);<br>&nbsp; &nbsp; TextOut(hdc1,x,y,'同志工作室',10);<br>&nbsp; &nbsp; NewFont:=SelectObject(hdc1,OrgFont);<br>&nbsp; &nbsp; DeleteObject(NewFont);<br>&nbsp; &nbsp; i:=i+100;<br>&nbsp; end;<br>end;<br><br><br><br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; hdc1:=GetDc(self.Handle);<br>&nbsp; m_LF.lfHeight:=15;<br>&nbsp; m_LF.lfWidth:=15;<br>&nbsp; m_LF.lfEscapement:=0;<br>&nbsp; m_LF.lfWeight:=400;<br>&nbsp; m_LF.lfItalic:=0;<br>&nbsp; m_LF.lfUnderline:=0;<br>&nbsp; m_LF.lfStrikeOut:=0;<br>&nbsp; m_LF.lfOutPrecision:=0;<br>&nbsp; m_LF.lfClipPrecision:=0;<br>&nbsp; m_LF.lfQuality:=0;<br>&nbsp; m_LF.lfPitchAndFamily:=0;<br>&nbsp; m_LF.lfCharSet:=0;<br>&nbsp; setTextColor(hdc1,rgb(0,0,255));<br>&nbsp; setbkMode(hdc1,Transparent);<br>&nbsp; NewFont:=CreatefontIndirect(m_LF);<br>&nbsp; orgFont:=selectObject(hdc1,newfont);<br>end;<br><br>procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);<br>begin<br>&nbsp; Newfont:=selectobject(hdc1,orgfont);<br>&nbsp; deleteobject(newfont);<br>end;<br><br>end.<br>&nbsp;
 
在Form上按鼠标就可以看到。(:
 
我试过了呀,没有什么变化,什么都没有:([:(]
 
按下鼠标拖动就可以看道结果.[:)]
 
是不是我的dekphi有问题?<br>我就是看不见什么显示,上面两位大哥说的我什么也没有看到
 
我这里直接COPY你的代码,一按F9运行,在窗口上点MOUSE,就有效果了<br><br>另:你不会是没将事件关连吧。。。。。
 
agree above!<br>click FormMouseUp in the Events of the Form!
 
接受答案了.
 
后退
顶部