摘要: 在窗体上添加 Panel1、PaintBox1 和 Button1, 代码如下: procedure TForm1.Button1Click(Sender: TObject); var cvs: TCanvas; begin {PaintBox1 就像窗体一样, 也有 Canvas 属性} PaintBox1.Canvas.Brush.Color := clRed; Pain... 阅读全文
posted @ 2008-02-16 23:25 万一 阅读(12430) 评论(3) 推荐(1)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-02-16 22:53 万一 阅读(8092) 评论(0) 推荐(0)
摘要: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton... 阅读全文
posted @ 2008-02-16 22:21 万一 阅读(11608) 评论(8) 推荐(1)
摘要: 绘图需要有纸、画笔、画刷; Delphi 有 Canvas、Pen、Brush. Canvas 就是画布, 譬如窗体的 Canvas 属性, 就是窗体的画布; Pen 是画笔, 可以设置笔色、笔宽等等; Brush 是画刷, 可以设置颜色等等. //举例: {绘制直线} procedure TForm1.Button1Click(Sender: TObject); begin Canv... 阅读全文
posted @ 2008-02-16 21:26 万一 阅读(9142) 评论(23) 推荐(0)
摘要: //过程: Arc BrushCopy Chord CopyRect Draw DrawFocusRect Ellipse Ellipse FillRect FloodFill FrameRect LineTo Lock MoveTo Pie Polygon Polyline PolyBezier PolyBezierTo Rectangle Rectangle Refresh RoundRec... 阅读全文
posted @ 2008-02-16 19:12 万一 阅读(7899) 评论(10) 推荐(0)
摘要: //Graphics 单元中的类 TGraphicsObject TFont TPen TBrush TFontRecall TPenRecall TBrushRecall TCanvas TGraphic TPicture TMetafileCanvas TMetafileImage TMetafile TBitmapImage TBitmap TIconImage TIcon TResour... 阅读全文
posted @ 2008-02-16 18:50 万一 阅读(4458) 评论(10) 推荐(0)
摘要: //创建定时器函数的声明: SetTimer( hWnd: HWND; {与定时器相关联的窗口句柄} nIDEvent: UINT; {指定一个非 0 的定时器标识符} uElapse: UINT; {指定间隔时间, 单位是毫秒} lpTimerFunc: TFNTimerProc {每到时间后, 要调用的函数... 阅读全文
posted @ 2008-02-16 14:51 万一 阅读(7833) 评论(8) 推荐(1)
摘要: //声明: QueryPerformanceCounter( var lpPerformanceCount: TLargeInteger {获取定时器每秒的频率数; TLargeInteger = Int64} ): BOOL; {返回 False 表示调用失败, 或者是硬件不支持高性能定时器} //一个有趣的示例: 判断你的鼠标点击速度; 我的最快记录是 151 毫米 var n1... 阅读全文
posted @ 2008-02-16 14:24 万一 阅读(3337) 评论(0) 推荐(0)
摘要: //声明: QueryPerformanceFrequency( var lpFrequency: TLargeInteger {此参数获取定时器每秒的频率数; TLargeInteger = Int64} ): BOOL; {返回 False 表示硬件不支持高性能定时器} //举例: var i: Int64; begin if ... 阅读全文
posted @ 2008-02-16 13:56 万一 阅读(6121) 评论(7) 推荐(0)
摘要: //一种获取无符号整数最大值的方法: procedure TForm1.Button1Click(Sender: TObject); var {Delphi 标准的无符号整数类型只有三种} num_Byte : Byte; num_Word : Word; num_Cardinal : Cardinal; {Windows API 中相应的类型就太多了, 下... 阅读全文
posted @ 2008-02-16 11:36 万一 阅读(6006) 评论(0) 推荐(0)
摘要: //如果有这样一个循环, 是非常可怕的; 因为它完不了, 你得等着. procedure TForm1.Button1Click(Sender: TObject); var i: Integer; begin for i := 0 to MaxInt do begin Text := IntToStr(i); end; end; //即使这样也无济于事, 因为在循环期... 阅读全文
posted @ 2008-02-16 10:55 万一 阅读(12885) 评论(11) 推荐(0)