string gride dbgriddeki gibi combobox eklemek istiyorum ama

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
Kullanıcı avatarı
burakb44
Üye
Mesajlar: 131
Kayıt: 11 Mar 2005 03:13

string gride dbgriddeki gibi combobox eklemek istiyorum ama

Mesaj gönderen burakb44 »

arkadaşlar merhaba, string gridde dbgriddeki gibi button ve combobox eklemek istiyorum fakat nereden yapılacağı konusunda bilgim yok yardımcı olursanız sevnirim.
iyi çalışmalar...
Kullanıcı avatarı
husonet
Admin
Mesajlar: 2962
Kayıt: 25 Haz 2003 02:14
Konum: İstanbul
İletişim:

Mesaj gönderen husonet »

Arşivden !

Kod: Tümünü seç

procedure TForm1.FormCreate(Sender: TObject);
begin
 {The combobox height is not settable, so we will}
 {instead size the grid to fit the combobox!}
  StringGrid1.DefaultRowHeight := ComboBox1.Height;
 {Hide the combobox}
  ComboBox1.Visible := False;
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
 {Get the ComboBox selection and place in the grid}
  StringGrid1.Cells[StringGrid1.Col,
                    StringGrid1.Row] :=
    ComboBox1.Items[ComboBox1.ItemIndex];
  ComboBox1.Visible := False;
  StringGrid1.SetFocus;
end;
procedure TForm1.ComboBox1Exit(Sender: TObject);
begin
 {Get the ComboBox selection and place in the grid}
  StringGrid1.Cells[StringGrid1.Col,
                    StringGrid1.Row] :=
    ComboBox1.Items[ComboBox1.ItemIndex];
  ComboBox1.Visible := False;
  StringGrid1.SetFocus;
end;






procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
var
  R: TRect;
begin
  if ((ACol = 3) AND
      (ARow <> 0)) then begin
   {Size and position the combo box to fit the cell}
    R := StringGrid1.CellRect(ACol, ARow);
    R.Left := R.Left + StringGrid1.Left;
    R.Right := R.Right + StringGrid1.Left;
    R.Top := R.Top + StringGrid1.Top;
    R.Bottom := R.Bottom + StringGrid1.Top;
    ComboBox1.Left := R.Left + 1 ;
    ComboBox1.Top := R.Top + 1 ;
    ComboBox1.Width := (R.Right +  1) - R.Left;
    ComboBox1.Height := (R.Bottom +  1) - R.Top;
   {Show the combobox}
    ComboBox1.Visible := True;
    ComboBox1.SetFocus;
  end;
  CanSelect := True;
end;
Kolay Gelsin...

Gazete manşetleri
* DİKKAT :Lütfen forum kurallarını okuyalım ve uyalım...!
* Warez,crack vs. paylaşımı kesinlikle yasaktır.
Cevapla