Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I need to change the way a windows form application looks. It needs to look more like an XP windows application, with the bubbly look that XP has, also I was wondering if anyone can recommend me a site for looking for professional icons. As always any help is greatly appreiciated.
Posted

If you are using the .NET Framework 1.1 then the Application.EnableVisualStyles will ensure that the controls on your forms mimic the XP look. Simply place this in a Sub Main or inside your startup form:

 

Application.EnableVisualStyles()
'Calling doevents removes a small bug that disables
'images from being displayed inside list and tree controls
Application.DoEvents()

 

In terms of icons, if your looking for the ones that XP uses then you could always extract them from the Shell32.dll file

 

Hope this helps

Visit: VBSourceSeek - The VB.NET sourcecode library

 

 

"A mere friend will agree with you, but a real friend will argue."
Posted

It did not work

 

My application does not have the xp-style look. I put the code in the load event of my VB code. I am running the Framework 1.1, does it matter that I am running Windows 2000 Professional as an operating system. As always any help given is greatly appreciated.

Posted
My application does not have the xp-style look. I put the code in the load event of my VB code. I am running the Framework 1.1' date=' does it matter that I am running Windows 2000 Professional as an operating system. As always any help given is greatly appreciated.[/quote'] If you mean the Form_Load event, I believe that is 'too late' in the creation of the form or something, but don't quote me on that :P

 

If you put Application.EnableVisualStyles() after the line "InitializeComponent()" in the Windows Form Designer Generated Code, it should work fine.

 

Also remember that certain controls (such as buttons) need to have their FlatStyle property set to "System" for them to use XP styles.

 

Hope that helps :)

 

Edit: Oops, I forgot that you're running Win2k. Unfortunately you cannot get XP styles that simply on non-XP operating systems. I think you may need to find/make a custom control. Sorry I didn't notice that before I posted :(

Using: Visual Studio 2005/08

Languages: C#, Win32 C++, Java, PHP

Posted

Still not working

 

It still did not work, do you think the problem is that I am trying too run this program in a Windows 2000 Professional environment. Any help is greatly appreciated.

Posted

First of all Windows 2000 does not support visual styles, so it won't render any visual style layers onto your controls.

 

Second of all do not use the Application.EnableVisualStyles() call, because it causes numerous problems, it's a buggy method. Stick with the manifest file for now, i think they rectified this issue in Whidbey.

  • *Experts*
Posted
You can get the Windows XP look in a Win2K environment with custom user controls. It's a bit of work, but it guarantees the the end user will see the same interface no matter what OS they are using.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • Leaders
Posted

Okay, there is a lot of misinformation about the .EnableVisualStyles method here. First of all, no, Windows does not offer Xp styles on Windows 2000, even if you call EnableVisualStyles. Windows only offers Xp styles in Xp. Like DiverDan said, you need to use custom controls, or something other than OS or .NET rendered controls (maybe you can just make owner drawn buttons....). If the user is using Windows Xp (regardless of which OS you are developing in), EnableVisualStyles will work JUST FINE. You just need to know when and how to use it. NOT after InitializeComponents. NOT in the Form.Load event handler. It must be called before ANY controls are created, preferably in Sub Main. Add this into your main form's code:

 

Public Shared Sub Main
   Application.EnableVisualStyles() 'Xp styles, LIKE MAGIC!
   Application.DoEvents() 'EnableVisualStyles bugs gone, LIKE MAGIC!
   Application.Run (New FrmMain) '<--Replace FrmMain with the name of your main form class
End Sub

 

If you already have a public sub main just insert the first two lines from the sub main shown above into your sub main. I have never had any problems with EnableVisualStyles. Maybe if you are subclassing the windows controls or directly handling the windows messages it could change some behavior that could cause you problems. Most likely not though.

 

Give it a whirl. If exceptions start getting thrown it is easy enough to fix, just remove the five lines of code, no worries. Keep in mind that you won't see any difference since you are using Windows 2000. Any of your users running Windows Xp will see the difference.

 

As far as Icons go, I draw my own ARGB icons in photoshop and save them with a plugin called IconFactory (IconFactory is not free).

 

[Edit]A manifest would certainly also work, but it requires that the additional .Manifest file be present in the folder that the exe is in. The "Visual Studio .NET 2003 Combined Collection" help files include a good example.[/Edit]

[sIGPIC]e[/sIGPIC]
  • Leaders
Posted
If you want to be consistent with the OS, use xp styles. If you are going for a complete skin, like media player, then by all means use custom controls.
[sIGPIC]e[/sIGPIC]
Posted

I have been looking into exsacually the same thing, trying to give an XP style to my application, no matter which OS I am using. I have found a third-party piece of software called dotnetbar http://www.devcomponents.com/dotnetbar/ that I am currently evaluating and it seems to be very good visually and coding wise. The only thing I have found is that it does slow the display of your form by about a sec. You can download a trial version and the license to distribute with your software (royalty free) is $189.

 

Let me know what you think? and I would also be interested to hear good or bad points about this software.

 

Cheers

 

Simon

  • Leaders
Posted
If it is worth the one second wait and the $189 to you, go for it. It looks like its easy to use in your application. Personally, I don't pay for anything. If I can't get something for free or make it myself, I just forget about it. But that's probably not always the best policy. I personally also can't stand waiting for a program's window to open after I click the Icon. The faster, the better. But thats just me.
[sIGPIC]e[/sIGPIC]
Posted
You could also respect the users preferences and only use the native skinning (where applicable) instead of forcing them to use a Luna interface. I'm still using win2k and any program that tried to force a Luna interface on me is isn't getting opened a second time if i can help it. You'd have to have a _really_ good reason to ignore user preferences and get away with it.
  • Leaders
Posted

The "classic windows" interface is considered by many to be the ugliest operating system around. Thats why windows xp introduced us to visual styles, and thats why so many applications, including some of Microsofts own programs (think Media Player, messenger) are skinned.

 

Besides that, a skin can give a program distiction and set it apart from other programs, and in some cases can improve or modify functionality. Are these good enough reasons?

 

Granted some skins just make an app more confusing or cluttered looking, but skins are fine when used appropriately. If you are making a simple or small program, there isn't much need to toss a skin on there. When used with descretion and implemented well, however, a skin can be a good thing.

[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted
Well thank God we all have our individual opinions. But I've got to say that it sounds like you guys are trying to "sell or force" yours on others......Adobe, Symantec, Corel and a bunch of others do not use the XP OS shell for their forms and controls and I for one am happy about that.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

As I said I'm only looking into using it at the moment (don't want to get into pros and cons issues) but one issue that I am worried about is the time delay. As marble eater said and I agree with, I want forms to appear instantanuosly when requested. Is there anyway I can load my forms into memory or something (I'm new to vb.net) when the application is initially loading, so when the forms are requested they don't have this time delay as they are already ineffect loaded / built.

 

I don't know if this is possible and my terminoligy is probably all wrong, so please be gentle

Posted

If you think the classic interface is ugly thats fine, i'll stick with it though because i like it, we're both happy. The moment you start forcing one interface on people though you're in dodgey territory. One thing you should appreciate about the windows interface (skinned or not) is that it is designed to be consistant, and it is remarkably so. The guidelines show you how to write programs that confirm to standard usage patterns, thing slike copy paste, file and edit menus, they're standard only because if you put them somewhere else or use different names or accessor keys you will confuse your users.

 

If you force people to use a skinned application you blow away any previous experience they have and force them to learn your program as a separate system. This means that people will use your program slowly and relcutantly if they continue to use it at all. You should try to make your program as familiar as possible and conform to user preferences whereever possible to minimize the new ideas that users need to know.

 

Microsoft and other may well be skinning their applications, but i'm not using them and i hate skinned applications that don't let me use a classic theme. I don't have resources to space and i don't need irritating applications taking it upon themselves to ignore my preferences and wasting my resources.

 

By all means skin things, make sure that if people are using Luna or some other skin that your application matches and makes the experience as easy as possible. But don't force skin to a new look/paradigm, thats just silly.

  • Leaders
Posted
I don't know if this will work but try instantiating but not showing the form as soon as you know that you will need it. If, for example, you know that a dialog that you created will be used frequently, instantiate it when the app loads. Declare a variable initialized to a reference of a new instance of this form (like Dim frmEntryEditor as new EntryEditor). The form will be initialized, but not shown until you call frmEntryEditor.Show(). There is no way, of course, to do this for your main form.
[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted
If you initiate an instance of the Form2 from Form1's declaration section, you will also have to Hide Form2 in Form2's closing event. Not knowing if you need to update any variables in Form2 from Form1, this method of showing Form2 will require the use of Public events in Form2 for updates....I think I made that sound very confussing!

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • Leaders
Posted
Yeah... I'm not sure that I got all that. But that is a good point; in Form2's closing event, you would want to set e.Cancel to True, and call Me.Hide. You would also want Form2 to clear any textboxes, reset any labels that were changed, etc. each time it is shown.
[sIGPIC]e[/sIGPIC]

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...