unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, Grids, DBGrids, DB, ADODB, ExtCtrls;<br>type<br> TmyGrid = class(TCustomGrid);<br><br>type<br> TForm1 = class(TForm)<br> DBGrid1: TDBGrid;<br><br> ADODataSet1: TADODataSet;<br> DataSource1: TDataSource;<br> ADODataSet1a: TStringField;<br> Panel1: TPanel;<br> procedure FormCreate(Sender: TObject);<br> procedure FormKeyPress(Sender: TObject; var Key: Char);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br> ADODataSet1.CreateDataSet;<br> ADODataSet1.Open;<br> ADODataSet1.InsertRecord(['111111111']);<br> ADODataSet1.InsertRecord(['111111111']);<br> ADODataSet1.InsertRecord(['111111111']);<br> ADODataSet1.InsertRecord(['111111111']);<br> ADODataSet1.InsertRecord(['111111111']);<br> ADODataSet1.InsertRecord(['111111111']);<br>end;<br><br>procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);<br><br>var<br> lpPoint: TPoint;<br>begin<br> GetCaretPos(lpPoint);<br><br> Panel1.Parent := self.ActiveControl;<br> Panel1.Top := TmyGrid(DBGrid1).InplaceEditor.top +TmyGrid(DBGrid1).InplaceEditor.Height+ lpPoint.y;<br> Panel1.Left := lpPoint.X;<br>end;<br><br>end.<br><br><br>object Form1: TForm1<br> Left = 192<br> Top = 107<br> Width = 696<br> Height = 480<br> Caption = 'Form1'<br> Color = clBtnFace<br> Font.Charset = DEFAULT_CHARSET<br> Font.Color = clWindowText<br> Font.Height = -11<br> Font.Name = 'MS Sans Serif'<br> Font.Style = []<br> KeyPreview = True<br> OldCreateOrder = False<br> OnCreate = FormCreate<br> OnKeyPress = FormKeyPress<br> PixelsPerInch = 96<br> TextHeight = 13<br> object DBGrid1: TDBGrid<br> Left = 192<br> Top = 184<br> Width = 320<br> Height = 120<br> DataSource = DataSource1<br> TabOrder = 0<br> TitleFont.Charset = DEFAULT_CHARSET<br> TitleFont.Color = clWindowText<br> TitleFont.Height = -11<br> TitleFont.Name = 'MS Sans Serif'<br> TitleFont.Style = []<br> end<br> object Panel1: TPanel<br> Left = 384<br> Top = 328<br> Width = 185<br> Height = 41<br> Caption = 'Panel1'<br> Color = clGradientActiveCaption<br> TabOrder = 1<br> end<br> object ADODataSet1: TADODataSet<br> Parameters = <><br> Left = 184<br> Top = 88<br> object ADODataSet1a: TStringField<br> FieldName = 'a'<br> Size = 23<br> end<br> end<br> object DataSource1: TDataSource<br> DataSet = ADODataSet1<br> Left = 264<br> Top = 96<br> end<br>end<br>