![]() |
Transparent GridKhaled Shagrouni, February 26, 2001 Last updated: June, 22, 2002 | |
|
Being transparent.. being a child.. being there.
|
Published in Delphi3000.com
This is a quick experiment of how to make a grid transparent and showing any underline image, the example below is a full unit code, the controls layout of the form is as the following:
The code bellow has two procedures, the first is to handle the event OnDrawDataCell of the DBGrid, which also contain the real work to make the grid transparent. The second procedure handle the OnMouseDown event of Panel1, this will move the Panel and make it transparent also to the image beneath.
Download: transgrid.zip (56 KB) fTransparentGrid
Example: unit fTransparentGrid;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, Db, Grids, DBGrids, ADODB, ExtCtrls;
type
TForm1 = class(TForm)
ADOTable1: TADOTable;
DataSource1: TDataSource;
Image1: TImage;
Panel1: TPanel;
DBGrid1: TDBGrid;
procedure DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject;
|
Shagrouni 2001 Khaled Shagrouni khaled@shagrouni.com