Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Control for Command button with XP Style

Status
Not open for further replies.

HughLerwill

Programmer
Joined
Nov 22, 2004
Messages
1,818
Location
GB
Dear all,

XP style Command button User Control

I've been getting a little tired of putting command buttons inside picture boxes to get them to display as intended when using XP style, and this does not work well when buttons are loaded or moved or made invisible at runtime; so I thought I'd try and write a User control to overcome the problem. I am not experienced in writing User Controls.

The test project just now consists of;
The User Control; has no code and is completely bare except for a Command button.
Form1 with one User Control placed within a Frame on it
Module1; which calls InitCommonControls and Shows Form1

When compiled the exe runs as expected and displays Form1 with the User Control; the button is rendered in XP style.

When I quit the exe I get an error; 'Project1 has encountered a problem and needs to close ...'

If I remove the user control the error is not produced.

I realize I will have to add code to the User Control for it to function like a normal Command button but am reluctant to waste time if the idea is a no hoper.

Is use of User Controls with XP styles possible?
If so what should I do to prevent the error?

regards Hugh
 
Have you tried the Manifest?
XP Manifest descriptino

XP Manifest is a small but useful application for Visual Basic 6.0 Developers. It enables VB Developers to easily add the XP Manifest to their EXE Applications. All you have to do is point to your exe file, and GDS XP Manifest will do the rest.

HTH

---- Andy
 
Andy,

I can't seem to download it (without an invitation to install Napster, and I'm not going there again!) I guess it does similar stuff to that given by Hypetia in thread222-542249 by including the manifest file in the exe as a resource. Could be I am wrong but I would not expect it to work differently to use of a standalone manifest file.

I am using a standalone manifest file right now and have not had trouble with that approach before.

Maybe I will give Hypetia's code a try though.

thanks Hugh,



 
Andy,

Tried Hypetia's code and it works as far as not needing a separate manifest file anymore, however I still get the crash on exit.

Hugh,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top