PC Review


Reply
Thread Tools Rate Thread

How to center the title of a form ?

 
 
Polaris
Guest
Posts: n/a
 
      22nd Nov 2007
Hi:

I'm programming Windows forms with C#. By default, all windows title is
left-aligned, just wonder if there is a way to make the title center-aligned
on the Windows title bar?

Thanks in advance!
Polaris



 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      22nd Nov 2007
On Nov 22, 5:19 am, "Polaris" <etpola...@hotmail.com> wrote:
> I'm programming Windows forms with C#. By default, all windows title is
> left-aligned, just wonder if there is a way to make the title center-aligned
> on the Windows title bar?


I don't believe this is possible - it's just the way Windows is. Apart
from anything else, if you did this it would make your app look
different to every other application I've ever seen. Consistency is a
good thing.

Jon
 
Reply With Quote
 
Kerem Gümrükcü
Guest
Posts: n/a
 
      22nd Nov 2007
Hi Jon,

in regular ways this wont work, but when you hook into
the forms message queue, then you can trap e.g. WM_NC*
Messages and Draw the Text into the caption for the
form with gdi functions and modify it with the form resizing
events or any appropriate functions/messages...but NOT
recommended!

But this is something very uncommon and i would
consider it as a strange thing,...

Much better solution would be a user defined control
or window placed on a form without the caption bar
that emulates the system caption bars functionallity,...

Thats what i would recommend,...

Regards

Kerem

-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
(E-Mail Removed)

Best Quote: "Ain't nobody a badass with a double dose
of rock salt...", Kill Bill Vol.2

Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
Sign my guestbook: http://entwicklung.junetz.de/guestbook/
-----------------------
"This reply is provided as is, without warranty express or implied."


 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      22nd Nov 2007
On Nov 22, 8:56 am, "Kerem Gümrükcü" <kareem...@hotmail.com> wrote:
> in regular ways this wont work, but when you hook into
> the forms message queue, then you can trap e.g. WM_NC*
> Messages and Draw the Text into the caption for the
> form with gdi functions and modify it with the form resizing
> events or any appropriate functions/messages...but NOT
> recommended!


Ick! An alternative and slightly simpler idea would be to measure the
size of the text (knowing the font size) and insert an appropriate
number of spaces at the start of the title to get "rough" centering

> But this is something very uncommon and i would
> consider it as a strange thing,...
>
> Much better solution would be a user defined control
> or window placed on a form without the caption bar
> that emulates the system caption bars functionallity,...
>
> Thats what i would recommend,...


What I'd recommend is sticking with the look and feel that users are
already used to. Why make things different? I *could* decide to make
my app save with Ctrl+N and create a new document with Ctrl+S, but
it's a bad idea

Jon
 
Reply With Quote
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      22nd Nov 2007
Hello Polaris,

Just to support Jon. I've never understand why peoply trying to change the
standard windows? like title bar and etc? It never brings more functionality
or makes your app more pleasant.

Just try to contcentrate on your app functionality rather than on this glare
stuff


---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


P> Hi:
P>
P> I'm programming Windows forms with C#. By default, all windows title
P> is left-aligned, just wonder if there is a way to make the title
P> center-aligned on the Windows title bar?
P>
P> Thanks in advance!
P> Polaris


 
Reply With Quote
 
Kerem Gumrukcu
Guest
Posts: n/a
 
      22nd Nov 2007
Hi Michael,

>Just to support Jon. I've never understand why peoply trying to change the
>standard windows? like title bar and etc? It never brings more
>functionality or makes your app more pleasant.


>Just try to contcentrate on your app functionality rather than on this
>glare stuff


Damn right!

Regards

Kerem

--
-----------------------
Beste Grusse / Best regards / Votre bien devoue
Kerem Gumrukcu
(E-Mail Removed)

Best Quote: "Ain't nobody a badass with a double dose
of rock salt...", Kill Bill Vol.2

Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
Sign my guestbook: http://entwicklung.junetz.de/guestbook/
-----------------------
"This reply is provided as is, without warranty express or implied."


 
Reply With Quote
 
Mattias Sjögren
Guest
Posts: n/a
 
      22nd Nov 2007
Jon,

>Apart
>from anything else, if you did this it would make your app look
>different to every other application I've ever seen.


FWIW, Microsoft Office 2007 does exactly this.

Of course, when Office does it, people don't see it as inconsistency
but as innovation. And it becomes the OS standard a few years later.


>Consistency is a good thing.


Agreed!


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
 
Reply With Quote
 
Michael Nemtsev [MVP]
Guest
Posts: n/a
 
      22nd Nov 2007
Hello Mattias,

I wonder how much $ MS spent on usability engineers to introduce this Ribbon
stuff
I suppose it's not just the idea of single developer "lets put this button
there"

MS> Jon,
MS>
>> Apart
>> from anything else, if you did this it would make your app look
>> different to every other application I've ever seen.

MS> FWIW, Microsoft Office 2007 does exactly this.


---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I center the title of a document? Marain Microsoft Word New Users 3 30th Mar 2010 09:19 AM
How do I Un-center the Title Bar text? Charles Microsoft Excel Misc 1 27th Oct 2009 02:09 PM
After I center a title, how do I return to left alignment ? =?Utf-8?B?TWFyeSBFbGxlbiBBZGFtcw==?= Microsoft Word Document Management 1 21st Sep 2007 07:01 PM
How do I center align a title at top of sheet. =?Utf-8?B?VmVl?= Microsoft Excel Worksheet Functions 1 20th Sep 2006 10:00 PM
Center one form over another + height of title bar C-Sharper or C-Hasher, one of the two Microsoft C# .NET 4 9th Mar 2004 07:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:12 PM.