Recent Posts

Selamat datang di Coding Delphi Land Weblog kumpulan source code pemogram delphi

(Bukan maksud untuk menggurui tetapi marilah kita berbagi ilmu tuk perkembangan kemajuan teknologi kita

Selasa, 17 November 2009

Zoom Content in StringGrid

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, StdCtrls, Buttons;

type
TForm1 = class(TForm)
grid: TStringGrid;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private

procedure gridZoom(FFact: Real);
public

end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.gridZoom(FFact: Real);
var
x: Integer;
begin
for x := 0 to grid.colcount - 1 do
grid.colwidths[x] := round(grid.colwidths[x] * FFact);

for x := 0 to grid.RowCount - 1 do
grid.rowheights[x] := round(grid.rowheights[x] * FFact);

grid.Font.Size := round(grid.rowheights[0] * 0.65);
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
gridZoom(1.1);
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
gridZoom(0.9);
end;

0 komentar:

Posting Komentar