this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Tuesday, July 20, 2010

To Fix Label’s and other controls text are wrapping though it looks Okay in Designer

Recently I have faced a very strange problem in my project, suddenly in some forms text of label wrapped when I run application.

I have not changed anything in my designer or code, though it was creating problem at runtime. I have compared my forms with older version, I also went through each of possible design property of forms but I didn’t find anything.

I had no idea what to do. Then I came to know that my project is in Vb.net and recently I have added my custom main method, if you have been using vb.net you would be aware there is no main method, framework create it runtime. But if you want to do something at startup you need to write main method in vb.net application.

So I got what the problem it was.

By default when runtime create main method it uses following setting for text render but if you are using your own main method at that time you need to add this line to your main method else it can create problem what I have faced.

Application.SetCompatibleTextRenderingDefault(False)

1 comment:

aslam said...

Thanks Shailesh, Its a small issue, but taken more time for me.