Board index » cppbuilder » How to create Egg shape Form?

How to create Egg shape Form?

Hi, i want to create form which in not squere as a normal form,
for example i want my form to be "egg shape", or to have a
little bit 3D look, how can i do that? if this form have a menu
will the menu get out of the egg shape borders? and what about
the blue title that every form have in it's top, can i remove it?

Thanks

 

Re:How to create Egg shape Form?


Janet the easiest way would be to use a component designed for this.
dxForumLibrary has one. If you have BCB5 or 6 pro it is on the companion
tools disk. Their webpage is
http://www.devexpress.com/products/vcl/exforlib.asp
Boian Mitov also has one on his website. http://www.mitov.com/

These components us a Bitmap to draw the shaped form. Basically whatever you
draw in MSPaint e.g.  is what your form will look like. This way you can
draw the title bar and handle mouse events yourself.

Below is a code snippet that has been bandied around for some time, I can't
remember who posted it. But shows how to draw transparent regions on a Form.
It's very nice and worth a try.

//--------------------------------------------------------------------------
-
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
// There are 5 points in a rectangle
// with a dog-ear
const int PointCount = 5;

// Distance for dog-ear
const int DogEarDelta = 250;

TPoint Points[PointCount];
Points[0] = Point(0, 0);
Points[1] = Point(Width, 0);
Points[2] = Point(Width,Height - DogEarDelta);
Points[3] = Point(Width - DogEarDelta,Height);
Points[4] = Point(0, Height);

HRGN Region = CreatePolygonRgn(Points,PointCount,ALTERNATE);

SetWindowRgn(Handle,Region,true);

DeleteObject(Region);

Quote
}

//--------------------------------------------------------------------------
-

Best wishes MS.

Quote
"Janet Wright" <wrigh...@aol.com> wrote in message

news:3d300ac5$1_1@dnews...
Quote

> Hi, i want to create form which in not squere as a normal form,
> for example i want my form to be "egg shape", or to have a
> little bit 3D look, how can i do that? if this form have a menu
> will the menu get out of the egg shape borders? and what about
> the blue title that every form have in it's top, can i remove it?

> Thanks

Re:How to create Egg shape Form?


Oops - forgot to answer some other questions :D

Quote
> > Hi, i want to create form which in not squere as a normal form,
> > for example i want my form to be "egg shape", or to have a
> > little bit 3D look, how can i do that?

See my previous post

Quote
> > if this form have a menu
> > will the menu get out of the egg shape borders?

Wasn't able to figure that out. Seems like my app doesn't like menus ;-)
It doesn't even pop up.

Quote
> > and what about
> > the blue title that every form have in it's top, can i remove it?

Set the form's border property BorderStyle to bsNone.
But keep in mind that when doing so you've to handle window movement
yourself. Capture the window message
WM_NCHITTEST to do so.

Michael

Re:How to create Egg shape Form?


Have a look at
CreateEllipticRgn(...) and SetWindowRgn(...)

Hth
Michael

Janet Wright schrieb:

Quote
> Hi, i want to create form which in not squere as a normal form,
> for example i want my form to be "egg shape", or to have a
> little bit 3D look, how can i do that? if this form have a menu
> will the menu get out of the egg shape borders? and what about
> the blue title that every form have in it's top, can i remove it?

> Thanks

Re:How to create Egg shape Form?


Thanks the two of you, your answers helps a lot.

By the way i'm using Builder 4.0

Thanks

 :-)

Re:How to create Egg shape Form?


Damon Chandler has an article on eliptical forms as http://www.bcbcaq.com/
click the Forms link.

Quote
"Janet Wright" <wrigh...@aol.com> wrote in message

news:3d300ac5$1_1@dnews...
Quote

> Hi, i want to create form which in not squere as a normal form,
> for example i want my form to be "egg shape", or to have a
> little bit 3D look, how can i do that? if this form have a menu
> will the menu get out of the egg shape borders? and what about
> the blue title that every form have in it's top, can i remove it?

> Thanks

Re:How to create Egg shape Form?


Hello,

This also may help,
http://www.lawrenz.com/coolform

Quote
"Janet Wright" <wrigh...@aol.com> wrote in message

news:3d300ac5$1_1@dnews...
Quote

> Hi, i want to create form which in not squere as a normal form,
> for example i want my form to be "egg shape", or to have a
> little bit 3D look, how can i do that? if this form have a menu
> will the menu get out of the egg shape borders? and what about
> the blue title that every form have in it's top, can i remove it?

> Thanks

Re:How to create Egg shape Form?


Janet,
   In addition to the articles mentioned, you might also want to have a
look at the article "Custom Buttons, Part III" in the November '01 issue
of the C++Builder Dev. Journal:
http://www.bridgespublishing.com/articles.shtm.

In that article, look for the function RegionFromDIBSection(), which
allows you to create a region whose shape is defined by a bitmap.  A
slightly older version of this function is also available here...

http://groups.google.com/groups?selm=3AF15476.451D7139%40cornell.edu

Best of luck,
--
Damon C. <TeamB>
http://www.bcbcaq.com
http://graphicsbb.itgo.com

Other Threads