Mega Code Archive

 
Categories / Delphi / VCL
 

Degisik bir tabsheet ornegi, icq daki gibi grouplar yaratip, buttona basinca bunun altinda bir pane

unit GTabSheet; { 2002 05 14 00:58 clubyalcin www.clubyalcin.d2g.com www.sanal-bilgisayar.com.tr/clubyalcin } interface uses Windows, Messages, SysUtils, Classes, Controls, ExtCtrls,Graphics; type TGTabSheet = class(TPanel) private { Private declarations } FPanel : TPanel; FMax_Heigth : integer; protected { Protected declarations } procedure Loaded; override; procedure set_btn_Alignment(FAlignment : TAlignment); function get_btn_Alignment:TAlignment; procedure Set_Btn_Caption(FCaption : string); function get_btn_Caption:String; procedure set_btn_Font(FFont : TFont); function get_btn_Font:TFont; procedure set_btn_Color(FColor: TColor); function get_btn_Color:TColor; procedure set_btn_Panel(FPanel1: TPanel); function get_btn_Panel:TPanel; procedure Btn_Click(Sender: TObject); public { Public declarations } constructor Create(AOwner: TComponent); override; destructor Destroy; override; published { Published declarations } property Btn_Alignment : TAlignment Read Get_Btn_Alignment write Set_Btn_Alignment; property Btn_Caption : String Read Get_Btn_Caption write Set_Btn_Caption; property Btn_Font : TFont Read Get_Btn_Font write Set_Btn_Font; property Btn_Color : TColor Read Get_Btn_Color write Set_Btn_Color; property Btn_Panel : TPanel Read Get_Btn_Panel write Set_Btn_Panel; property Max_heigth : integer read FMax_Heigth write FMax_Heigth; end; procedure Register; implementation procedure Register; begin RegisterComponents('ClubYalcin', [TGTabSheet]); end; constructor TGTabSheet.Create(AOwner: TComponent); begin inherited Create(AOwner); width := 100; FMax_Heigth := 200; height := FMax_Heigth; FPanel := TPanel.Create(parent); FPanel.Align := alTop; FPanel.Height := 20; FPanel.parent := Self; FPanel.Visible := true; FPanel.caption := 'ClubYalcin'; FPanel.OnClick := Btn_Click; FPanel.Tag := 0; BevelInner := bvLowered; BevelOuter := bvRaised; end; procedure TGTabSheet.Loaded; begin inherited Loaded; Height := FPanel.Height; end; destructor TGTabSheet.Destroy; begin inherited Destroy; end; procedure TGTabSheet.Set_Btn_Alignment(FAlignment : TAlignment); begin FPanel.Alignment := FAlignment; end; Function TGTabSheet.Get_Btn_Alignment: TAlignment; begin result := Fpanel.Alignment; end; procedure TGTabSheet.Set_Btn_Caption(FCaption : string); begin FPanel.Caption := FCaption; end; Function TGTabSheet.Get_Btn_Caption: String; begin result := Fpanel.Caption; end; procedure TGTabSheet.Set_Btn_Font(FFont : TFont); begin FPanel.Font := FFont; end; Function TGTabSheet.Get_Btn_font: TFont; begin result := Fpanel.font; end; procedure TGTabSheet.Set_Btn_Color(FColor : TColor); begin FPanel.Color := FColor; end; Function TGTabSheet.Get_Btn_Color: TColor; begin result := FPanel.Color; end; procedure TGTabSheet.Set_Btn_Panel(FPanel1 : TPanel); begin FPanel := FPanel1; end; Function TGTabSheet.Get_Btn_Panel: TPanel; begin result := FPanel; end; procedure TGTabSheet.Btn_Click(Sender: TObject); begin if FPanel.Tag = 0 then FPanel.Tag := 1 else FPanel.Tag := 0; if FPanel.Tag = 0 then Height := FPanel.Height else Height := FMax_Heigth; end; end.