Solved

Transparent SplashScreen

Posted on 1999-01-04
7
211 Views
Last Modified: 2010-04-04
Hello And Happy New Year!!!

How Can I Make Transparent SplashScreen?
0
Comment
Question by:mummi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354524
add the following to your splashscreen form, this will make the window itself transparent.  Not sure if this is what you want though.

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
  private
    { Private declarations }
  public
    { Public declarations }
    procedure CreateParams(var Params: TCreateParams); override;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
  Inherited CreateParams(Params);
  Params.ExStyle := Params.ExStyle + WS_EX_TRANSPARENT;
end;

end.
0
 

Expert Comment

by:tleforge
ID: 1354525
You may also want to try the following code.  It's been passed
around quite frequently lately.  Try it.  I think you'll be
impressed.

//**************************************************************
//**** Code Begins Here ****************************************
//**************************************************************

unit Unit1;

interface

uses  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, Buttons, ComCtrls, Grids, DBGrids;
type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Button1: TButton;
    Button2: TButton;
    ListBox1: TListBox;
    ComboBox1: TComboBox;
    DBGrid1: TDBGrid;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure TransForm(Sender: TObject);
    procedure FormResize(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.TransForm(Sender: TObject);
var
  FullRgn, ClientRgn, ButtonRgn: THandle;
  Margin, x, y, z: Integer;
  l,t,h,w: Integer;
begin
  Margin := (Width - ClientWidth) div 2;
  FullRgn := CreateRectRgn(0, 0, Width, Height);
  x := Margin;
  y := Height - ClientHeight - Margin;
  ClientRgn := CreateRectRgn(x, y, x + ClientWidth, y + ClientHeight);
  CombineRgn(FullRgn, FullRgn, ClientRgn, RGN_DIFF);
  for z := ComponentCount - 1 downto 0 do begin
    if Components[z] is {TControl} TWinControl then
      if (Components[z].GetParentComponent is TForm) then
      with Components[z] as {TControl} TWinControl do begin
        l := Left;
        t := Top;
        h := Height;
        w := Width;
      end;
      x := Margin + l;
      y := (Height - ClientHeight - Margin) + t;
    ButtonRgn := CreateRectRgn(x, y, x + w, y + h);
    CombineRgn(FullRgn, FullRgn, ButtonRgn, RGN_OR);
  end;
  SetWindowRgn(Handle, FullRgn, TRUE);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  TransForm(Sender);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Close;
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  TransForm(Sender);
end;

end.

//**************************************************************
//**** Code Ends Here ******************************************
//**************************************************************

0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1354526
you should except tlrforge's comment over mine, much more complete answer.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:tleforge
ID: 1354527
Actually, I'm not asking for any points.  The code segment I
submitted is not completely original.  I did make a few
improvements, but nothing that warrants any points.

0
 
LVL 1

Accepted Solution

by:
adeng earned 40 total points
ID: 1354528
Try to download a cool form in http://www.lawrenz.com/coolform/

it make a transparent form very easy from a picture, it's inculding source code for delphi.

Adeng.
0
 

Expert Comment

by:joanita
ID: 1354529
Include the following code in the onCreate event handler of the splash screen form:
BorderStyle := bsNone;
brush.style :=bsClear;
Additionally if you want the image itself of the splash screen to be tranparent set its transparent property to true.

0
 

Author Comment

by:mummi
ID: 1354530
Yesssss....Thanks..
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question