Advertisement
Guest User

Untitled

a guest
May 4th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. { }
  2. { Copyright © 1998 by Mik Tran }
  3. { }
  4. { ****************************************************************** }
  5.  
  6. unit Tranpanl;
  7.  
  8. interface
  9.  
  10. uses WinTypes, WinProcs, Messages, SysUtils, Classes, Vcl.Controls,
  11. Vcl.Forms, Vcl.Graphics, Vcl.StdCtrls;
  12.  
  13. type
  14. TTranPanl = class(TCustomcontrol)
  15. private
  16. Fborder : Boolean;
  17. Procedure Setborder(value : boolean);
  18. protected
  19. procedure Paint; override;
  20. public
  21. procedure CreateParams(var Params: TCreateParams); override;
  22. constructor Create(AOwner: TComponent); override;
  23. destructor Destroy; override;
  24. published
  25. Property Border:Boolean read Fborder write Setborder;
  26. Property Visible;
  27. property Enabled;
  28. Property Align;
  29. property OnClick;
  30. property OnMouseDown;
  31. property OnMouseMove;
  32. property OnMouseUp;
  33. end;
  34.  
  35. procedure Register;
  36.  
  37. implementation
  38.  
  39. procedure Register;
  40. begin
  41. RegisterComponents('Mik', [TTranPanl]);
  42. end;
  43.  
  44. procedure TTranPanl.CreateParams(var Params: TCreateParams);
  45. begin
  46. { call the create of the params }
  47. inherited CreateParams(Params);
  48. Params.ExStyle := Params.ExStyle + WS_EX_Transparent;
  49. ControlStyle := ControlStyle - [csOpaque] + [csAcceptsControls]
  50. end;
  51.  
  52. constructor TTranPanl.Create(AOwner: TComponent);
  53. begin
  54. inherited Create(AOwner);
  55. Width := 185;
  56. Height := 41;
  57. end;
  58.  
  59. destructor TTranPanl.Destroy;
  60. begin
  61. inherited Destroy;
  62. end;
  63.  
  64. procedure TTranPanl.Paint;
  65. begin
  66. If Fborder or (csDesigning in ComponentState) then
  67. begin
  68. Canvas.brush.color := clbtnshadow;
  69. Canvas .framerect(clientrect);
  70. end;
  71. end;
  72.  
  73. Procedure TTranpanl.Setborder(value : boolean);
  74. begin
  75. if value <> Fborder then
  76. begin
  77. Fborder := value;
  78. invalidate;
  79. end;
  80. end;
  81.  
  82. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement