Einzelnen Beitrag anzeigen

Reinhold
(Gast)

n/a Beiträge
 
#16

Re: Coolbar Band hinzufügen

  Alt 25. Jan 2008, 13:39
Hallo Larsi,

in der Hilfe von Delphi2007 habe ich folgenden Code gefunden.

Delphi-Quellcode:
{
To run this example, add the example code to a new project.
The example code dynamically creates a TCoolBar and three
TCoolBand objects populated with a windowed control in each
TCoolBand.
}

procedure AddBand(CoolBar: TCoolBar; Const ControlClasses: array of TControlClass);
var
  CurrentControl: TControl;
  I: Integer;
begin
  for I := 0 to High(ControlClasses) do
    begin
      CurrentControl := ControlClasses[i].Create(CoolBar);
      if (CurrentControl is TWinControl) then
      begin
        { Placing the control onto the CoolBar causes the TCoolBar object to create a TCoolBand and place the control within the band. }
        CurrentControl.Parent := Coolbar;
        { Get the reference of the last TCoolBand created and assign text. }
        with CoolBar.Bands do
          Items[count - 1].Text := CurrentControl.ClassName;
      end;
    end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  CoolBar: TCoolBar;
begin
  CoolBar := TCoolBar.Create(Self);
  CoolBar.Parent := Self;
  CoolBar.Align := alClient;
  AddBand(CoolBar, [TCheckBox, TEdit, TButton]);
end;
Vielleicht hilft er dir weiter.

gruß Reinhold
  Mit Zitat antworten Zitat