| 12
 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
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 
 |  
void __fastcall TForm3::LVtestCustomDrawSubItem(TCustomListView *Sender,
	  TListItem *Item, int SubItem, TCustomDrawState State, bool &DefaultDraw)
{
LVtest->DoubleBuffered = true;
TCanvas *cnv = LVtest->Canvas;
if (State.Contains(cdsSelected) )
{
	switch(SubItem)
	{
		case 1:
		cnv->Brush->Color = clGreen;
		cnv->Font->Color = clBlack;
		break;
		case 2:
		cnv->Brush->Color = clSilver;
		cnv->Font->Color = clBlack;
		break;
 
	}
	if ((SubItem-1) == fCurrentCol)
	{
		cnv->Brush->Color = clYellow;
		cnv->Font->Color = clRed;
	}
cnv->Font->Style = TFontStyles() << fsBold << fsUnderline;
}
else
{
	cnv->Brush->Color = clCream;
	cnv->Font->Color = clBlack;
	cnv->Font->Style = TFontStyles();
}
}
//---------------------------------------------------------------------------
 
void __fastcall TForm3::LVtestCustomDrawItem(TCustomListView *Sender,
      TListItem *Item, TCustomDrawState State, bool &DefaultDraw)
{
LVtest->DoubleBuffered = true;
TCanvas *cnv = LVtest->Canvas;
if (State.Contains(cdsSelected) )
{
	cnv->Brush->Color = clGreen;
	cnv->Font->Color = clBlack;
	cnv->Font->Style = TFontStyles() << fsBold << fsUnderline;
}
else
{
	cnv->Brush->Color = clCream;
	cnv->Font->Color = clBlack;
	cnv->Font->Style = TFontStyles();
}
}
//---------------------------------------------------------------------------
 
void __fastcall TForm3::LVtestMouseDown(TObject *Sender, TMouseButton Button,
	  TShiftState Shift, int X, int Y)
{
int ligne;
int colonne;
  LVHITTESTINFO lvhtti;
  lvhtti.pt = Point(X, Y);
  if ( SendMessage(LVtest->Handle, LVM_SUBITEMHITTEST, NULL, reinterpret_cast<LPARAM>(&lvhtti)) != -1   )
  {
	 ligne = lvhtti.iItem;
	 colonne = lvhtti.iSubItem-1;
	 fCurrentCol = colonne;
		LVtest->ItemIndex = ligne;
	 LVtest->Invalidate();
  }
} | 
Partager