- Windows Graphics
Uses
Windows, Graphics; - TCanvas, ,
var Cn: TCanvas; - DC
Begin
Cn:= TCanvas.Create; //
Cn.Handle:= GetDC(0); // -
ReleaseDC(0, Cn.Handle); // ,
Cn.Handle:= 0; // , -
Cn.Free; //
try finally.
Types, Forms Dialogs, .
Program Graph_on_screen;
uses //, :
Dialogs, //- ShowMessage
Windows, //- DC
Graphics, //- Canvas
Types, //- Rect
Forms; //- Screen.Width
//Screen.Height, Application
var //:
Cn: TCanvas; //
R:TRect; //
MyRgn: HRGN; //
P:TPoint; //
k:Integer; //
x0:Integer=400; y0:Integer=200; // ,
x1:Integer=400+400; y1:Integer=200+400; //
Begin
Cn:= TCanvas.Create; // ()
Try
Cn.Handle:= GetDC(0); // ()
Try
R:=Rect(x0,y0,x1,y1); //
MyRgn:= CreateRectRgn(x0,y0,x1,y1);//
SelectClipRgn(Cn.Handle,MyRgn); //
//-------------------------
Repeat //1.
//-------------------------
Windows.SleepEx(100, False); // 100
//-------------------------
Cn.Brush.Color:=clRed; //
Cn.Brush.Style:=bsSolid; //
Cn.FillRect(R); //
//-------------------------
Cn.Pen.Color:=clBlue; //
Cn.Pen.Style:=psSolid; //
Cn.Pen.Width:=4; //
Cn.MoveTo(R.Left,R.Top); //
Cn.LineTo(R.Right,R.Bottom); //
//-------------------------
Cn.Brush.Color:=clGreen; //
//Cn.Brush.Style:=bsClear; //
Cn.Font.Color:=clYellow; //
Cn.Font.Size:=14; //
Cn.Font.Style:=[fsBold]; //
Cn.TextOut(R.Left+4,R.Top+16,' ');//
//-------------------------
k:=GetKeyState(32); // ""
GetCursorPos(P); //
Until (k<0) Or //,
((Abs(P.x-R.Left-44-4)<44) And//
(Abs(P.y-R.Top-16-16)<16));
//-------------------------
Application.Title:=' '; //
ShowMessagePos(' ',x1,y0); //
|
|
Finally
ReleaseDC(0, Cn.Handle); //
Cn.Handle:= 0; //
End;
finally //
Cn.Free;
End;
End.
23,24:
ü ,
ü ,
ü ,
ü ,
ü
, . , .
. .