大家好!
  
   刚学DELPHI,现有一问题想请教大家,希望大家教教小弟.
 
 我用stringGrid画了个表格.现在想在表格里每点击一下鼠标左键就画一个按钮,请问我该如何实现?用什么控件呢?

解决方案 »

  1.   

    unit Unit21;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Buttons, Grids;type
      TForm1 = class(TForm)
        StringGrid1: TStringGrid;
        BitBtn1: TBitBtn;
        procedure FormCreate(Sender: TObject);
        procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
          Rect: TRect; State: TGridDrawState);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      StringGrid1.DefaultRowHeight := BitBtn1.Height + 4;
      StringGrid1.DefaultColWidth := BitBtn1.Width + 4;
    end;procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
      if ACol = 2 then
        BitBtn1.PaintTo(StringGrid1.Canvas, Rect.Left + 2, Rect.Top + 2);end;end.
      

  2.   

    各位大哥大姐:
      
       帮小弟个忙!不甚感激!我是用StringGrid画的表格.在左边设置了个按键,bitbtn,
    我想让这个按键作为个开关.点下它,然后我在表格里每点一次鼠标左键就会出现个矩形框! 我该如何实现呢?大侠们帮帮小弟弟!