Autor Beitrag
Ironhead
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 57

Win XP,Kanotix 5

BeitragVerfasst: Do 01.02.07 22:59 
Hab da mal ne Frage,

ich benutze eine CheckListBox um die Culumns in meinem DBGrid ein und auszublenden. Nun wollte ich das gleiche zum Sortieren machen und wollte dafür Radiobuttons nehmen, gibs ne Möglichkeit dies zu ändern oder ne andere Komponente?
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Fr 02.02.07 00:00 
Hallo,

RadioGroup nicht flexibel genug, zuviele Spalten im DB-Grid?

Dann nimm eine Listbox und zeichne die Radiobuttons selbst.

Damit, nach ein paar Anpassungen:
ausblenden Delphi-Quelltext
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:
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
  with ListBox1.Canvas do
    if odSelected in State then
      begin
      Font.Color := ListBox1.Font.Color;
      Brush.Color := ListBox1.Color;
      FillRect(Rect);
      TextOut(Rect.Left+18,Rect.Top+2,ListBox1.Items[Index]);
      DrawFocusRect(Rect);
      DrawFocusRect(Classes.Rect(Rect.Left+16,Rect.Top,Rect.Right,Rect.Bottom));
      DrawFrameControl(Handle,
                       Classes.Rect(Rect.Left,Rect.Top,Rect.Left+16,Rect.Bottom),
                       DFC_BUTTON,DFCS_BUTTONRADIO or DFCS_CHECKED);
      end
      else
        begin
        FillRect(Rect);
        DrawFrameControl(Handle,
                         Classes.Rect(Rect.Left,Rect.Top,Rect.Left+16,Rect.Bottom),
                         DFC_BUTTON,DFCS_BUTTONRADIO);
        TextOut(Rect.Left+18,Rect.Top+2,ListBox1.Items[Index]);
        end;
end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )