SHARE
TWEET

MyComboBox Unit Delphi

jpfassis Jan 20th, 2020 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit UComponente_ComboBox;
  2.  
  3. interface
  4.  
  5. uses
  6.   Controls, Classes, ExtCtrls, Graphics, Buttons, StdCtrls;
  7.  
  8. type
  9.  
  10. TComponente_ComboBox = class(TWinControl)
  11.   private
  12.   procedure CriarPanel;
  13.   procedure CriarSpeedButton;
  14.   procedure CriarEdit;
  15.   public
  16.     constructor Create(AOwner: TComponent); override;
  17.     procedure CreateWnd; override;
  18.     destructor Destroy; override;
  19.   published
  20. end;
  21.  
  22. procedure Register;
  23.  
  24. implementation
  25.  
  26. procedure Register;
  27. begin
  28.   RegisterComponents('MyComboBox',[TComponente_ComboBox]);
  29. end;
  30.  
  31. { TComponente_ComboBox }
  32.  
  33. constructor TComponente_ComboBox.Create(AOwner: TComponent);
  34. begin
  35.   inherited Create(AOwner);
  36.   Self.Width:=150;
  37.   Self.Height:=30;
  38. end;
  39.  
  40. procedure TComponente_ComboBox.CreateWnd;
  41. begin
  42.   inherited;
  43.   CriarPanel;
  44.   CriarSpeedButton;
  45.   CriarEdit;
  46. end;
  47.  
  48. procedure TComponente_ComboBox.CriarEdit;
  49. var
  50.   Edit1 : TEdit;
  51. begin
  52.   Edit1 := TEdit.Create(self);
  53.   Edit1.Parent:= Self;
  54.   Edit1.Width:=Self.Width-30;
  55.   Edit1.Height:=Self.Height-1;
  56.   Edit1.Top:=1;
  57. end;
  58.  
  59. procedure TComponente_ComboBox.CriarPanel;
  60. var
  61.   Panel1 : TPanel;
  62. begin
  63.   Panel1 := TPanel.Create(self);
  64.   Panel1.Parent:= self;
  65.   Panel1.Width:=50;
  66.   Panel1.Height:=Self.Height;
  67.   Panel1.Color:=ClRed;
  68.   Panel1.Top:=0;
  69. end;
  70.  
  71. procedure TComponente_ComboBox.CriarSpeedButton;
  72. var
  73.   SpeedButton1 : TSpeedButton;
  74. begin
  75.   SpeedButton1 := TSpeedButton.Create(self);
  76.   SpeedButton1.Parent:= self;
  77.   SpeedButton1.Width:=30;
  78.   SpeedButton1.Height:=Self.Height;
  79.   SpeedButton1.Top:=0;
  80.   SpeedButton1.Left:=Self.Width-SpeedButton1.Width;
  81. end;
  82.  
  83. destructor TComponente_ComboBox.Destroy;
  84. begin
  85.   inherited;
  86. end;
  87.  
  88. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top