rt

解决方案 »

  1.   

    我有例子,留下邮件地址,我发给你。
    [email protected]
      

  2.   

    你可以用鼠标事件,
    DOWN事件是确定矩形的大小,UP事件时画矩形就可以了。或者自己做一个控件,就象本身带的SHAPE一样。
      

  3.   

    我刚做的例子
    你看看有没有帮助:
    代码如下:
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls;type
      TForm1 = class(TForm)
        Panel1: TPanel;
        procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
          Y: Integer);
        procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    type
      pp = class(tpanel)
    end;
    var
      Form1: TForm1;
      x1,x2,oldx,oldy,y1,y2,foldx,foldy:integer;
      trace:boolean;
    implementation{$R *.dfm}procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);begin
    if trace = true then
    begin
    with pp(panel1).Canvas do
    begin
    rectangle(x1,y1,oldx,oldy);
    pen.Mode:=pmnot;//取反
    rectangle(x1,y1,x,y);
    oldx:=x;
    oldy:=y;
    end;
    end;
         end;
    procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
    x1:=x;
    y1:=y;
    oldx:=x;
    oldy:=y;
    trace:=true;
    end;end.
      

  4.   

    to zytangzhou:  [email protected],3q!