Microsoft işletim sistemleri ile beraber gelen Paint programı örnek alınarak hazırlanmış bir programdır. Halen tasarım aşamasındadır. Program gelişmeye açık durumdadır. Başlangıç ve orta seviye Delphi programcılarına hitap etmektedir. Çizgi, kare , yuvarlak vs çizimleri , yazı ekleme, tersleme , resim üzerinde oynama işlemlerine örnek teşkil eder. Programla beraber;
gibi çeşitli konularda da aynı zamanda bilgi sahibi olabilirsiniz. Program içerisinde programcıya hitap eden bir çok yerde hatırlatma notları da bulunmaktadır.
Kod: Kodu kopyalamak için üzerine çift tıklayın!
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Form1.Panel1.Top:=0;
Form1.Panel1.Left:=0;
Form1.Panel3.Left:=0;
Form1.Panel4.Top:=Form1.Height -(Form1.Panel3.Height+16);
Form1.Panel4.Width:=Form1.Width-8;
Form1.Panel4.Left:=0;
Form1.Panel3.Top:=Form1.Height -(Form1.Panel3.Height+Form1.Panel4.Height+54);
Form1.Panel3.Width:=Form1.Width-8;
Form1.Panel1.Height:=Form1.Panel3.Top;
Form1.ScrollBox1.Height:=Form1.Panel3.Top;
Form1.ScrollBox1.Width:=Form1.Width-90;
Form1.ScrollBox1.HorzScrollBar.Range:=Form1.Image1.Width+16;
Form1.ScrollBox1.VertScrollBar.Range:=Form1.Image1.Height+16;
end;
procedure TForm1.RenkleriTersevir1Click(Sender: TObject);
begin
Image1.Canvas.CopyMode:=cmDstInvert;
Image1.Canvas.CopyRect(Rect(0,0,Image1.Width,Image1.Height),Image1.Canvas,Rect(0,0,Image1.Width,Image1.Height));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Openpicturedialog1.DefaultExt:='bmp';
Savepicturedialog1.DefaultExt:='bmp';
resimkont:=0;
yazikont:=0;
cizim:=false;
bank:=100;
anakont:=0;
yenikont:=0;
//ResmiTemizle1.Click;
RenkleriTersevir1.Click;
RenkleriTersevir1.Click;
Form1.ScrollBox1.HorzScrollBar.Range:=Form1.ScrollBox1.HorzScrollBar.Range+15;
Form1.ScrollBox1.VertScrollBar.Range:=Form1.ScrollBox1.VertScrollBar.Range+15;
// Form2 nin çizgilerinin oluşması için
Image2.Canvas.CopyMode:=cmDstInvert;
Image2.Canvas.CopyRect(Rect(0,0,Image2.Width,Image2.Height),Image2.Canvas,Rect(0,0,Image2.Width,Image2.Height));
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var tampon:integer; tampon1:integer;
begin
Image2.Refresh();
Image2.Height:=Image1.Height+15;
Image2.Width:=Image1.Width+15;
Image2.Picture:=nil;
Image2.Canvas.Brush.Color:=Form1.Color;
Image2.Canvas.Rectangle(0,0,Image2.Width,Image2.Height);
Image2.Canvas.Pen.Color:=clBlue;
Image2.Canvas.Rectangle(Image1.Left-3,Image1.Top-3,Image1.Left+Image1.Width-1,Image1.Top+Image1.Height-1);
Image2.Canvas.Brush.Color:=clRed;
Image2.Canvas.Rectangle(Image1.Left-6,Image1.Top-6,Image1.Left-2,Image1.Top-2);
Image2.Canvas.Rectangle(Image1.Left+Image1.Width-2,Image1.Top-2,Image1.Left+Image1.Width+2,Image1.Top-6);
Image2.Canvas.Rectangle(Image1.Left+Image1.Width-2,Image1.Top+Image1.Height-2,Image1.Left+Image1.Width+2,Image1.Top+Image1.Height+2);
Image2.Canvas.Rectangle(Image1.Left-2,Image1.Top+Image1.Height-2,Image1.Left-6,Image1.Top+Image1.Height+2);
tampon:=Image1.Left+Trunc(Image1.Width/2);
tampon1:=Image1.Left+Trunc(Image1.Width/2)-4;
Image2.Canvas.Rectangle(tampon,Image1.Top-2,tampon1,Image1.Top-6);
tampon:=Image1.Left+Trunc(Image1.Width/2)-2;
tampon1:=Image1.Left+Trunc(Image1.Width/2)+2;
Image2.Canvas.Rectangle(tampon,Image1.Top+Image1.Height-2,tampon1,Form1.Image1.Top+Image1.Height+2);
Image2.Canvas.Brush.Color:=clWhite;
Timer2.Enabled:=false;
end;
procedure TForm1.Image2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if cursor=2 then
begin
cursor:=1;
xz:=X;
yz:=Y;
end
end;
procedure TForm1.Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if(((Y=Image1.Top+Image1.Height+1)and(X=Image1.Left+Image1.Width+1))or((Y=Image1.Top+Image1.Height+1)and(X=Image1.Left+Image1.Width+1))) then
begin
Image2.Cursor:=crSizeNWSE;
cursor:=2;
end
else
Image2.Cursor:=crDefault;
end;
procedure TForm1.Image2MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if cursor=1 then
begin
Image2.Cursor:=crDefault;
Image1.Height:=Image1.Height+(Y-yz);
Image1.Width:=Image1.Width+(X-xz);
cursor:=0;
Timer2.Enabled:=true;
end
end;