另外一個問題是
procedure TForm
Shift: TShiftState; X
begin
Drawing := True;
Image
Origin := Point(X
MovePt := Origin;
OriginPanel
end;
procedure TForm
Shift: TShiftState; X
begin
if Drawing then
DrawShape(Origin
Drawing := False;
end;
procedure TForm
Y: Integer)
begin
if Drawing then
begin
DrawShape(Origin
MovePt := Point(X
DrawShape(Origin
end;
MovePt用來記錄鼠標當前位置
將畫筆
procedure TForm
begin
with Image
begin
if Sender = SolidBrush then Style := bsSolid
else if Sender = ClearBrush then Style := bsClear
else if Sender = HorizontalBrush then Style := bsHorizontal
else if Sender = VerticalBrush then Style := bsVertical
else if Sender = FDiagonalBrush then Style := bsFDiagonal
else if Sender = BDiagonalBrush then Style := bsBDiagonal
else if Sender = CrossBrush then Style := bsCross
else if Sender = DiagCrossBrush then Style := bsDiagCross;
end;
procedure TForm
begin
with Image
begin
if Sender = SolidPen then Style := psSolid
else if Sender = DashPen then Style := psDash
else if Sender = DotPen then Style := psDot
else if Sender = DashDotPen then Style := psDashDot
else if Sender = DashDotDotPen then Style := psDashDotDot
else if Sender = ClearPen then Style := psClear;
end;
end;
TGraphic對象是TBitmap
TPicture對象可以保存位圖
procedure TForm
begin
BitBtn
end;
要保存一個位圖
TImage部件用以在窗體中顯示圖像
位圖對象包含一個位圖圖像
如果Monochrome屬性設置成假
調用Draw和StretchDraw方法可在畫布上繪制位圖
本章例程中
以下代碼是將圖像文件裝載至圖像部件上
procedure TImageForm
var
FileExt: string[
begin
FileExt := UpperCase(ExtractFileExt(FileListBox
if (FileExt =
begin
Image
Label
if (FileExt =
begin
Label
Format(
ViewForm
ViewAsGlyph(FileExt)
end;
if FileExt =
if FileExt =
ViewForm
end;
end;
這個過程首先判斷文件類型
[
From:http://tw.wingwit.com/Article/program/Delphi/201311/25244.html