Solved

Transparent SplashScreen

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

How Can I Make Transparent SplashScreen?
0
Comment
Question by:mummi
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi: how to send PJL commands to printer 3 108
Connection between libmysql.dll and MySQL Versions 7 112
Delphi XE10 Round Image 2 154
oracle global variables 4 76
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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