Delphi-PRAXiS
Seite 3 von 4     123 4      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi TPanel transparent ? (https://www.delphipraxis.net/39165-tpanel-transparent.html)

taktaky 30. Sep 2007 10:27

Re: TPanel transparent ?
 
.dpr fehlt

Ich möchte nur das Panel transparent machen

Kann jemand mir helfen?


---------

DeddyH 30. Sep 2007 10:31

Re: TPanel transparent ?
 
Hast Du die Komponente installiert?

taktaky 30. Sep 2007 11:03

Re: TPanel transparent ?
 
Ich habe den Code in ein neues Project, dann die visuale Objekte erstellt
Delphi-Quellcode:
unit TransparentPanel;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm1 = class(TForm);
  TTransparentPanel = class(TCustomPanel)
    TransparentPanel: TPanel;
    Bevel: TBevel;

  private
  procedure WMEraseBkgnd(var Message: TWmEraseBkgnd); message WM_ERASEBKGND;
  protected
    { Protected declarations }
  Procedure Paint; override;
  Procedure CreateParams(var Params : TCreateParams); override;
    { Private declarations }
  public
    { Public declarations }
    constructor Create(AComponent: TComponent);override;
  published
    { Published declarations }
    Property BevelInner;
    Property BevelOuter;
    Property Align;
    Property Caption;
    property OnClick;
  end;

var
  Form1: TForm1;

  procedure Register;
implementation
procedure Register;
begin
  RegisterComponents('Shamora', [TTransparentPanel]);
end;

constructor TTransparentPanel.Create(AComponent: TComponent);
begin
  inherited;
  ControlStyle := ControlStyle - [csOpaque];
end;

Procedure TTransparentPanel.Paint;
var
  Rect: TRect;
  TopColor, BottomColor: TColor;
const
  Alignments: array[TAlignment] of Word = (DT_LEFT, DT_RIGHT, DT_CENTER);

  procedure AdjustColors(Bevel: TPanelBevel);
  begin
    TopColor := clBtnHighlight;
    if Bevel = bvLowered then TopColor := clBtnShadow;
    BottomColor := clBtnShadow;
    if Bevel = bvLowered then BottomColor := clBtnHighlight;
  end;

begin
  Rect := GetClientRect;
  if BevelOuter < bvNone then
  begin
    AdjustColors(BevelOuter);
    Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth);
  end;
  Frame3D(Canvas, Rect, Color, Color, BorderWidth);
  if BevelInner < bvNone then
  begin
    AdjustColors(BevelInner);
    Frame3D(Canvas, Rect, TopColor, BottomColor, BevelWidth);
  end;
end;

Procedure TTransparentPanel.CreateParams(var Params : TCreateParams);
Begin
  inherited CreateParams(Params);
  With Params do
  begin
    ExStyle := ExStyle or WS_EX_TRANSPARENT;
    Style := Style and not WS_CLIPCHILDREN;
    Style := Style and not WS_CLIPSIBLINGS;
  end;
End;

procedure TTransparentPanel.WMEraseBkgnd(var Message: TWmEraseBkgnd);
begin
  Message.Result := -1;
end;

{$R *.dfm}

end.
Ich bekomme ich die Meldung:
EclassNotFound with Message Class TBevel not found

Objekte in meinem Form :
Delphi-Quellcode:
object Form1: TForm1
  Left = 221
  Top = 115
  Width = 615
  Height = 587
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Bevel: TBevel
    Left = 20
    Top = 20
    Width = 461
    Height = 441
  end
  object Panel: TPanel
    Left = 40
    Top = 40
    Width = 421
    Height = 401
    Caption = 'Panel'
    TabOrder = 0
  end
end


________

taktaky 30. Sep 2007 11:32

Re: TPanel transparent ?
 
Zitat:

Zitat von DeddyH
Hast Du die Komponente installiert?

Gibt es keine andere Möglichkeit um ein Panel transparent zu machen ohne die Komponenten installieren zu müssen?

---------

DeddyH 30. Sep 2007 11:51

Re: TPanel transparent ?
 
Gewöhn Dir endlich ab, Quelltexte per C&P irgendwo in Deinen Sourcen einzufügen. Wenn Du die Komponente nicht installieren willst, speichere deren Source wenigstens irgendwo im Suchpfad ab und binde sie dynamisch ein. Wie das geht, sollte über die SuFu zu finden sein.

taktaky 30. Sep 2007 12:38

Re: TPanel transparent ?
 
Ist die Componente nicht free !!!
Delphi-Quellcode:
{*****************************************************************************}
{                                                                             }
{                         Transparent Panel Componente                       }
{                         Copyright © 1998 by Mik Tran                       }
{                             Edit by Matti - D6pe                           }
{                                                                             }
{*****************************************************************************}

-----------

DeddyH 30. Sep 2007 12:39

Re: TPanel transparent ?
 
Wie kommst Du jetzt darauf?

taktaky 30. Sep 2007 13:16

Re: TPanel transparent ?
 
Zitat:

Zitat von DeddyH
Wie kommst Du jetzt darauf?

ich habe was gefunden aber wieder nicht free !!!
http://www.delphi32.com/vcl/5610/

DeddyH 30. Sep 2007 13:20

Re: TPanel transparent ?
 
Und was stört Dich an der o.a. Komponente?

taktaky 30. Sep 2007 13:46

Re: TPanel transparent ?
 
Zitat:

Zitat von DeddyH
Und was stört Dich an der o.a. Komponente?

Weil sie nicht free sind

Hier habe ich noch ein Transparentes Panel gefunden, diesmal ist free.
http://www.delphi32.com/vcl/1208/download,xid,1208.asp
Das Form kann ich aber nicht öffnen!


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:00 Uhr.
Seite 3 von 4     123 4      

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz