[delphizip] Re: Offtopic - Pascal issues: Checklistbox1.Items.Strings[2].font.color & HowTo enable one groupbox within another groupbox that is disabled

  • From: "Xavier Mor-Mur" <xmormur@xxxxxxxxxxxxx>
  • To: <delphizip@xxxxxxxxxxxxx>
  • Date: Sat, 14 Dec 2002 00:18:43 +0100

Hi Alister

I hope next lines can help you


> I want to font.color one Checklistbox.Items.Strings in a group (only one)
a different color
> to the rest - is this possible without modifying the component. What I am
> actually trying to do is bring to the attention by color of one item.


procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
  with (Control as TListBox).Canvas do
  begin
    Font.Color := clBlack;
    if Index = XXX then   // XXX = line you want a different color
    begin
      Brush.Color := clAqua;
      Font.Color := clRed;
    end
    else
    begin
      Brush.Color := clWindow;
      Font.Color := clBlack;
    end;
    FillRect(Rect);
    TextOut(Rect.Left, Rect.Top, (Control as TListBox).Items[Index]);
  end;
end;

now changing XXX and calling ListBox1.Update line color will change.



> Secondly, how to enable a groupbox that is within another groupbox that is
> disabled without enabling the containing groupbox? (Self Parent)


The only way I know is create the second groupbox outside the first and then
put on the first.


Regards

Xavier Mor-Mur


Other related posts: