J'utilise un Affichage couleur dans un Combobox.
Tout est paramétrée en police 8 (font.size:=8).
Tout marche mais lorsque l'utilisateur change la taille de police, le texte dans mon combobox se chevauche ...
Comment faire pour décaler le texte plus bas, en sachant que le choix de la taille est max 12 (font.size:=12) ?
1 2 3 4 5 6 7 8 9 10 11 12
| procedure TForm2.ComboBoxCouleurDrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
with (Control as TComboBox).Canvas do
begin
FillRect(Rect);
TextOut(30, Rect.Top,ComboBoxCouleur.Items[Index]);
Pen.Color := clBlack;
Brush.Color := ColorConst[Index];
Rectangle(Rect.Left + 2, Rect.Top + 2, 24,Rect.Top + 15);
end;
end; |
Partager