Board index » cppbuilder » Form with Round edges + Fine blue title.

Form with Round edges + Fine blue title.


2004-04-28 09:21:01 PM
cppbuilder69
(last week i sent this question to a "Graphics" group by mistake)
Hi,
I'm using Win-98 with builder 4.0 C++, how can i create forms
with round edges like in the Windows XP? (in the Win-98 the forms
have a sharp edges with 90 degrees, i want them to be round)
Also, i would like to create forms with a nice polite blue title
like you have in the XP, instead of the DARK blue title that i
have as a default in the Windown-98. How do i do that?
Thanks very much.
Ramy
 
 

Re:Form with Round edges + Fine blue title.

Quote
I'm using Win-98 with builder 4.0 C++, how can i create forms
with round edges like in the Windows XP? (in the Win-98 the forms
have a sharp edges with 90 degrees, i want them to be round)
Unless you are willing to skin the windows yourself, to the best of my
knowledge you can't. BCB6 has some limited support (iirc) for WinXP but you
are stuck with Builder4. The skinning is tied into the operating system
from XP onwards (I believe W2K had limited support in the OS, but again I
could be wrong).
Quote
Also, i would like to create forms with a nice polite blue title
like you have in the XP, instead of the DARK blue title that i
have as a default in the Windown-98. How do i do that?
See above.
G.
 

Re:Form with Round edges + Fine blue title.

OK i have found an example which is a good start point for
how to draw the form's title, but i'm still not sure about how
to do that. the title bar have several parts in it -
1. The blue title bar itself.
2. The title test/caption.
3. System Icon on the left side of the title bar.
4. Minimize, Maximize and Close icons on the left side.
I think that i know how to handle numbers 1 and 2, but how do i
implement numbers 3 and 4 ?
Thanks, and Here is the example i have found -
//in header...
void __fastcall WMNCPaint(TMessage &Msg);
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_NCPAINT, TMessage, WMNCPaint)
END_MESSAGE_MAP(TForm)
//in source...
void __fastcall TForm1::WMNCPaint(TMessage &Msg)
{
TCanvas *WindowCanvas = new TCanvas();
HDC Hdc = GetWindowDC(Handle);
WindowCanvas->Handle = Hdc;
// do some drawing with WindowCanvas...
WindowCanvas->Handle = 0;
ReleaseDC(Handle, Hdc);
delete WindowCanvas;
Msg.Result = 0;
}
 

{smallsort}

Re:Form with Round edges + Fine blue title.

Thanks, please see my reply here bellow (from 5 minutes ago).
Ramy.
"Graham Reeds" < XXXX@XXXXX.COM >wrote:
Quote
>I'm using Win-98 with builder 4.0 C++, how can i create forms
>with round edges like in the Windows XP? (in the Win-98 the forms
>have a sharp edges with 90 degrees, i want them to be round)

Unless you are willing to skin the windows yourself, to the best of my
knowledge you can't. BCB6 has some limited support (iirc) for WinXP but you
are stuck with Builder4. The skinning is tied into the operating system
from XP onwards (I believe W2K had limited support in the OS, but again I
could be wrong).

>Also, i would like to create forms with a nice polite blue title
>like you have in the XP, instead of the DARK blue title that i
>have as a default in the Windown-98. How do i do that?

See above.

G.
 

Re:Form with Round edges + Fine blue title.

Sorry, i meant -
[...]
2. The title TEXT/caption.
[...]
4. Minimize, Maximize and Close icons on the RIGHT side.
[...]
 

Re:Form with Round edges + Fine blue title.

"Ramy" < XXXX@XXXXX.COM >wrote in message
Quote
in the Win-98 the forms have a sharp edges with 90
degrees, i want them to be round
You need to use a region. Look at the CreateRoundRectRgn() and
SetWindowRgn() functions in the Win32 API.
Quote
Also, i would like to create forms with a nice polite blue
title like you have in the XP, instead of the DARK blue
title that i have as a default in the Windown-98.
That is controlled by the Control Panel settings for Windows itself, not the
VCL at all. If you want to change the colors, then you have to either:
1) change the settings in the Control Panel itself, which then effects
theentire system as a whole
2) if you only want to colorize your particular application, then you will
have to custom-draw the titlebar by intercepting the WM_NCPAINT message and
draw directly onto the form window manually.
Gambit
 

Re:Form with Round edges + Fine blue title.

"Ramy" < XXXX@XXXXX.COM >wrote in message
Quote
I think that i know how to handle numbers 1 and 2,
but how do i implement numbers 3 and 4 ?
Unfortunately, it is not that easy. The dimensions of the titlebar, text,
icons, etc can be different from machine to machine, depending on the OS
version and Control Panel settings. You need to use the GetSystemMetrics()
and SystemParametersInfo() functions to determine which window features are
actually enabled on the machine, what individual element dimensions are,
etc. Even then, it can still be tricky to line everything up exactly the
same way that the OS does for its native drawing.
Quote
TCanvas *WindowCanvas = new TCanvas();
You don't need to create anew Canvas object, the form already has a Canvas
property available.
Gambit
 

Re:Form with Round edges + Fine blue title.

"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote
Unfortunately, it is not that easy [...]
Thanks for your answer, but what about the following option
which someone gave me in the 'graphics' group? -
const RECT RClient = GetClientRect();
// here you could get 'w' and 'h' from 'RECT'....
const HRGN hMyRgn = CreateRoundRectRgn(
0, // x-coordinate of the region's upper-left corner
0, // y-coordinate of the region's upper-left corner
w+1,// x-coordinate of the region's lower-right corner
h+1,// y-coordinate of the region's lower-right corner
10, // height of ellipse for rounded corners
10 // width of ellipse for rounded corners
);
SetWindowRgn(Handle, hMyRgn, true);
How's about it? will it not work?
Ramy
 

Re:Form with Round edges + Fine blue title.

"Ramy" < XXXX@XXXXX.COM >wrote in message
Quote
Thanks for your answer, but what about the following
option which someone gave me in the 'graphics' group? -
That code has nothing to do with giving your title bar a different color,
which is what you were asking about. That code only gives your window
rounded edges. Actually, the size and positioning of the region effectively
hide the titlebar and borders altogether.
Gambit
 

Re:Form with Round edges + Fine blue title.

Hi, Thanks.
But i was thinking about something else, what if i'll overide
the original function that create the title of the form, and
instead i'll create my own "title" in the client area of my
form? (i'll use for example TImage to create the blue title
with the system icon, the title, the maximize icon and so
on...).
What about this? is it possible? wiil it be easier to do?
Thanks.
"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote

"Ramy" < XXXX@XXXXX.COM >wrote in message
news:408ffb9b$ XXXX@XXXXX.COM ...

>Thanks for your answer, but what about the following
>option which someone gave me in the 'graphics' group? -

That code has nothing to do with giving your title bar a different color,
which is what you were asking about. That code only gives your window
rounded edges. Actually, the size and positioning of the region effectively
hide the titlebar and borders altogether.

Gambit
 

Re:Form with Round edges + Fine blue title.

"Ramy" < XXXX@XXXXX.COM >wrote in message
Quote
what if i'll overide the original function that create the
title of the form
There is no such function.
Quote
instead i'll create my own "title" in the client area of my
form?
The titlebar is built into the window itself, and is managed by the OS, not
the VCL. You can't replace the titlebar, only draw over top of it. If you
want to make your own titlebar yourself, then you will have to simply hide
the native titlebar altogether (such as by setting the FormStyle to fsDialog
and clearing the BorderIcons property) and then handle all of the normal
titlbar operations manually (including window dragging).
Gambit
 

Re:Form with Round edges + Fine blue title.

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
If you want to make your own titlebar yourself, then you will have
to simply hide the native titlebar altogether
Have a look at the following article for more details:
Create a captionless form
www.bcbdev.com/faqs/faq10.htm
Gambit
 

Re:Form with Round edges + Fine blue title.

Thanks, this is exactly what i did, and so far it's looks very
good :-)
Ramy
Quote
If you
want to make your own titlebar yourself, then you will have to simply hide
the native titlebar altogether (such as by setting the FormStyle to fsDialog
and clearing the BorderIcons property) and then handle all of the normal
titlbar operations manually (including window dragging).


Gambit
 

Re:Form with Round edges + Fine blue title.

Thanks
"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>If you want to make your own titlebar yourself, then you will have
>to simply hide the native titlebar altogether

Have a look at the following article for more details:

Create a captionless form
www.bcbdev.com/faqs/faq10.htm


Gambit