在TStringGrid中插入TComboBox
With Grid1? do
??? begin
????? nIndexCB := ARow ;
????? MyRect:=CellRect(ACol,ARow) ;
????? CB1.Visible:=True;
????? CB1.ItemHeight := 20;
????? CB1.SetBounds(Grid1.left+MyRect.Left+1,MyRect.Top+Grid1.Top+1,
????????? MyRect.Right-MyRect.Left+2 ,MyRect.Bottom-MyRect.Top +2);
????? CB1.Text:=Grid1.Cells[ACol,ARow];
????? i := Cb1.Items.IndexOf(Grid1.Cells[ACol,ARow]) ;
????? Cb1.ItemIndex := i;
????? CB1.SetFocus;
??? end;?With Grid1? do
??? begin
????? nIndexCB := ARow ;
????? MyRect:=CellRect(ACol,ARow) ;
????? CB1.Visible:=True;
????? CB1.ItemHeight := 20;
????? CB1.SetBounds(Grid1.left+MyRect.Left+1,MyRect.Top+Grid1.Top+1,
????????? MyRect.Right-MyRect.Left+2 ,MyRect.Bottom-MyRect.Top +2);
????? CB1.Text:=Grid1.Cells[ACol,ARow];
????? i := Cb1.Items.IndexOf(Grid1.Cells[ACol,ARow]) ;
????? Cb1.ItemIndex := i;
????? CB1.SetFocus;
??? end;?With Grid1? do
??? begin
????? nIndexCB := ARow ;
????? MyRect:=CellRect(ACol,ARow) ;
????? CB1.Visible:=True;
????? CB1.ItemHeight := 20;
????? CB1.SetBounds(Grid1.left+MyRect.Left+1,MyRect.Top+Grid1.Top+1,
????????? MyRect.Right-MyRect.Left+2 ,MyRect.Bottom-MyRect.Top +2);
????? CB1.Text:=Grid1.Cells[ACol,ARow];
????? i := Cb1.Items.IndexOf(Grid1.Cells[ACol,ARow]) ;
????? Cb1.ItemIndex := i;
????? CB1.SetFocus;
??? end;?
With Grid1 do begin nIndexCB := ARow ; MyRect:=CellRect(ACol,ARow) ; CB1.Visible:=True; CB1.ItemHeight := 20; CB1.SetBounds(Grid1.left+MyRect.Left+1,MyRect.Top+Grid1.Top+1, MyRect.Right-MyRect.Left+2 ,MyRect.Bottom-MyRect.Top +2); CB1.Text:=Grid1.Cells[ACol,ARow]; i := Cb1.Items.IndexOf(Grid1.Cells[ACol,ARow]) ; Cb1.ItemIndex := i; CB1.SetFocus; end;
?