亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mainfrm.pas

?? 簡單的DELPHI的繪圖程序,可以畫出不同的各種已知圖形,書上看的.與大家分享
?? PAS
?? 第 1 頁 / 共 2 頁
字號:
unit MainFrm;

interface

uses
  SysUtils, Windows, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, Buttons, ExtCtrls, ColorGrd, StdCtrls, Menus, ComCtrls;

const
  crMove = 1;
type

  TDrawType = (dtLineDraw, dtRectangle, dtEllipse, dtRoundRect,
               dtClipRect, dtCrooked);

  TMainForm = class(TForm)
    sbxMain: TScrollBox;
    imgDrawingPad: TImage;
    pnlToolBar: TPanel;
    sbLine: TSpeedButton;
    sbRectangle: TSpeedButton;
    sbEllipse: TSpeedButton;
    sbRoundRect: TSpeedButton;
    pnlColors: TPanel;
    cgDrawingColors: TColorGrid;
    pnlFgBgBorder: TPanel;
    pnlFgBgInner: TPanel;
    Bevel1: TBevel;
    mmMain: TMainMenu;
    mmiFile: TMenuItem;
    mmiExit: TMenuItem;
    N2: TMenuItem;
    mmiSaveAs: TMenuItem;
    mmiSaveFile: TMenuItem;
    mmiOpenFile: TMenuItem;
    mmiNewFile: TMenuItem;
    mmiEdit: TMenuItem;
    mmiPaste: TMenuItem;
    mmiCopy: TMenuItem;
    mmiCut: TMenuItem;
    sbRectSelect: TSpeedButton;
    SaveDialog: TSaveDialog;
    OpenDialog: TOpenDialog;
    stbMain: TStatusBar;
    pbPasteBox: TPaintBox;
    sbFreeForm: TSpeedButton;
    RgGrpFillOptions: TRadioGroup;
    cbxBorder: TCheckBox;
    mmiHelp: TMenuItem;
    mmiAbout: TMenuItem;
    procedure FormCreate(Sender: TObject);
    procedure sbLineClick(Sender: TObject);
    procedure imgDrawingPadMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure imgDrawingPadMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure imgDrawingPadMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure cgDrawingColorsChange(Sender: TObject);
    procedure mmiExitClick(Sender: TObject);
    procedure mmiSaveFileClick(Sender: TObject);
    procedure mmiSaveAsClick(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure mmiNewFileClick(Sender: TObject);
    procedure mmiOpenFileClick(Sender: TObject);
    procedure mmiEditClick(Sender: TObject);
    procedure mmiCutClick(Sender: TObject);
    procedure mmiCopyClick(Sender: TObject);
    procedure mmiPasteClick(Sender: TObject);
    procedure pbPasteBoxMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure pbPasteBoxMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure pbPasteBoxMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure pbPasteBoxPaint(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure RgGrpFillOptionsClick(Sender: TObject);
  public
    { Public declarations }
    MouseOrg: TPoint;    // 用于保存鼠標信息
    NextPoint: TPoint;   // 用于保存鼠標信息
    Drawing: Boolean;
    DrawType: TDrawType; // 用于保存繪畫類型信息
    FillSelected,
    BorderSelected: Boolean;
    EraseClipRect: Boolean;
    Modified: Boolean;
    FileName: String;
    OldClipViewHwnd: Hwnd;
    { Paste Image variables }
    PBoxMoving: Boolean;
    PBoxMouseOrg: TPoint;
    PasteBitMap: TBitmap;
    Pasted: Boolean;
    LastDot: TPoint;

    procedure DrawToImage(TL, BR: TPoint; PenMode: TPenMode);
    { This procedure paints the image specified by the DrawType field
      to imgDrawingPad }
    procedure SetDrawingStyle;
    { This procedure sets various Pen/Brush styles based on values
      specified by the form's controls. The Panels and color grid is
      used to set these values }
    procedure CopyPasteBoxToImage;
    { This procedure copies the data pasted from the Windows clipboard
      onto the main image component imgDrawingPad }
    procedure WMDrawClipBoard(var Msg: TWMDrawClipBoard);
       message WM_DRAWCLIPBOARD;
    { This message handler captures the WM_DRAWCLIPBOARD messages
      which is sent to all windows that have been added to the clipboard
      viewer chain. An application can add itself to the clipboard viewer
      chain by using the SetClipBoardViewer() Win32 API function as
      is done in FormCreate() }
    procedure CopyCut(Cut: Boolean);
    { This method copies a portion of the main image, imgDrawingPad, to the
      Window's clipboard. }
  end;

var
  MainForm: TMainForm;

implementation
uses ClipBrd, Math;

{$R *.DFM}

procedure TMainForm.FormCreate(Sender: TObject);
{ This method sets the form's field to their default values. It then
  creates a bitmap for the imgDrawingPad.  This is the image on which
  drawing is done. Finally, it adds this application as part of the
  Windows clipboard viewer chain by using the SetClipBoardViewer()
  function. This makes enables the form to get WM_DRAWCLIPBOARD messages
  which are sent to all windows in the clipboard viewer chain whenever
  the clipboard data is modified. }
begin
  Screen.Cursors[crMove] := LoadCursor(hInstance, 'MOVE');

  FillSelected   := False;
  BorderSelected := True;

  Modified := False;
  FileName := '';
  Pasted := False;
  pbPasteBox.Enabled := False;

  // Create a bitmap for imgDrawingPad and set its boundaries
  with imgDrawingPad do
  begin
    SetBounds(0, 0, 600, 400);
    Picture.Graphic := TBitMap.Create;
    Picture.Graphic.Width := 600;
    Picture.Graphic.Height := 400;
  end;
  // Now create a bitmap image to hold pasted data
  PasteBitmap := TBitmap.Create;
  pbPasteBox.BringToFront;
  { Add the form to the Windows clipboard viewer chain. Save the handle
    of the next window in the chain so that it may be restored by the
    ChangeClipboardChange() Win32 API function in this form's
    FormDestroy() method. }
  OldClipViewHwnd := SetClipBoardViewer(Handle);
end;

procedure TMainForm.WMDrawClipBoard(var Msg: TWMDrawClipBoard);
begin
  { This method will be called whenever the clipboard data
    has changed. Because the main form was added to the clipboard
    viewer chain, it will receive the WM_DRAWCLIPBOARD message
    indicating that the clipboard's data was changed. }
  inherited;
  { Make sure that the data contained on the clipboard is actually
    bitmap data. }
  if ClipBoard.HasFormat(CF_BITMAP) then
    mmiPaste.Enabled := True
  else
    mmiPaste.Enabled := False;
  Msg.Result := 0;
end;


procedure TMainForm.DrawToImage(TL, BR: TPoint; PenMode: TPenMode);
{ 該過程用于執行指定的繪畫操作,繪畫操作由DrawType決定}
begin
  with imgDrawingPad.Canvas do   //在畫布上繪畫
  begin
    Pen.Mode := PenMode;  //指定筆模式

    case DrawType of
      dtLineDraw:     //畫直線
        begin
          MoveTo(TL.X, TL.Y);
          LineTo(BR.X, BR.Y);
        end;
      dtRectangle:    //畫矩形
        Rectangle(TL.X, TL.Y, BR.X, BR.Y);
      dtEllipse:      //畫橢圓
        Ellipse(TL.X, TL.Y, BR.X, BR.Y);
      dtRoundRect:      //畫圓角矩形
        RoundRect(TL.X, TL.Y, BR.X, BR.Y,
          (TL.X - BR.X) div 2, (TL.Y - BR.Y) div 2);
      dtClipRect:       //畫剪裁區域
        Rectangle(TL.X, TL.Y, BR.X, BR.Y);
    end;
  end;
end;

procedure TMainForm.CopyPasteBoxToImage;
{ 這個過程復制從剪貼板粘貼到 imgDrawingPad
This method copies the image pasted from the Windows clipboard onto
  imgDrawingPad. It first erases any bounding rectangle drawn by PaintBox
  component, pbPasteBox. It then copies the data from pbPasteBox onto
  imgDrawingPad at the location where pbPasteBox has been dragged
  over imgDrawingPad. The reason we don't copy the contents of
  pbPasteBox's canvas and use PasteBitmap's canvas instead, is because
  when a portion of pbPasteBox is dragged out of the viewable area,
  Windows does not paint the portion pbPasteBox not visible. Therefore,
  it is necessary to the pasted bitmap from the off-screen bitmap }
var
  SrcRect, DestRect: TRect;
begin
  // 首先,擦除由pbPasteBox繪制的矩形
  with pbPasteBox do
  begin
    Canvas.Pen.Mode := pmNotXOR;
    Canvas.Pen.Style := psDot;
    Canvas.Brush.Style := bsClear;
    Canvas.Rectangle(0, 0, Width, Height);
    DestRect := Rect(Left, Top, Left+Width, Top+Height);
    SrcRect := Rect(0, 0, Width, Height);
  end;
  { Here we must use the PasteBitmap instead of the pbPasteBox because
    pbPasteBox will clip anything outside if the viewable area. }
  imgDrawingPad.Canvas.CopyRect(DestRect, PasteBitmap.Canvas, SrcRect);
  pbPasteBox.Visible := false;
  pbPasteBox.Enabled := false;
  Pasted := False;  // 完成粘貼操作
end;

procedure TMainForm.imgDrawingPadMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Modified := True;
  // Erase the clipping rectangle if one has been drawn
  if (DrawType = dtClipRect) and EraseClipRect then
    DrawToImage(MouseOrg, NextPoint, pmNotXOR)
  else if (DrawType = dtClipRect) then
    EraseClipRect := True; // Re-enable cliprect erasing

  { If an bitmap was pasted from the clipboard, copy it to the
    image and remove the PaintBox. }
  if Pasted then
    CopyPasteBoxToImage;

  Drawing := True;
  // Save the mouse information
  MouseOrg := Point(X, Y);
  NextPoint := MouseOrg;
  LastDot := NextPoint;   // Lastdot is updated as the mouse moves
  imgDrawingPad.Canvas.MoveTo(X, Y);
  stbMain.Panels[0].Text := Format('原始鼠標位置坐標:   (%d, %d)', [X, Y]);
end;

procedure TMainForm.imgDrawingPadMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
{ This method determines the drawing operation to be performed and
  either performs free form line drawing, or calls the
  DrawToImage method which draws the specified shape }
begin
  if Drawing then
  begin
    if DrawType = dtCrooked then
    begin
      imgDrawingPad.Canvas.MoveTo(LastDot.X, LastDot.Y);
      imgDrawingPad.Canvas.LineTo(X, Y);
      LastDot := Point(X,Y);
    end
    else begin
      DrawToImage(MouseOrg, NextPoint, pmNotXor);
      NextPoint := Point(X, Y);
      DrawToImage(MouseOrg, NextPoint, pmNotXor)
    end;
  end;
  // 以當前鼠標位置更新狀態條
  stbMain.Panels[1].Text := Format('當前鼠標位置坐標:   (%d, %d)', [X, Y]);
end;

procedure TMainForm.imgDrawingPadMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Drawing then
  { Prevent the clipping rectangle from destroying the images already
    on the image }
    if not (DrawType = dtClipRect) then
      DrawToImage(MouseOrg, Point(X, Y), pmCopy);
  Drawing := False;
end;

procedure TMainForm.sbLineClick(Sender: TObject);
begin
  // First erase the cliprect if current drawing type
  if DrawType = dtClipRect then
     DrawToImage(MouseOrg, NextPoint, pmNotXOR);

  { Now set the DrawType field to that specified by the TSpeedButton
    invoking this method. The TSpeedButton's Tag values match a
    specific TDrawType value which is why the typecasting below
    successfully assigns a valid TDrawType value to the DrawType field. }
  if Sender is TSpeedButton then
    DrawType := TDrawType(TSpeedButton(Sender).Tag);

  // Now make sure the dtClipRect style doesn't erase previous drawings
  if DrawType = dtClipRect then begin
    EraseClipRect := False;
  end;
  // Set the drawing style
  SetDrawingStyle;
end;

procedure TMainForm.cgDrawingColorsChange(Sender: TObject);
{ This method draws the rectangle representing fill and border colors
  to indicate the users selection of both colors. pnlFgBgInner and
  pnlFgBgBorder are TPanels arranged one on to of the other for the
  desired effect }
begin
  pnlFgBgBorder.Color := cgDrawingColors.ForeGroundColor;
  pnlFgBgInner.Color := cgDrawingColors.BackGroundColor;
  SetDrawingStyle;
end;


procedure TMainForm.SetDrawingStyle;
{  This method sets the various drawing styles based on the selections

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
粉嫩嫩av羞羞动漫久久久| 亚洲欧美日韩一区| 国产一区二区在线观看视频| 91在线精品秘密一区二区| 中文字幕日韩一区二区| 9i看片成人免费高清| 亚洲乱码精品一二三四区日韩在线| 成a人片国产精品| 亚洲色图视频网站| 精品视频1区2区| 日本91福利区| 欧美激情一区不卡| 日本韩国欧美国产| 日韩va欧美va亚洲va久久| 26uuu欧美| 99国产精品视频免费观看| 亚洲国产毛片aaaaa无费看 | 欧美日韩国产影片| 日本中文字幕一区| 日本一区二区不卡视频| 欧美性生交片4| 麻豆精品久久久| 国产精品美女久久久久久久 | 久久er99热精品一区二区| 国产欧美视频一区二区三区| 91麻豆.com| 久久99国产精品久久| 国产精品久久久爽爽爽麻豆色哟哟| 色激情天天射综合网| 免费观看久久久4p| 亚洲图片欧美激情| 色婷婷久久99综合精品jk白丝| 欧美日韩国产成人在线免费| 欧美一区日韩一区| 国产98色在线|日韩| 亚洲一区二区欧美日韩| 久久亚洲精品国产精品紫薇| 色爱区综合激月婷婷| 久久不见久久见免费视频1| 亚洲精品中文字幕乱码三区| 日韩精品一区二区三区swag | 在线观看亚洲精品视频| 美女mm1313爽爽久久久蜜臀| 亚洲人成网站精品片在线观看| 日韩一区二区在线观看视频| 91久久一区二区| 国产精品综合在线视频| 婷婷中文字幕一区三区| 中文字幕一区在线观看视频| 精品国精品自拍自在线| 欧美中文字幕久久| av成人动漫在线观看| 国产一区二区主播在线| 五月天中文字幕一区二区| 亚洲欧洲精品一区二区三区| 精品国产一区二区三区久久久蜜月| 欧美亚洲尤物久久| 91丨国产丨九色丨pron| 国产乱码一区二区三区| 老司机一区二区| 日本黄色一区二区| www.亚洲精品| 成人黄色软件下载| 成人精品电影在线观看| 国产麻豆视频精品| 韩国成人福利片在线播放| 日本美女一区二区三区视频| 香蕉久久夜色精品国产使用方法| 亚洲精品国久久99热| 中文字幕视频一区| 中文字幕在线不卡国产视频| 中文字幕一区二区三| 国产精品你懂的| 国产精品福利一区二区| 日本一区二区久久| √…a在线天堂一区| 国产精品久久久久久久久免费樱桃| 久久久久久久久岛国免费| 精品福利在线导航| 久久久亚洲精品石原莉奈| wwwwww.欧美系列| 久久久久国产精品免费免费搜索| 久久婷婷久久一区二区三区| 欧美精品一区二区三区久久久| 久久青草国产手机看片福利盒子| 精品国产百合女同互慰| 精品国产电影一区二区| 久久亚洲免费视频| 中文字幕免费一区| 中文字幕日韩欧美一区二区三区| 亚洲欧洲无码一区二区三区| 亚洲天堂中文字幕| 亚洲一区二区精品久久av| 日韩黄色免费网站| 国产乱码精品一区二区三区av| 成人一区二区三区视频在线观看| 成人免费福利片| 一本久道中文字幕精品亚洲嫩| 在线免费观看日本欧美| 欧美一区二区三区视频在线| 久久美女高清视频| 亚洲欧美影音先锋| 亚洲第一二三四区| 国产一区二区三区四区五区美女 | 国产精品午夜在线观看| 国产精品国产精品国产专区不片| 亚洲色图一区二区| 日本va欧美va欧美va精品| 国产精品996| 色美美综合视频| 日韩写真欧美这视频| 亚洲国产精品av| 亚洲电影在线免费观看| 国产伦精一区二区三区| 色悠悠久久综合| 日韩免费性生活视频播放| 中文字幕在线观看一区| 五月婷婷综合激情| 成人av在线资源| 欧美一区二区三区免费大片| 国产女同互慰高潮91漫画| 亚洲国产三级在线| 成人午夜看片网址| 91精品国产综合久久久蜜臀粉嫩| 国产天堂亚洲国产碰碰| 午夜电影一区二区三区| 国产成人综合视频| 91麻豆精品国产91久久久久 | 欧美美女网站色| 亚洲国产成人一区二区三区| 亚洲成人av免费| av高清久久久| 精品1区2区在线观看| 亚洲一区在线观看网站| 国产成人免费xxxxxxxx| 欧美二区三区91| 亚洲乱码一区二区三区在线观看| 国产精品自在在线| 欧美一级理论性理论a| 一区二区在线观看免费| 国产成人精品aa毛片| 91精品欧美一区二区三区综合在| 亚洲色图视频网| www.成人在线| 国产日韩欧美一区二区三区综合| 热久久国产精品| 欧美日韩色一区| 亚洲国产婷婷综合在线精品| 91在线观看一区二区| 久久精品一区二区| 国内精品免费**视频| 日韩一区二区电影在线| 亚洲国产精品久久久久婷婷884| 99久久久久免费精品国产| 国产视频在线观看一区二区三区| 蜜桃av一区二区| 在线电影国产精品| 性做久久久久久久免费看| 色国产精品一区在线观看| 中文字幕亚洲在| caoporm超碰国产精品| 国产日韩影视精品| 国产成人自拍网| 欧美激情中文字幕一区二区| 国产精品一区免费视频| wwwwww.欧美系列| 国产精品12区| 国产清纯白嫩初高生在线观看91 | 欧美日韩日本视频| 亚洲福利视频一区二区| 欧美探花视频资源| 亚洲成人激情社区| 91精品国产黑色紧身裤美女| 图片区日韩欧美亚洲| 91精品久久久久久久91蜜桃| 日韩电影在线一区二区| 日韩精品一区二区三区蜜臀| 韩国成人在线视频| 国产三级精品三级| 91丨porny丨最新| 亚洲成在人线在线播放| 3d成人动漫网站| 久久成人免费日本黄色| 久久久综合精品| 99久久精品国产观看| 亚洲国产一区二区视频| 日韩欧美中文字幕一区| 激情综合色丁香一区二区| 久久久久久99久久久精品网站| 国产盗摄精品一区二区三区在线| 中文字幕欧美日韩一区| 在线日韩一区二区| 日韩**一区毛片| 久久久91精品国产一区二区精品 | 亚洲免费资源在线播放| 91福利在线导航| 美女免费视频一区| 国产精品伦一区| 欧美人牲a欧美精品| 黑人巨大精品欧美黑白配亚洲|