Os speedbuttons en el lado están en negrita, quiero sppedbuttons con la fuente normal.
Segue o código:
delphi
{*******************************************************} { Autor: } { Adriano Componente Visual } { } { Copyright © 2011 - 01 - 09 YYYY=MM+DD } { } {*******************************************************} unit uConteinerFilter; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, Math, StdCtrls, Buttons, XPMan, DB, ADODB, Grids, DBGrids, ComCtrls; const {Painel Container} cHeigthPanelClient = 523; cLeftPanelClient = 0; cTopPanelClient = 0; cWidthPanelClient = 434; {Panel Superior} cHeigthPanelTop = 41; cLeftPanelTop = 0; cTopPanelTop = 0; cWidthPanelTop = 385; {Label Pesquisa} cLeftLabelPesq = 10; cTopLabelPesq = 12; {Edit Pesquisa} cWidthEditPesq = 257; cLeftEditPesq = 40; cTopEditPesq = 8; {Grade de Pesquisa} cHeigthGradePesq = 422; cLeftGradePesq = 0; cTopGradePesq = 43; cWidthGradePesq = 384; {Button Filter} cHeigthBtFilter = 25; cLeftBtFilter = 304; cTopBtFilter = 8; cWidthBtFilter = 75; {Painel lateral} cWidthPanelRigth = 40; cHeigthPanelRigth = 470; {SpeedButton} cHeigthSpeedButton = 33; cLeftSeedButton = 04; cTopSeedButton = 03; cWidthSeedButton = 33; type TContainerFilter = class(TCustomPanel) private FPanelSuperior: TPanel; FLabelPesq: TLabel; FEditPesq : TEdit; FButtonFilter : TButton; FGradePesq : TDBGrid; FPanelLateral : TPanel; FSpeedButton : TSpeedButton; FStatusBar: TStatusBar; FButtonExit: TNotifyEvent; FButtonClick: TNotifyEvent; FButtonAutoSize: Boolean; FAutoSize: Boolean; procedure OnSpeedButtonClick(sender: TObject); procedure OnSpeedButtonExit(sender: Tobject); procedure SetAutoSize(const Value: Boolean); procedure SetButtonAutoSize(const Value: Boolean); procedure RestrictSize(var msg: TMessage); protected // public constructor Create(AOwner: TComponent); override; destructor Destroy; override; published //Propriedades dos eventos do panel property OnClick; property OnEnter; property OnExit; property OnDblClick; property Parent; property Owner; property ParentWindow; property AutoSize: Boolean read FAutoSize write SetAutoSize default False; //Propriedades publicadas SpeedButton property OnButtonClick: TNotifyEvent read FButtonClick write FButtonClick; property OnButtonExit : TNotifyEvent read FButtonExit write FButtonExit; property ButtonAutoSize: Boolean read FButtonAutoSize write SetButtonAutoSize default False; end; procedure Register; implementation procedure Register; begin RegisterComponents('CompAraSystems', [TContainerFilter]); end; constructor TContainerFilter.Create(Aowner: TComponent); procedure CriarButtons(sCapiton: String; iTop: Integer); begin FSpeedButton := TSpeedButton.Create(Self); with FSpeedButton do {caracteristicas do SpeedButton} begin Parent := FPanelLateral; Align := alTop; AllowAllUp:= True; if GroupIndex = 0 then GroupIndex := 1; Left := cLeftSeedButton; Height := cHeigthSpeedButton; Width := cWidthSeedButton; Caption := sCapiton; Font.Name := 'Tahoma'; Top := cTopSeedButton + iTop; TabOrder := 0; OnClick := OnSpeedButtonClick; OnExit := OnSpeedButtonExit; end; end; begin inherited Create(Aowner); //Montando o painel superior Self.Parent := TWinControl(Aowner); with Self do begin Align := alClient; //sempre no topo d form Caption := EmptyStr; Height := cHeigthPanelClient; Top := cTopPanelClient; Left := cLeftPanelClient; Width := cWidthPanelClient; BevelInner := bvNone; end; FPanelSuperior := TPanel.Create(Self); with FPanelSuperior do {caracteristicas do Lateral} begin Parent := Self; Font.Name := 'Tahoma'; Caption := EmptyStr; Width := cWidthPanelTop; Height := cHeigthPanelTop; BevelInner := bvLowered; end; FLabelPesq := TLabel.Create(Self); with FLabelPesq do {caracteristicas do Label} begin Caption := 'Filtro:'; Parent := FPanelSuperior; Top := cTopLabelPesq; Left := cLeftLabelPesq; end; FEditPesq := TEdit.Create(Self); with FEditPesq do {caracteristicas do edit} begin Parent := FPanelSuperior; Caption := EmptyStr; Top := cTopEditPesq; Left := cLeftEditPesq; Width := cWidthEditPesq; end; FButtonFilter := TButton.Create(Self); with FButtonFilter do {caracteristicas do edit} begin Parent := FPanelSuperior; Caption := 'Filtrar'; Height := cHeigthBtFilter; Top := cTopBtFilter; Left := cLeftBtFilter; Width := cWidthBtFilter; end; FGradePesq := TDBGrid.Create(Self); with FGradePesq do {Caracteristica da grade} begin Parent := Self; Height := cHeigthGradePesq; Top := cTopGradePesq; Left := cLeftGradePesq; Width := cWidthGradePesq; end; FPanelLateral := TPanel.Create(Self); with FPanelLateral do {caracteristicas do Lateral} begin Parent := Self; Align := alRight; Font.Name := 'Tahoma'; Caption := EmptyStr; Width := cWidthPanelRigth; Height := cHeigthPanelRigth; BevelInner := bvLowered; end; //Monta os buttons CriarButtons('0..9',0); CriarButtons('AB',33); CriarButtons('CD',66); CriarButtons('EF',99); CriarButtons('GH',132); CriarButtons('IJ',165); CriarButtons('KL',198); CriarButtons('MN',231); CriarButtons('OP',264); CriarButtons('QR',297); CriarButtons('ST',330); CriarButtons('UV',363); CriarButtons('XW',396); CriarButtons('YZ',429); FStatusBar := TStatusBar.Create(Self); with FStatusBar do {caracteristicas do StatusBar} begin Parent := Self; end; end; destructor TContainerFilter.Destroy; begin inherited; end; //Metodos procedure TContainerFilter.OnSpeedButtonClick(sender: TObject); begin if Assigned(FButtonClick) then FButtonClick(Sender); end; procedure TContainerFilter.OnSpeedButtonExit(sender: Tobject); begin if Assigned(FButtonExit) then FButtonExit(Sender); end; procedure TContainerFilter.SetAutoSize(const Value: Boolean); begin if FAutoSize <> Value then begin FAutoSize := Value; if Value then AdjustSize; //comando da classe Controls end; end; procedure TContainerFilter.SetButtonAutoSize(const Value: Boolean); begin if FButtonAutoSize <> Value then begin FButtonAutoSize := Value; if Value then AdjustSize; //comando da classe Controls end; end; procedure TContainerFilter.RestrictSize(var msg: TMessage); begin if (Assigned(FSpeedButton)) then begin FSpeedButton.Left := cLeftSeedButton; FSpeedButton.Width := (Self.Width div 3)-20; Self.Font.Size := Trunc(15 * Self.Height/cHeigthPanelRigth); end; end; end.
Y sies posible ajustar eltamaño en función del tamaño de speedbuttons parade jarel panel Parent.
No sé si he explicado correctamente esta parte
He intentado algo
delphi
procedure TContainerFilter.RestrictSize(var msg: TMessage); begin if (Assigned(FSpeedButton)) then begin FSpeedButton.Left := cLeftSeedButton; FSpeedButton.Width := (Self.Width div 3)-20; Self.Font.Size := Trunc(15 * Self.Height/cHeigthPanelRigth); end; end;
Pero sin éxito.
Saludos.