以 Cells[1,2] 嵌入 ComboBox1 为例:<br>procedure TForm1.ComboBox1Change(Sender: TObject);<br>begin<br> StringGrid1.Cells[1,2]:=ComboBox1.Text;<br> caption:=ComboBox1.Text;<br>end;<br><br>procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;<br> Rect: TRect; State: TGridDrawState);<br>var<br> h: integer;<br>begin<br> h:=(StringGrid1.DefaultRowHeight - ComboBox1.Height) div 2;<br><br> if gdFocused in state then<br> begin<br> if ComboBox1 <> nil then ComboBox1.Visible := false;<br> if Assigned(ComboBox1) and (ACol = 1) and (ARow = 2) then<br> begin<br> ComboBox1.SetBounds(rect.Left + StringGrid1.Left + 1, rect.Top + StringGrid1.Top + h + 2, rect.Right - rect.Left, ComboBox1.Height);<br> ComboBox1.Visible := True;<br> ComboBox1.SetFocus;<br> end;<br> end;<br>end;