Board index » delphi » Transparent forms question

Transparent forms question

Just wondered if it possible to create a transparent form?

Ken

 

Re:Transparent forms question


Quote
Ken wrote:

> Just wondered if it possible to create a transparent form?

        well, if you want the entire form transparent you
can just hide it... Sorry. If you want just part of the
form transparent you can use SetWindowRgn in the form's
OnCreate.

--
David Ullrich

sig.txt not found

Re:Transparent forms question


Quote
> Ken wrote:

> Just wondered if it possible to create a transparent form?

David Urlich said and I tried... Start 'New Application', paste this
code to OnCreate method of default form and you'll see ugly green
letter-O-like form with Fern fractal inside. If you have slow machine,
you might have to wait a sec because of great deal of calculation...

(Fractal code ripped from Delphi 2 Unleashed, (c) Charles Calvert)

======================================================================

procedure TForm1.FormCreate(Sender: TObject);
type
  TDAry = array[0..3] of Double;
const
    a: TDAry = (0, 0.85, 0.2, -0.15);
    b: TDAry = (0, 0.04, -0.26, 0.28);
    c: TDary = (0, -0.04, 0.23, 0.26);
    d: TDAry = (0.16, 0.85, 0.22, 0.24);
    e: TDAry = (0, 0, 0, 0);
    f: TDAry = (0, 1.6, 1.6, 0.44);
var
    region, big, small, dot: HRGN;
    xx,yy,k,count: integer;
    x,y: double;
    DrawFractal: boolean;
begin
    Color := clLime;
    DrawFractal := TRUE;

    // region looks like letter O

    region := CreateRectRgn(0, 0, Width, Height);
    big    := CreateEllipticRgn(0, 0, Width, Height);
    small  := CreateEllipticRgn(90, 35, Width-90, Height-35);
    CombineRgn(region, big, small, RGN_DIFF);

    // draw fractal inside

    if DrawFractal then
    begin
        x := 0;
        y := 0;
        for count := 0 to 3000 do begin
           k := Random(100);
           if ((k > 0) and (k <= 85)) then  k := 1;
           if ((k > 85) and (k <= 92)) then k := 2;
           if (k > 92) then k := 3;
           x := a[k] * x + b[k] * y + e[k];
           y := c[k] * x + d[k] * y + f[k];
           xx := Round(x * Height / 11 + Width / 2);
           yy := Round(y * -Height / 11 + Height);
           dot := CreateRectRgn(xx, yy, xx+1, yy+1);
           CombineRgn(region, region, dot, RGN_XOR);
        end;
    end;

    // assign the region to the form

    SetWindowRgn(Handle, region, TRUE);
end;

Re:Transparent forms question


  One of the UNDO's ( http://www.informant.com/undu/ ) described how to do
a 'ocatagonal' splash screen...  It might be worth looking into...
(unfortunatelly, I don't remember which one...  (But, hey, it's a great
'magazine' (and it's free....)))

--
Jason Wallace
SL Software
Dark...@SLSoftware.reno.nv.us
--
"We are MicroSoft.  You will be assimilated.  Resistance is Futile."
--

Ken <k...@netmar.demon.co.uk> wrote in article
<874417340.591.0.nnrp-07.9e987...@news.demon.co.uk>...

Quote
> Just wondered if it possible to create a transparent form?

Re:Transparent forms question


In article <01bcc31d$6c4a2e40$7d6921cf@dark-elf>, "Jason Wallace"

Quote
<Dark...@SLSoftware.reno.nv.us> writes:
>  One of the UNDO's ( http://www.informant.com/undu/ ) described how to do
>a 'ocatagonal' splash screen...  It might be worth looking into...
>(unfortunatelly, I don't remember which one...  (But, hey, it's a great
>'magazine' (and it's free....)))

It also comes in Windows Help format so you can search for items when you
cannot remember where they are <g> :-

How to Make a Polygonal Splash Screens,  UNDU Issue 19,  Jan 1997

Alan Lloyd
alangll...@aol.com

Re:Transparent forms question


Quote
Srdjan Dakic wrote:

> > Ken wrote:

> > Just wondered if it possible to create a transparent form?

> David Urlich said and I tried... Start 'New Application', paste this
> code to OnCreate method of default form and you'll see ugly green
> letter-O-like form with Fern fractal inside.[...]

        Say, that _is_ ugly. Must be that Urlich guy's fault...

--
David Ullrich

sig.txt not found

Other Threads