Z
zhengxb
Unregistered / Unconfirmed
GUEST, unregistred user!
这是我刚刚抄书上的例子,但出错了,我不知道如何定义句柄。<br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;<br><br>type<br> TForm1 = class(TForm)<br> procedure FormMouseUp(Sender:Tobject;Button:TMouseButton;<br> Shift:TShiftState;x,y:integer);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br> TheRect:TRect;<br> hdc:HDC;<br> str1Char;<br>implementation<br><br>{$R *.DFM}<br>procedure TForm1.FormMouseUp(Sender:Tobject;Button:TMouseButton;<br> Shift:TShiftState;x,y:integer);<br>begin<br> TheRect.Left:=x;<br> theRect.Top:=y;<br> theRect.Right:=x+100;<br> theRect.Bottom:=y+100;<br> hdc1:=GetDC(self.Handle);<br> SetTextColor(hdc1,rgb(255,0,0));<br> setbkMode(hdc1,transparent);<br> str1:='同志工作室';<br> drawText(hdc1,str1,-1,theRect,DT_left);<br>end;<br>end.<br>//出错信息。<br>[Error] Unit1.pas(21): Constant or type identifier expected<br>[Error] Unit1.pas(33): Undeclared identifier: 'hdc1'<br>