This example effect chart:
Code files:
Unit Unit1;
Interface
Uses
Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms,
Dialogs, DIB, Stdctrls;
Type
TForm1 = Class (Tform)
Dxpaintbox1:tdxpaintbox;
Button1:tbutton;
Button2:tbutton;
Button3:tbutton;
Button4:tbutton;
Procedure Button1Click (Sender:tobject);
Procedure Button2click (Sender:tobject);
Procedure Button3click (Sender:tobject);
Procedure Button4click (Sender:tobject);
End
Var
Form1:tform1;
Implementation
{$R *.DFM}
Procedure Tform1.button1click (Sender:tobject);
Const
ImgPath1 = ' C:\Temp\DX.jpg ';
Begin
DXPaintBox1.DIB.LoadFromFile (IMGPATH1);
Dxpaintbox1.width: = DXPaintBox1.DIB.Width;
Dxpaintbox1.height: = DXPaintBox1.DIB.Height;
Dxpaintbox1.repaint;
End
Procedure Tform1.button2click (Sender:tobject);
Var
W,h:integer;
Begin
W: = dxpaintbox1.width Div 2;
H: = dxpaintbox1.height Div 2;
DXPaintBox1.DIB.DoResample (W, H, tfiltertyperesample (0));
Dxpaintbox1.repaint;
End
Procedure Tform1.button3click (Sender:tobject);
Var
W,h:integer;
Begin
W: = dxpaintbox1.width Div 2;
H: = Dxpaintbox1.height;
DXPaintBox1.DIB.DoResample (W, H, tfiltertyperesample (0));
Dxpaintbox1.repaint;
End
Procedure Tform1.button4click (Sender:tobject);
Var
W,h:integer;
Begin
W: = Trunc (dxpaintbox1.width * 1.4);
H: = Trunc (dxpaintbox1.height * 1.4);
DXPaintBox1.DIB.DoResample (W, H, tfiltertyperesample (0));
Dxpaintbox1.repaint;
End
End.