|
|
@@ -6,7 +6,7 @@ interface
|
|
|
|
|
|
uses
|
|
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, BCComboBox,
|
|
|
- BCListBox, LCLType;
|
|
|
+ BCListBox, LCLType, BCSamples;
|
|
|
|
|
|
type
|
|
|
|
|
|
@@ -41,12 +41,15 @@ begin
|
|
|
// Selecting items
|
|
|
BCComboBox1.ListBox.ItemIndex := 0;
|
|
|
|
|
|
- // Style
|
|
|
+ // Style ListBox
|
|
|
BCComboBox1.ListBox.Style := lbOwnerDrawFixed;
|
|
|
BCComboBox1.ListBox.OnDrawItem := @OnListBoxDrawItem;
|
|
|
BCComboBox1.ListBox.Color := clGray;
|
|
|
BCComboBox1.ListBox.ItemHeight := 2 * Canvas.GetTextHeight('aq');
|
|
|
BCComboBox1.ListBox.Options := []; // do not draw focus rect
|
|
|
+
|
|
|
+ // Style Button
|
|
|
+ StyleButtonsSample(BCComboBox1.Button, TBCSampleStyle.ssFlashPlayer);
|
|
|
end;
|
|
|
|
|
|
procedure TForm1.OnListBoxDrawItem(Control: TWinControl; Index: integer;
|
|
|
@@ -56,6 +59,7 @@ var
|
|
|
begin
|
|
|
aCanvas := TListBox(Control).Canvas;
|
|
|
|
|
|
+ // selected item
|
|
|
if odSelected in State then
|
|
|
aCanvas.Brush.Color := clBlack
|
|
|
else
|
|
|
@@ -64,6 +68,14 @@ begin
|
|
|
aCanvas.Font.Color := clWhite;
|
|
|
aCanvas.FillRect(ARect);
|
|
|
|
|
|
+ // mouse over
|
|
|
+ if Index = BCComboBox1.HoverItem then
|
|
|
+ begin
|
|
|
+ aCanvas.Pen.Color := clRed;
|
|
|
+ aCanvas.Rectangle(ARect);
|
|
|
+ end;
|
|
|
+
|
|
|
+ // vertically centered text
|
|
|
aCanvas.TextRect(ARect, 15, ARect.Top +
|
|
|
(aCanvas.GetTextHeight(TListBox(Control).Items[Index]) div 2),
|
|
|
TListBox(Control).Items[Index]);
|