Delphix of Delphi and DirectX: Tpicturecollectionitem.patternwidth, Patternheight
This example effect chart:
Code files:
unit Unit1;
Interface
uses
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.