![]() |
AW: Boolean Indikator
Zitat:
Delphi-Quellcode:
Wenn das Item ausgecheckt wird, dann checken wir es doch wieder ;)
procedure TForm1.CheckListBox1ClickCheck(Sender: TObject);
begin CheckListBox1.Checked[CheckListBox1.ItemIndex] := not CheckListBox1.Checked[CheckListBox1.ItemIndex]; // Trick 17 end; procedure TForm1.Button1Click(Sender: TObject); // Beispiel var i: Integer; begin // Beispiel Checks setzten for i := 0 to CheckListBox1.Count - 1 do CheckListBox1.Checked[i] := Random(2) = 0; end; //Edit: Eine kleine Erweiterung, sie ersetzt das Check-Zeichen durch einen Smiley
Delphi-Quellcode:
procedure TForm1.CheckListBox1DrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState); var R: TRect; CLB: TCheckListBox; CW: Integer; FN: String; Ch: Char; TopDifTxt: Integer; // Gleicht die Höhendifferenz aus begin CLB := (Control as TCheckListBox); R := Rect; CW := CLB.ClientWidth - (R.Right - R.Left); R.Left := R.Left - CW; R.Right := R.Left + CW; TopDifTxt := (CLB.ItemHeight div 2) - (CLB.Canvas.TextHeight(CLB.Items[Index]) div 2); //Ausgabe normaler Text CLB.Canvas.TextRect(Rect, Rect.Left, Rect.Top + TopDifTxt, CLB.Items[Index]); //Checkersatz CLB.Canvas.Font.Name := 'Wingdings'; if CLB.Checked[Index] then Ch := 'J' else Ch := #32; CLB.Canvas.TextRect(R, R.Left + 2, Rect.Top + TopDifTxt, Ch); end; |
AW: Boolean Indikator
Mit Bordmitteln, keine Checkbox:
Font: Windings Zeichen #251, #252 oder #253, #254 Fontcolor: Rot (251,253) bzw. grün (252,254) Fertig. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:01 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz