码迷,mamicode.com
首页 > 其他好文 > 详细

Image1.Canvas画图笔刷

时间:2014-07-29 20:54:52      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   io   for   2014   

bubuko.com,布布扣
 
如何背景透明
 
 
 
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Image1MouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

  pt:tpoint;
  Move:integer ;
implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  with Image1.Canvas do
  begin
     Pen.Width:=10;
     Pen.Color:=clRed;
     brush.Style:=bsCross;


     //透明
  end;
end;

procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  move:=1;
  pt.x:=x;
  pt.Y:=y;
end;

procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if move<>0 then
  begin
    Image1.Canvas.MoveTo(pt.X,pt.Y);
    Image1.Canvas.LineTo(x,y);
    pt.X:=x;
    pt.Y:=y;
  end;
end;

procedure TForm1.Image1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
    Move:=0;
end;

end.




Image1.Canvas画图笔刷,布布扣,bubuko.com

Image1.Canvas画图笔刷

标签:style   blog   http   color   os   io   for   2014   

原文地址:http://www.cnblogs.com/xe2011/p/3876047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!