XP look on buttons etc

A

Aussie Rules

Hi,

For some reason my App has stopped displaying buttons and other such
controls with the XP style.

They have all reverted back to the standard style button.

I have the buttons.flatstyle set to = system, but they are the same as
standard.

I have the Windows XP Style set in my display properties (properties of the
desktop), and the color scheme set to silver, and all the buttons in other
applications look as they should.

How do I get my buttons back to the XP style.

Thanks
 
H

Herfried K. Wagner [MVP]

Aussie Rules said:
For some reason my App has stopped displaying buttons and other such
controls with the XP style.

They have all reverted back to the standard style button.

I have the buttons.flatstyle set to = system, but they are the same as
standard.

I have the Windows XP Style set in my display properties (properties of
the desktop), and the color scheme set to silver, and all the buttons in
other applications look as they should.

Enabling Windows XP Visual Styles for Windows Forms applications
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=xpvisualstyles&lang=en>
 
A

Aussie Rules

Hi,

Thanks for this.

I have created a manifest file as described. I hope i did this correct as
all i did was add a text file, rename it to the projectname.manifest, and
changed the details within the xml I pasted from the site into the manifest
file

The bit that is confusing is that last bit that makes reference to adding in
the details to the referneces:

"
1.. Add the manifest to your application's resource file as follows:
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "YourApp.exe.manifest"

"


I have no idea what this means or how to do it. I tried to add a reference
to my project to the manifest file, but it didn't like that very much.

Thanks
 
H

Herfried K. Wagner [MVP]

Aussie Rules said:
I have created a manifest file as described. I hope i did this correct as
all i did was add a text file, rename it to the projectname.manifest, and
changed the details within the xml I pasted from the site into the
manifest file

Am I right that you are using .NET 1.0?
 
H

Herfried K. Wagner [MVP]

Aussie Rules said:
VS.net 03 with .net 1.1

Then you don't need the manifest stuff. Instead, add the following code to
a code file:

\\\
Public Module Program
Public Sub Main()
Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(New MainForm())
End Sub
End Module
///

In the project properties, select 'Sub Main' as startup object.
 
A

Aussie Rules

Hi,

Thanks for you help, I added that in, but i still don't have the XP look on
all my buttons on all my forms

Any other tricks to try?
 
H

Herfried K. Wagner [MVP]

Aussie Rules said:
Thanks for you help, I added that in, but i still don't have the XP look
on all my buttons on all my forms

Create a Windows Forms project from scratch, add the code I posted, add a
button to the form and set its 'FlatStyle' to 'System'. Then run the
application. Is it shown with Visual Styles applied?
 
A

Aussie Rules

and all the button .style is set to system, so it should pick up the style

do i have to do something within each form in my project ?
 
A

Aussie Rules

Yes that works fine.

So I have gone back to my project and rechecked everything, and it seems
fine.

I have added a empty form to the proper project, and tested it. It works
fine, as long as none of my other code is with the code you posted.

It doesn't seem to make sense.

My propery project has a global.vb file, and the project startup property is
set to that(sub main).

I have attached the sub main below, where you can i see how i have put the
code in.

Something here is stopping it from working, but i can not see what it could
be.

Thanks

---------------


Public Sub Main()

Application.EnableVisualStyles()

Application.DoEvents()



Dim aKey As RegistryKey

Dim bgConnection As String

aKey = Registry.CurrentUser.OpenSubKey("software\XXXX")

Dim frmSPlash As New frmSplash

Dim ObjLoginDetails As New clsLogin

Try

frmSPlash.txtServer.Text = "windows2003e"

ObjLoginDetails.strLoginServer = frmSPlash.txtServer.Text

ObjLoginDetails.strLoginUserID = frmSPlash.txtUserID.Text

ObjLoginDetails.strLoginUserPWD = frmSPlash.txtPwd.Text

ObjLoginDetails.ConnectToDB()

frmSPlash.ShowDialog()

If SetUpUserSecurity(ObjLoginDetails.strLoginUserID,
ObjLoginDetails.strLoginUserPWD) Then

End If

Catch

MsgBox(Err.Description)

End

End Try

Try

intSiteID = aKey.GetValue("SiteID")

strAgentName = aKey.GetValue("LastGoodID")

If intSiteID <> "0" Then

strConnection = aKey.GetValue("BackgroundConn")

Else

MsgBox("no Site ID")

End If

Catch

End Try

If SqlConnection.State.Closed Then

MsgBox("No SQL Connection")

End

End If

Try

SetUpconstDatasets()

Application.Run(New frmMain)

Catch ex As Exception

MsgBox(Err.Description)

End Try

End Sub
 
H

Herfried K. Wagner [MVP]

Aussie Rules said:
So I have gone back to my project and rechecked everything, and it seems
fine.

I feel sorry, but I don't have an idea what can be causing the problem. Are
you using any 3rd-party controls (maybe ActiveX controls) on the specific
form?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top