TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ankush
NA
267
63.2k
Center Align the Text of Tile Bar of Mdi Parent Form
Feb 4 2016 10:00 AM
I have created a windows application in which there one of the form is Mdi Parent form. I want to center align the text of this form i.e. Mdi Parent form. I have the code to center align the text of title bar of form. It is working perfectly with Mdi Child forms but not with Mdi parent form. Create the method and just call the method in Form Load event.
private void UpdateTextPosition()
{
Graphics g = this.CreateGraphics();
Double startingPoint = (this.Width / 2) - (g.MeasureString(this.Text.Trim(), this.Font).Width / 2);
Double widthOfASpace = g.MeasureString(" ", this.Font).Width;
String tmp = " ";
Double tmpWidth = 0;
while ((tmpWidth + widthOfASpace) < startingPoint)
{
tmp += " ";
tmpWidth += widthOfASpace;
}
this.Text = tmp + this.Text.Trim();
}
If you debug the program with break point, you can see that the above method is working i.e. the work mentioned in method is done, but the problem is that the text of title bar is not visible. Just try to debug the code and you will know it.
Please help !... Thanks in Advance....
Reply
Answers (
1
)
MAC OS
I want to create an audio recorder in managed code (c#) usin