本例效果图:



代码文件:


unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls, CheckLst, ExtCtrls, TeCanvas;typeTForm1 = class(TForm)procedure FormCreate(Sender: TObject);procedure FormDestroy(Sender: TObject);procedure FormPaint(Sender: TObject);procedure FormMouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);procedure FormMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);end;varForm1: TForm1;implementation{$R *.dfm}uses GDIPOBJ, GDIPAPI;varrect: TGPRect;pt: TGPPoint;pb: TGPPathGradientBrush;procedure TForm1.FormCreate(Sender: TObject);
varpath: TGPGraphicsPath;ColorSurround: TGPColor;  {只用一种包围色, 就别用数组了}num: Integer;
beginrect := MakeRect(10, 10, ClientWidth-20, ClientHeight-20);path := TGPGraphicsPath.Create;path.AddEllipse(rect);pb := TGPPathGradientBrush.Create(path);pb.SetCenterColor(aclLime);pb.GetCenterPoint(pt);ColorSurround := aclBlack;num := 1;pb.SetSurroundColors(@ColorSurround, num);path.Free;DoubleBuffered := True;
end;procedure TForm1.FormDestroy(Sender: TObject);
beginpb.Free;
end;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
beginpt.X := X;pt.Y := Y;Repaint;
end;procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
beginRepaint;
end;procedure TForm1.FormPaint(Sender: TObject);
varg: TGPGraphics;p: TGPPen;
beging := TGPGraphics.Create(Canvas.Handle);p := TGPPen.Create(aclRed);g.FillEllipse(pb, rect);pb.SetCenterPoint(pt);g.DrawRectangle(p, pt.X-3, pt.Y-3, 6, 6);p.Free;g.Free;
end;end.

窗体文件:


object Form1: TForm1Left = 0Top = 0Caption = 'Form1'ClientHeight = 164ClientWidth = 208Color = clBtnFaceFont.Charset = DEFAULT_CHARSETFont.Color = clWindowTextFont.Height = -11Font.Name = 'Tahoma'Font.Style = []OldCreateOrder = FalsePosition = poDesktopCenterOnCreate = FormCreateOnDestroy = FormDestroyOnMouseDown = FormMouseDownOnMouseUp = FormMouseUpOnPaint = FormPaintPixelsPerInch = 96TextHeight = 13
end

再学 GDI+[62]: 路径画刷(2) - SetCenterPoint、GetCenterPoint相关推荐

  1. 再学 GDI+[68]: 路径画刷(8) - SetBlendTriangularShaped、SetBlendBellShape

    本例效果图(颜色失真严重, 因为 GIF 最多只能接受 256 中颜色): 代码文件: unit Unit1;interfaceusesWindows, Messages, SysUtils, Var ...

  2. 再学 GDI+[67]: 路径画刷(7) - 画个五角星

    本例效果图: 代码1: unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Contro ...

  3. 再学 GDI+[63]: 路径画刷(3) - SetFocusScales、GetFocusScales

    为什么80%的码农都做不了架构师?>>>    本例效果图: 代码文件: unit Unit1;interfaceusesWindows, Messages, SysUtils, V ...

  4. 再学 GDI+[57]: 路径 - Widen

    为什么80%的码农都做不了架构师?>>>    路径的 Widen 方法可以把路径中的线, 根据指定画笔的宽度与样式, 转换为一个范围(有点类似区域); 但转换后再描绘路径就只能使用 ...

  5. 再学 GDI+[56]: 路径 - Warp

    为什么80%的码农都做不了架构师?>>>    通过路径的 Warp 方法可以让路径在一个范围内(四个点决定的范围)变换; 第一个参数可以是 3 个点或 4 个点的数组, 如果是 3 ...

  6. VS2010-MFC(图形图像:GDI对象之画刷CBrush)

    转自:http://www.jizhuomi.com/software/248.html 上一节讲的是画笔CPen的用法,前面也说了,GDI对象中最常用的就是画笔和画刷,本节就讲讲画刷CBrush. ...

  7. 再学 GDI+[20]: TGPTextureBrush 与 TWrapMode

    为什么80%的码农都做不了架构师?>>>    TGPTextureBrush.Create(image: TGPImage; {用于画刷的图像}wrapMode: TWrapMod ...

  8. 再学 GDI+[81]: TGPImage(1) - 显示图像

    已知 GDI+ 可以支持的图像格式: BMP.JPEG.GIF.TIFF.PNG.ICO.WMF.EMF TGPGraphics.DrawImage 函数有太多重载了, 一起列在这吧: functio ...

  9. 再学 GDI+[11]: DrawCurve - 绘制曲线

    本例效果图: 代码文件: unit Unit1;interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Contr ...

最新文章

  1. Leetcode: 112. Path Sum
  2. 【PAT乙级】1039 到底买不买 (20 分)
  3. python3.2安装tornado
  4. Linux 文件与目录管理、ls、cd、pwd、mkdir、rmdir、cp、 rm
  5. 使用fdisk创建好了分区,但是在生成物理卷出现“Device /dev/sdb2 not found (or ignored by filtering).“解决方法
  6. 项目管理和版本跟踪——Redmine和SVN的结合
  7. SAP PS 第19节 里程碑开票
  8. 数独游戏技巧从入门到精通_免费教学视频数独阶梯训练让孩子从入门到精通,数学思维直线上升!...
  9. unity相机旋转带阻尼效果
  10. python蒙特卡洛方法圆周率_使用Python语言的蒙特卡洛方法计算圆周率π的一种实现...
  11. Ubuntu18.04启动后键盘和鼠标失灵
  12. 一份来自于全球的前端面试题清单,看看老外喜欢考哪些题(部分有答案)
  13. 【云和恩墨】zData Light 敏捷助力威海市立医院核心系统性能提升
  14. 街霸 彩虹 m7 android,街霸2四大天王M7
  15. 1小时等于36000毫秒的计算方法
  16. MANIFEST.MF属性读写
  17. 偏振光学的基础(一)
  18. java imageicon大小_自动缩放ImageIcon以标注大小
  19. python 中文乱码 问题深入分析
  20. 电机转速测量(使用激光测速仪和闪频率仪)

热门文章

  1. 高带宽低性能服务器,国外大带宽低延迟服务器首选天下数据美国服务器
  2. datagridview如何将sqlite实现多表查询_服气!月薪3W的Exceler,居然是这样合并多表数据的...
  3. 单片机魔法编程百度云_[2020][欧美][喜剧][魔法教母]高清资源百度云,高清1080P资源在线!...
  4. c语言写入文件后换行,关于文件操作,碰到空格就换行
  5. mysql 备份 索引_mysql-索引、导入、导出、备份、恢复
  6. JS当中的无限分类递归树
  7. Hibernate之二级缓存
  8. javaScript设计模式之常用工厂模式
  9. django request对象和HttpResponse对象
  10. phpMyAdmin ‘tbl_gis_visualization.php’多个跨站脚本漏洞