Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/03/2005, 21:43
enrique_g_g
 
Fecha de Ingreso: noviembre-2004
Mensajes: 48
Antigüedad: 20 años, 4 meses
Puntos: 0
habilitar estilo visual de windows xp en una aplicacion VB.NET

Hola,
tengo problemas aplicando el estilo visual de xp en mis forms
hice la prueba con un form y ello corre perfectamente, de la siguiente manera
--------------
Imports System
Imports System.Drawing
Imports System.Windows.Forms

Namespace VStyles

' Summary description for Form1.
Public Class Form1
Inherits System.Windows.Forms.Form

Private button1 As System.Windows.Forms.Button

<System.STAThread()> _
Public Shared Sub Main()

System.Windows.Forms.Application.EnableVisualStyle s()
System.Windows.Forms.Application.Run(New Form1)
End Sub 'Main

Public Sub New()

Me.button1 = New System.Windows.Forms.Button()
Me.button1.Location = New System.Drawing.Point(24, 16)
Me.button1.Size = New System.Drawing.Size(120, 100)
Me.button1.FlatStyle = FlatStyle.System
Me.button1.Text = "I am themed."

' Sets up how the form should be displayed and adds the controls to the form.
Me.ClientSize = New System.Drawing.Size(300, 286)
Me.Controls.Add(Me.button1)

Me.Text = "Application.EnableVisualStyles Example"
End Sub 'New

End Class 'Form1
End Namespace 'VStyles
--------------------

pero esta vaina no funciona cuando lo aplico a mi codigo que inicia desde un modulo asi:

----------------------------
Imports System
Imports System.Drawing
Imports System.Windows.Forms

Module modPrincipal
Public Sub main()
System.Windows.Forms.Application.EnableVisualStyle s()
Dim ofrmPrincipal As New frmPrincipal
inicializarBD()
ofrmPrincipal.Show()
If FECHAACTUAL <> Now.Today Then
Dim ofrmParametros As New frmParametros
If ofrmParametros.ShowDialog() = DialogResult.Cancel Then
ofrmPrincipal.Close()
Else
Application.Run(ofrmPrincipal)
End If
Else
Application.Run(ofrmPrincipal) ' <-- my code crash here(1)
End If
End Sub
End Module
-------------------

inicia bien la palicacion pero se tira cuando muestro un dialogo y lo ciero, se tira justamente en (1) con la siguiente excepcion

Excepción no controlada del tipo 'System.Runtime.InteropServices.SEHException' en system.windows.forms.dll
Información adicional: Un componente externo inició una excepción.

Alguien sabe como puedo solucionar esto? porfa, estoy con el visual studio .NET 2003