08-08-2016, Saat: 18:34
Selamın aleyküm arkadaşlar Graphics32 companent'de PaintBox32 var ben bir resim koyuyorum bu resmin belirli kordinatına nasıl panel sabitlerim bir türlü çözemedim yardımcı olursanız sevinirim?



Var
xBitmap : TBitmap;
procedure TForm1.btTemizleClick(Sender: TObject);
begin
Image1.Picture.Graphic := xBitmap;
end;
procedure TForm1.btDoldurClick(Sender: TObject);
Var
i : Integer;
x, y : Integer;
Satir : String;
x1, y1 : Integer;
begin
for i := 0 to ListBox1.Count - 1 do begin
Satir := ListBox1.Items[i];
x := StrToInt( Copy(Satir, 1, Pos(',', Satir) -1) );
System.Delete(Satir, 1, Pos(',', Satir));
y := StrToInt( Copy(Satir, 1, Pos('.', Satir) -1) );
x1 := Trunc( X * (Image1.Width / Image1.Picture.Bitmap.Width ) );
y1 := Trunc( Y * (Image1.Height / Image1.Picture.Bitmap.Height) );
with PaintBox1.Canvas do begin
Brush.Style := bsSolid;
Brush.Color := clYellow;
Pen.Color := clBlue;
Pen.Width := 3;
Rectangle(x1-5, y1-5, x1+5, y1+5);
end;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ListBox1.Items.SaveToFile( ChangeFileExt(Application.Exename, '_Koordinat.TXT') );
xBitmap.Free;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
btTemizle.Click;
Application.ProcessMessages;
btDoldur.Click;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
xBitmap := TBitmap.Create;
xBitmap.Assign( Image1.Picture.Bitmap );
If FileExists( ChangeFileExt(Application.Exename, '_Koordinat.TXT') )
then ListBox1.Items.LoadFromFile( ChangeFileExt(Application.Exename, '_Koordinat.TXT') );
end;
procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
if ListBox1.ItemIndex >= 0 then ListBox1.Items.Delete(ListBox1.ItemIndex);
FormResize(Nil);
end;
procedure TForm1.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
Var
x1, y1 : Integer;
begin
x1 := Trunc( X / (Image1.Width / Image1.Picture.Bitmap.Width ) );
y1 := Trunc( Y / (Image1.Height / Image1.Picture.Bitmap.Height) );
Form1.Caption := Format('X: %d, Y:%d', [x1, y1]);
end;
procedure TForm1.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
Var
x1, y1 : Integer;
begin
x1 := Trunc( X / (Image1.Width / Image1.Picture.Bitmap.Width ) );
y1 := Trunc( Y / (Image1.Height / Image1.Picture.Bitmap.Height) );
ListBox1.Items.Add( Format('%d,%d.', [ X1, Y1]) );
FormResize(Nil);
end;
end.
