Search

Resume and bio of the author Couple of articles related to my hobby - robotics
My impressions about immigration to Australia. In Russian only. Recipes for everyday problems solving
Linux-related posts Windows-related posts
Software-related posts A lot of info about hardware
Different tools you might find useful Posts about various web technologies
Everything that doesn't fit the rest of the menu RSS feed for this blog

Tag Cloud

Archives

Links

Andrey Mikhalchuk’s Blog

Technoblog about life

Oct 4, 2008 How to make Delphi TFrame background transparent

I actually think this method will work for Visual Basic and other similar languages too. Here is the code for a sample frame called TfrKnob:


unit Knob;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, VrControls, VrWheel;

type
  TfrKnob = class(TFrame)
    vwKnob: TVrWheel;
    lPos: TLabel;
    procedure CreateParams(var Params: TCreateParams);override;
    procedure PaintWindow(DC: HDC); override;
  private
    { Private declarations }
  public
    constructor Create(AOwner:TComponent);override;
    { Public declarations }
  end;

implementation

{$R *.dfm}

constructor TfrKnob.Create(AOwner: TComponent);
begin
  inherited;
  Brush.Style := bsClear;
end;

procedure TfrKnob.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;
end;

procedure TfrKnob.PaintWindow(DC: HDC);
begin
// keep this comment or Delphi will loose this method implementation
end;

end.


New code is in bold font.

This is very sad, but just a few years ago there were way more information about Delphi in the Internet and now this excellent development environment and language seem dying. It’s good to know it is still in top 10, though.

This post is published in Windows.

3 Responses to “How to make Delphi TFrame background transparent”

  1. dozo Says:

    Nice article it was very useful to me

  2. Onhate Says:

    Does it work in Linux?

  3. Andrey Mikhalchuk Says:

    Sorry, I have no clue. If you tried please let me know.

Leave a Reply

You must be logged in to post a comment.

Site Map (c) Andrey Mikhalchuk, 2005-2008