Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Dear all,

 

I've just created an application in VB.net 2005. What a GREAT program in comparison with 2003 :). But I have one question.

 

When I have my windows style "classic" I have the standard grey buttons. When I use windows "XP Style" I have nice rounded buttons in design time, but when running they become square. How can I change this ? I also want nicely shaped buttons in runtime :)

 

Grtz,

Antoine

Posted

What do you have the button's FlatStyle property set to?

 

If you set the flatstyle to 'System' then I believe the button should follow your Windows settings - so if you're using Windows visual styles, then the button should follow the theme, if you're not using visual styles then the button will be the standard grey box.

Posted

Hello Junkee,

 

I have Flatstyle.system, that is why I think it is a little strange. Maybe there is something "wrong" in the form. I migrated this project from .NET 2003 maybe there is something wrong. Everything is working fine except for some minor alpha blending things.

 

Still thanks for your reply ! :)

Posted
I migrated this project from .NET 2003...
I had a similar experience when I migrated a project from .Net 1.1 to .Net 2.0. I ended up fixing the problem by creating a new solution/project and adding the files to it. My assumption was that there is a setting somewhere that altered the visual styles, or there is a setting that needed to be set that was not set by the conversion wizard. After I re-imported everything, I got the slick XP visual styles.
  • Leaders
Posted

I don't know what particular option you might be losing in the translation, however there are a number of ways to enable visual styles in an application in VB.Net 2005. One way is the .Net 1.1 way, which is to have a sub Main that makes a call to Application.EnableVisualStyles as the very first statement.

 

Another way is the .Net 1.0 way, which is to include a manifest with your application (an example of such a manifest is available in MSDN for .Net 1.x).

 

A third way is through the "Application Framework," a feature in VB8 that creates a set of classes for you to manage your application with. Many people prefer not to use the Application Framework (there are plenty of reasons to not want to, for example, if you want to create your own Sub Main, if you don't want all the extra code and resources compiled in to use only one feature of the "Application Framework", or if you want your code to be more portable between languages), but if you don't mind using it go to your project settings, check "Enable Application Framework", and in the "Windows application framework properties" box check "Enable Xp Visual Styles".

[sIGPIC]e[/sIGPIC]
Posted
If your project start from sub main' date=' you have to enable XP visual style by code. Use Application.EnableVisualStyle method before you run your application form[/quote']

 

Thanks all, this was the solution :) :)

  • Leaders
Posted
If your project start from sub main' date=' you have to enable XP visual style by code. Use Application.EnableVisualStyle method before you run your application form[/quote']

I think I've heard that somewhere before...

[sIGPIC]e[/sIGPIC]
Posted
I don't know what particular option you might be losing in the translation' date='...[/quote']I think it just has to do with the fact that you are essentially running .Net 1.1 code in .Net 2.0 without running any of the wizards to setup your project (main, application framework, etc). Whatever code snippets that are required to be present aren't in the name of preserving as much of your converted code as possible. Just a theory.
Posted
I think I've heard that somewhere before...

Yup. MSDN taught me that, when I was migrating from VB6. I don't know why it must use by code while with form startup, you can directly use visual style . . .

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...