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
|
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;
}
} |
Partager