salut
Est t-il possible de mettre comboBox dans une case de (ListeView en mode report).
merci bien.
salut
Est t-il possible de mettre comboBox dans une case de (ListeView en mode report).
merci bien.
Bonsoir (ou bonjour),
Une proposition:
.cpp
.h:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 void __fastcall TForm2::ListView1MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { int ligne; int colonne; LVHITTESTINFO lvhtti; lvhtti.pt = Point(X, Y); if ( SendMessage(ListView1->Handle, LVM_SUBITEMHITTEST, NULL, reinterpret_cast<LPARAM>(&lvhtti)) != -1 ) { ligne = lvhtti.iItem; colonne = lvhtti.iSubItem; TRect temp_rect = ListView1->Items->Item[ligne]->DisplayRect(drBounds); TComboBox * temp_combo = new TComboBox(this); temp_combo->Parent = ListView1; temp_combo->Top = temp_rect.Top; if (colonne == 0) { temp_combo->Left = temp_rect.Left; } else { int posLeft = temp_rect.Left; for (int i = 0; i < colonne; i ++) { posLeft += ListView1->Column[i]->Width; } temp_combo->Left = posLeft; } temp_combo->Width = ListView1->Column[colonne]->Width; //temp_rect.Width(); temp_combo->Height = temp_rect.Height(); temp_combo->Items->Add("essai1"); temp_combo->Items->Add("essai2"); temp_combo->OnClick = TempComboClick; } } //--------------------------------------------------------------------------- void __fastcall TForm2::TempComboClick(TObject *Sender) { TComboBox *cb = dynamic_cast < TComboBox* >(Sender); ShowMessage(cb->Items->Strings[cb->ItemIndex]); delete cb; }
Donc, loin d'être parfait, mais peut être cela te mettra t il sur la voie.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 private: void __fastcall TempComboClick(TObject *Sender);
@+
![]()
Partager