-
2011. 4. 19. 23:22 Tutorials/IDE]Delphi 7.2
파일을 다룰 시스템 메뉴를 등록합니다.
시스템 메뉴 컨트롤을 더블클릭 하거나 마우스 우클릭 후 메뉴 디자인 선택.
시스템 메뉴 디자인은 빈곳을 클릭하여 캡션을 지정하면 등록 됩니다.
var
Form1: TForm1;
BMP: TBitmap;
implementation
procedure TForm1.FormCreate(Sender: TObject);begin
BMP := TBitmap.Create;
BMP.PixelFormat := pf32bit;
BMP.Width := Self.Width;
BMP.Height := Self.Height;
Image1.Width := BMP.Width;
Image1.Height := BMP.Height;
end;
procedure TForm1.FormResize(Sender: TObject);begin
Image1.Left := Self.Width div 2 - Image1.Width div 2;
Image1.Top := Self.Height div 2 - Image1.Height div 2;
end;
procedure TForm1.FormPaint(Sender: TObject);begin
Image1.Canvas.Draw(0,0,BMP);
// Image1.Canvas.Brush.Style:=bsSolid;
// Image1.Canvas.Brush.Bitmap := BitMapBrush;
Image1.Canvas.Pen.Color := clBlack;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);begin
BMP.Free;
end;
procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin
BMP.Canvas.MoveTo(X,Y);//점 이동
Image1.Tag := 1;
end;
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin
if Image1.Tag = 1 then begin
BMP.Canvas.LineTo(X,Y);//라인 긋기
end;
end;
procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin
BMP.Canvas.MoveTo(X,Y);//점 이동
Image1.Tag := 0;
end;
procedure TForm1.N2Click(Sender: TObject);begin
if OpenPictureDialog1.Execute then begin
BMP.LoadFromFile( OpenPictureDialog1.FileName );
end;
end;
procedure TForm1.N3Click(Sender: TObject);begin
if SavePictureDialog1.Execute then begin
BMP.SaveToFile( SavePictureDialog1.FileName );
end;
end;