
26.09.2010, 09:33
|
 |
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
ColorBox1: TColorBox;
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Types;
{$R *.dfm}
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if gdFocused in State then
begin
if ACol=2 then
begin
ColorBox1.Parent:=Self;
ColorBox1.Left:=Rect.Left+StringGrid1.Left+2;
ColorBox1.Top:=Rect.Top+StringGrid1.Top+2;
ColorBox1.Width:=Rect.Right-Rect.Left;
ColorBox1.Visible:=True;
end;
end;
end;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
ColorBox1.Visible:=False;
end;
end.
|