博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Delphi 与 DirectX 之 DelphiX(17): TPictureCollectionItem.PatternWidth、PatternHeight
阅读量:6256 次
发布时间:2019-06-22

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

  hot3.png

本例效果图:
26153811_fSoL.gif

代码文件:

unit Unit1;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, DXDraws, StdCtrls;type  TForm1 = class(TForm)    DXDraw1: TDXDraw;    DXImageList1: TDXImageList;    Button1: TButton;    Button2: TButton;    Button3: TButton;    Button4: TButton;    Button5: TButton;    Button6: TButton;    procedure FormCreate(Sender: TObject);    procedure Button1Click(Sender: TObject);    procedure Button2Click(Sender: TObject);    procedure Button3Click(Sender: TObject);    procedure Button4Click(Sender: TObject);    procedure Button5Click(Sender: TObject);    procedure Button6Click(Sender: TObject);  end;var  Form1: TForm1;implementation{$R *.dfm}var  PicItem: TPictureCollectionItem;  w,h: Integer;procedure TForm1.FormCreate(Sender: TObject);const  ImgPath1 = 'C:\Temp\DelphiX.bmp';begin  DXImageList1.DXDraw := DXDraw1;  PicItem := TPictureCollectionItem(DXImageList1.Items.Add);  PicItem.Picture.LoadFromFile(ImgPath1);  w := PicItem.Width;  h := PicItem.Height;end;procedure TForm1.Button1Click(Sender: TObject);begin  PicItem.PatternWidth := w;  PicItem.PatternHeight := h;  DXDraw1.Surface.Fill(0);  PicItem.Draw(DXDraw1.Surface, 0, 0, 0);  DXDraw1.Flip;end;procedure TForm1.Button2Click(Sender: TObject);begin  PicItem.PatternWidth := w * 2;  PicItem.PatternHeight := h;  DXDraw1.Surface.Fill(0);  PicItem.Draw(DXDraw1.Surface, 0, 0, 0);  DXDraw1.Flip;end;procedure TForm1.Button3Click(Sender: TObject);begin  PicItem.PatternWidth := w div 2;  PicItem.PatternHeight := h;  DXDraw1.Surface.Fill(0);  PicItem.Draw(DXDraw1.Surface, 0, 0, 0);  DXDraw1.Flip;end;procedure TForm1.Button4Click(Sender: TObject);begin  PicItem.PatternWidth := w;  PicItem.PatternHeight := h * 2;  DXDraw1.Surface.Fill(0);  PicItem.Draw(DXDraw1.Surface, 0, 0, 0);  DXDraw1.Flip;end;procedure TForm1.Button5Click(Sender: TObject);begin  PicItem.PatternWidth := w;  PicItem.PatternHeight := h div 2;  DXDraw1.Surface.Fill(0);  PicItem.Draw(DXDraw1.Surface, 0, 0, 0);  DXDraw1.Flip;end;procedure TForm1.Button6Click(Sender: TObject);begin  PicItem.PatternWidth := w*2;  PicItem.PatternHeight := h*2;  DXDraw1.Surface.Fill(0);  PicItem.Draw(DXDraw1.Surface, 0, 0, 0);  DXDraw1.Flip;end;end.

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

你可能感兴趣的文章
Html 常用事件列表
查看>>
UITextView 实现placeholder的方法
查看>>
Maven入门实战笔记-11节[1-5]
查看>>
python的多重继承
查看>>
索引 - 索引排序顺序
查看>>
MoSQL:简化MongoDB与PostgreSQL之间的同步[转]
查看>>
source insight中文显示和处理
查看>>
spring3.1, hibernate4.1 配置备份,struts2.2.1,sitemesh 2.4.2
查看>>
python字符串格式化输出的方式
查看>>
buffer busy waits等待事件
查看>>
MySQL版本之分:Community Server、Embedded Server、Enterprise Server
查看>>
JVM及遗传算法,转摘牛人牛文
查看>>
C#用DataTable实现Group by数据统计
查看>>
iframe如何刷新的三种解决方案
查看>>
每日英语:Fewer Foreigners Eye US Graduate Science Programs
查看>>
Socket异步通信——使用IAsyncResult
查看>>
宋体、构造函数-浅出C++对象模型——理解构造函数、析构函数执行顺序-by小雨...
查看>>
我眼中的sencha touch(2013网页装在兜里)
查看>>
函数分组学通MongoDB——第三天 细说高级操作
查看>>
Windows程序设计_18_程序加载过程
查看>>