Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 506945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:45:12+00:00 2026-05-13T06:45:12+00:00

I want to create a form, but just use it to keep an image.

  • 0

I want to create a form, but just use it to keep an image. (Like a splash form)

To create a form like these I use these lines:

SetWindowLong(Handle, GWL_EXSTYLE, LexStyle or WS_EX_LAYERED);
UpdateLayeredWindow(Handle, 0, nil, @LBitmapSize, LBitmap.Canvas.Handle, 0,
  @LBlendFunction, ULW_ALPHA);

This image is a PNG image with transparent layer.

The form must have a parent form or must have the behavior of a form that have it.

That is the problem, if I add some component on this form, this just doesn’t show the component.
And if I set a parent form to it, this lose its transparency.

But I need to add components in this and I need to set a parent to the form.

Some one knows other way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:45:13+00:00Added an answer on May 13, 2026 at 6:45 am

    You can try not set Parent property directly but use subclassing …

    Suppose TParentForm is parent form and TAlphaForm is form with image.

    When creating TAlphaForm instance, pass instance of TParentForm as Owner parameter and change WndProc of owner form in constructor.

    Next is example code for TAlphaForm:

    type
      TAlphaForm = class(TForm)
      private
        FParentWndProc : TWndMethod;
        FParentForm    : TCustomForm;
    
        procedure HookWindowProc(var Message: TMessage);
    
      public
        constructor Create(AOwner : TComponent); override;
        destructor Destroy; override;
      end;
    

    Implementation:

    constructor TAlphaForm.Create(AOwner: TComponent);
    begin
      inherited;
    
      if(Assigned(AOwner) and (Owner is TCustomForm)) then begin
    
        FParentForm := TCustomForm(Owner);
        // Subclass owner window 
        FParentWndProc := FParentForm.WindowProc;
        FParentForm.WindowProc := HookWindowProc;
        // Need to repaint to show initial picture
        if(FParentForm.HandleAllocated) then FParentForm.Invalidate;
    
      end else begin
    
        FParentForm := nil;
        FParentWndProc := nil;
    
      end;
    
    end;
    
    destructor TAlphaForm.Destroy;
    begin
      if(Assigned(FParentForm)) then begin
        // Restore original WndProc and repaint to restore original look if available  
        FParentForm.WindowProc := FParentWndProc;
        if(FParentForm.HandleAllocated) then FParentForm.Invalidate;
        FParentForm := nil;
        FParentWndProc := nil;
      end;
      inherited;
    end;
    
    procedure TAlphaForm.HookWindowProc(var Message: TMessage);
    begin
    
      if( not (Assigned(FParentForm) and Assigned(FParentWndProc)) )
        then exit;
    
      FParentWndProc(Message);
    
      if(Message.Msg = WM_PAINT) then begin
        // Paint alpha image here on Owner's form canvas
        // Here is sample painting
        FParentForm.Canvas.Pen.Width := 3;
        FParentForm.Canvas.Pen.Color := clRed;
        FParentForm.Canvas.Ellipse(FParentForm.ClientRect);
      end else if(Message.Msg = WM_SIZE) then begin 
        // Needed because the whole form must be repainted
        FParentForm.Invalidate;
      end;
    
    end;
    

    For me solution works with this parent form code:

    type
      TForm1 = class(TForm)
        Button2: TButton;
        Button3: TButton;
        procedure Button2Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
      private
        { Private declarations }
        FAlpha : TForm;
      public
        { Public declarations }
        constructor Create(AOwner : TComponent); override;
      end;
    

    Implementation:

    procedure TForm1.Button2Click(Sender: TObject);
    begin
      if(not Assigned(FAlpha)) then FAlpha := TAlphaForm.Create(Self);
    end;
    
    procedure TForm1.Button3Click(Sender: TObject);
    begin
      FreeAndNil(FAlpha);
    end;
    
    constructor TForm1.Create(AOwner: TComponent);
    begin
      inherited;
      FAlpha := nil;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to create a form that has two submit buttons, but each one
I create form dynamically on the client side. I want to iterate it, but
I'm trying to create a splash screen using LWUIT. I want a form to
I'm using Ext.Form.Panel successfully but I want to use Ext.form.field.File this time. I was
I want to create a form which has a text entry box where a
I want to create a form in which if the User presses Enter the
I want to create an input form that will take the input text and
I am new In ASP.NET, I want to create to Login Form using Membership
I want to create a simple user registration form with First / Last name,
I want to create a GraphicsPath and a list of Points to form the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.