博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
WinAPI: BeginPath、EndPath、StrokePath、FillPath、StrokeAndFillPath
阅读量:6084 次
发布时间:2019-06-20

本文共 2010 字,大约阅读时间需要 6 分钟。

  hot3.png

BeginPath         {路径开始}EndPath           {路径结束}StrokePath        {绘制路径}FillPath          {填充路径}StrokeAndFillPath {绘制并填充路径}//在路径中可以使用的图形命令有:AngleArcArcArcToChordCloseFigureEllipseExtTextOutLineToMoveToExPiePolyBezierPolyBezierToPolyDrawPolygonPolylinePolylineToPolyPolygonPolyPolylineRectangleRoundRectTextOut
本例效果图:
26153147_cswk.gif

代码文件:

unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, StdCtrls, ExtCtrls;type  TForm1 = class(TForm)    RadioGroup1: TRadioGroup;    procedure FormCreate(Sender: TObject);    procedure FormPaint(Sender: TObject);    procedure RadioGroup1Click(Sender: TObject);  end;var  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);begin  RadioGroup1.Items.CommaText := '绘制路径,填充路径,绘制并填充';  RadioGroup1.ItemIndex := 0;  RadioGroup1.Columns := RadioGroup1.Items.Count;end;procedure TForm1.FormPaint(Sender: TObject);begin  Canvas.Font.Size := 36;  Canvas.Font.Style := [fsBold];  SetBkMode(Canvas.Handle, TRANSPARENT);  BeginPath(Canvas.Handle);  Canvas.Rectangle(10,10,110,110);  Canvas.TextOut(20,30,'Delphi 2007');  EndPath(Canvas.Handle);  Canvas.Brush.Color := clYellow;  Canvas.Pen.Color := clRed;  case RadioGroup1.ItemIndex of    0: StrokePath(Canvas.Handle);    1: FillPath(Canvas.Handle);    2: StrokeAndFillPath(Canvas.Handle);  end;end;procedure TForm1.RadioGroup1Click(Sender: TObject);begin  Repaint;end;end.
窗体设计:

object Form1: TForm1  Left = 373  Top = 260  Caption = 'Form1'  ClientHeight = 193  ClientWidth = 321  Color = clBtnFace  Font.Charset = DEFAULT_CHARSET  Font.Color = clWindowText  Font.Height = -11  Font.Name = 'Tahoma'  Font.Style = []  OldCreateOrder = False  Position = poDesigned  OnCreate = FormCreate  OnPaint = FormPaint  PixelsPerInch = 96  TextHeight = 13  object RadioGroup1: TRadioGroup    Left = 28    Top = 131    Width = 265    Height = 49    Caption = 'RadioGroup1'    TabOrder = 0    OnClick = RadioGroup1Click  endend

转载于:https://my.oschina.net/hermer/blog/319454

你可能感兴趣的文章
iOS程序员 如何做到升职加薪,5年 开发经验 码农 笔记送给你!
查看>>
win7电脑关机时间长怎么办
查看>>
MySQL配置文件mysql.ini参数详解
查看>>
struts2中Action到底是什么,怎么理解
查看>>
C++小思
查看>>
Longest Substring Without Repeating Characters
查看>>
Using the memcached telnet interface
查看>>
as3 AIR 添加或删除ApplicationDirectory目录下文件
查看>>
浅析伪数组
查看>>
验证码生成 点击刷新 ajax校验
查看>>
THINKPHP 默认模板路径替换
查看>>
mysql5.7 windows7编码统一utf-8
查看>>
nyoj-回文字符串--动态规划
查看>>
.Net Core 实践 - 使用log4net记录日志(2)
查看>>
洛谷 P1443 马的遍历
查看>>
部署腾讯云(CentOS6.6版本,jdk1.7+tomcat8+mysql)
查看>>
magento-installation: Magento SSL Error 310 net::ERR_TOO_MANY_REDIRECTS
查看>>
springboot跨域问题
查看>>
nginx搭建mp4和flv播放器
查看>>
CGI的函数
查看>>