Board index » delphi » Transparrent Splash Form

Transparrent Splash Form

I really want to have an image as a splash screen that uses transparency,
but the only way I know how to make a splash screen is to use an image
control on a form.  So my questions are:

1.  Can a form be transparent?  If yes, how?  And does Delphi support
transparent images in the image control?

or

2.  Can an image be displayed on its own and not on a form?

Thanks for any help,
Matt

 

Re:Transparrent Splash Form


If I were you, I'd check out TSkinForm component on Torry's that
uses a unit that I wrote to make a form that is the shape of a bitmap.
Of course it uses a TImage component but the form will be in the shape
that you want by using SetWindowRgn.

You can also check out my article on www.undu.com on Complex Window
Regions in Januaryor February of this year...

Quote
Matt Baldwin <nos...@avoid.com> wrote in message

news:7u2bku$89k6@forums.borland.com...
Quote
> I really want to have an image as a splash screen that uses transparency,
> but the only way I know how to make a splash screen is to use an image
> control on a form.  So my questions are:

> 1.  Can a form be transparent?  If yes, how?  And does Delphi support
> transparent images in the image control?

> or

> 2.  Can an image be displayed on its own and not on a form?

> Thanks for any help,
> Matt

Re:Transparrent Splash Form


Quote
Matt Baldwin <nos...@avoid.com> wrote in message

news:7u2bku$89k6@forums.borland.com...

Quote
> I really want to have an image as a splash screen that uses transparency,
> but the only way I know how to make a splash screen is to use an image
> control on a form.  So my questions are:

> 1.  Can a form be transparent?  If yes, how?  And does Delphi support
> transparent images in the image control?

Take a look at the "Non-Rectangular Windows" links at
http://www.efg2.com/Lab/Library/Delphi/Graphics/Algorithms.htm#Graphics

Quote
> 2.  Can an image be displayed on its own and not on a form?

Please explain.  You could display a bitmap on a canvas of a form,
but you'd need to do this in an OnPaint for persistence.
___
efg

Earl F. Glynn     E-Mail:  EarlGl...@att.net
Overland Park, KS  USA

efg's Computer Lab:  http://www.efg2.com/Lab

Re:Transparrent Splash Form


Quote
"Earl F. Glynn" wrote:

> > 2.  Can an image be displayed on its own and not on a form?

> Please explain.  You could display a bitmap on a canvas of a form,
> but you'd need to do this in an OnPaint for persistence.

I read the question as: can a program not have a form and still show a bitmap.

I haven't tried my luck at form-less programs yet (eeh...) but I guess you could
just draw on the desktop.

Remco
http://www.xs4all.nl/~remcodek/download.html

Re:Transparrent Splash Form


Just the the form for no border, this will remove the Title bar also, then
then set the Brush of the form to Bursh.Style := bsClear.
 place a TPaintBox on the form.
have your image in an TBitmap.
 Use PaintBox.Canvas.Draw(0,0,MyTransparentBitMap);
Make sure you have set the Transparent mode for the Bitmap and the correct
color for the mask..
 With this code you can draw all kinds of shapes on the screen and allow the
background to show

You may need to trap the WM_ERASEBKGOUND to prevent the PaintBox the become a
default
white box.

Quote
Matt Baldwin wrote:
> I really want to have an image as a splash screen that uses transparency,
> but the only way I know how to make a splash screen is to use an image
> control on a form.  So my questions are:

> 1.  Can a form be transparent?  If yes, how?  And does Delphi support
> transparent images in the image control?

> or

> 2.  Can an image be displayed on its own and not on a form?

> Thanks for any help,
> Matt

Re:Transparrent Splash Form


I know what you mean.
I too have see and don't know how they did it, a splash screen that is just
the image.
And the image is very much like a .gif with a transparent background color,
but it is more
than that. The image transparent area shows all colors through the
transparent area.

If you find out how to do this please let me know.

John Brush
JBr...@fix.net

Quote
Matt Baldwin wrote:
> I really want to have an image as a splash screen that uses transparency,
> but the only way I know how to make a splash screen is to use an image
> control on a form.  So my questions are:

> 1.  Can a form be transparent?  If yes, how?  And does Delphi support
> transparent images in the image control?

> or

> 2.  Can an image be displayed on its own and not on a form?

> Thanks for any help,
> Matt

Re:Transparrent Splash Form


I have an application which does what (I think) you are asking.

Add a form to your app, I call mine fSplash.  Place a TImage on the form.
Load the image with a picture.
Set the form's autosize to true, and the timage autosize to true.
Here's the entire fSplash unit, I use an ellipse for my region.  Check help
for other region types CreatePolygonRgn etc

unit Splash1;

interface

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

type
  TfSplash = class(TForm)
    Image1: TImage;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    MyReg : HRGN;
  public
    { Public declarations }
  end;

var
  fSplash: TfSplash;

implementation

{$R *.DFM}

procedure TfSplash.FormCreate(Sender: TObject);
begin
  MyReg := CreateEllipticRgn(
    GetSystemMetrics(SM_CXBORDER)+3,
    GetSystemMetrics(SM_CYCAPTION) + 3,
    259,259);
  SetWindowRgn(Handle, MyReg, TRUE);
end;

procedure TfSplash.FormDestroy(Sender: TObject);
begin
  DeleteObject(MyReg);
end;

end.

In your project's source, you have to do some juggling to make it show while
all your other forms are created:

begin
  fSplash := TfSplash.Create(Application);
  fSplash.Show;
  fSplash.Update;
  Application.Initialize;
  Application.Title := '''sTile 99';
  Application.CreateForm(TfHarmTile, fHarmTile);
  Application.CreateForm(TfToolBox, fToolBox);
.  {remove the Application.CreateForm(TfSplash,fSplash); line, you've
already created it}
.
  fSplash.Hide;
  fSplash.Free;
  Application.Run;
end.

It will take some experimentation to get the image centered in the ellipse.
Also, see Eddie Shipman's article at www.undu.com for an in-depth
description of Regions.....

You may want to check the demo that comes with my HarmFade component.  It
demonstrates how to 'grab' the area beneath your splash and use it for a
semi-transparent look.  www.users.uswest.net/~sharman1/HarmFade.zip
--
Harm

Omaha NE

http://www.users.uswest.net/~sharman1/

 'sTile99 - Cool graphics, for free!

Quote
Matt Baldwin <nos...@avoid.com> wrote in message

news:7u2bku$89k6@forums.borland.com...
Quote
> I really want to have an image as a splash screen that uses transparency,
> but the only way I know how to make a splash screen is to use an image
> control on a form.  So my questions are:

> 1.  Can a form be transparent?  If yes, how?  And does Delphi support
> transparent images in the image control?

> or

> 2.  Can an image be displayed on its own and not on a form?

> Thanks for any help,
> Matt

Re:Transparrent Splash Form


Use GetHWND api with the window handle as nil. That returns a handle to
the entire desktop region. You can paint with BitBlt api function.

I believe this is the way to do it.

Jurrian de Valk

Re:Transparrent Splash Form


Try Gabe's Odd Form Assistant. Maybe it will help you.
You are free to download it from http://www.informatics.no

Best regards
Thor-Willy
thor-w.gabriel...@trade.no

Quote
Matt Baldwin <nos...@avoid.com> wrote in message

news:7u2bku$89k6@forums.borland.com...
Quote
> I really want to have an image as a splash screen that uses transparency,
> but the only way I know how to make a splash screen is to use an image
> control on a form.  So my questions are:

> 1.  Can a form be transparent?  If yes, how?  And does Delphi support
> transparent images in the image control?

> or

> 2.  Can an image be displayed on its own and not on a form?

> Thanks for any help,
> Matt

Other Threads