就象delphi里窗体设计的时候,点中一个控件,旁边出现八个小黑点,Memo没有画布属性,现在label我已经实现了,谢谢,在线等。

解决方案 »

  1.   

    给你看个例子或许对你有所帮助
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        PaintBox1: TPaintBox;
        procedure FormCreate(Sender: TObject);
        procedure PaintBox1Paint(Sender: TObject);
        procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
        procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
          Shift: TShiftState; X, Y: Integer);
      private
        { Private declarations }
        R: TRect;
        bSel: Boolean;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      PaintBox1.Width := 120; PaintBox1.Height := 120;
      R.Top := 10; R.Left := 10; R.Right := 110; R.Bottom := 110;
      bSel := False;
    end;procedure TForm1.PaintBox1Paint(Sender: TObject);
    const
      radii: Byte = 3;
    begin
      with PaintBox1.Canvas do
      begin
        Brush.Color := clWhite;
        Ellipse(R);
        if bSel then
        begin
          Brush.Color := clBlack;
          Rectangle(R.Top - radii, (R.Left+R.Right) div 2 - radii, R.Top + radii, (R.Left+R.Right) div 2 + radii);
          Rectangle(R.Bottom - radii, (R.Left+R.Right) div 2 - radii, R.Bottom + radii, (R.Left+R.Right) div 2 + radii);
          Rectangle((R.Left+R.Right) div 2 - radii, R.Top - radii, (R.Left+R.Right) div 2 + radii, R.Top + radii);
          Rectangle((R.Left+R.Right) div 2 - radii, R.Bottom - radii, (R.Left+R.Right) div 2 + radii, R.Bottom + radii);
        end;      
      end;
    end;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      if bSel then
      begin
        bSel := False;
        Invalidate;
      end;
    end;procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      if PtInRegion(CreateEllipticRgnIndirect(R), X, Y) then
      begin
        if not bSel then
        begin
          bSel := True;
          Invalidate;
        end;
      end
      else if bSel then
      begin
        bSel := False;
        Invalidate;
      end
    end;end.
      

  2.   

    可能你要增加一個控件,當Memo獲取焦點的時候,你把那個控件顯示出來當失去焦點的時候,把那個控件隱藏