Visual Basic.NET - SKINS PARA LA APLICACIOn

 
Vista:

SKINS PARA LA APLICACIOn

Publicado por Polospos (1 intervención) el 13/08/2007 14:55:55
Me gustaria saber como poner un skins en mi aplicacion de visual basic. net.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

RE:SKINS PARA LA APLICACIOn

Publicado por P. J. (706 intervenciones) el 13/08/2007 16:36:50
Copia esta clase y guardala.

Public Class Skin

Dim imagen As Image
Public Sub setSkin(ByVal nom$)
imagen = Bitmap.FromFile(path() + nom)
End Sub

Public Property imagenes() As Image
Get
Return imagen
End Get
Set(ByVal Value As Image)
imagen = Value
End Set
End Property

Public Function ObtenerRegionDelBitmap(ByVal MiImagen As Bitmap, ByVal ColorTransparente As Color) As Region
Dim RegionLocal As Region

Dim ColorDeFondo As Color = ColorTransparente

Dim Largo As Integer = MiImagen.Height - 1
Dim Ancho As Integer = MiImagen.Width

Dim Fila As Integer
Dim Columna As Integer

RegionLocal = New Region(New Rectangle(0, 0, 0, 0))

For Fila = 0 To Largo
Dim ColumnaComienzo As Integer = -1
Dim ColumnaFin As Integer = -1

For Columna = 0 To Ancho
If Columna = Ancho Then
If ColumnaComienzo <> -1 Then
ColumnaFin = Columna

Dim regUnion As New Region(New Rectangle(ColumnaComienzo, Fila, ColumnaFin - ColumnaComienzo, 1))
RegionLocal.Union(regUnion)
regUnion = Nothing
End If
Else
If Not MiImagen.GetPixel(Columna, Fila).Equals(ColorDeFondo) Then
If ColumnaComienzo = -1 Then ColumnaComienzo = Columna
ElseIf MiImagen.GetPixel(Columna, Fila).Equals(ColorDeFondo) Then
If ColumnaComienzo <> -1 Then
ColumnaFin = Columna

Dim regUnion As New Region(New Rectangle(ColumnaComienzo, Fila, ColumnaFin - ColumnaComienzo, 1))
RegionLocal.Union(regUnion)
regUnion = Nothing

ColumnaComienzo = -1
ColumnaFin = -1
End If
End If
End If
Next
Next
Return RegionLocal
End Function
End Class
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Y ASI USAS LA CLASE

Publicado por P. J. (706 intervenciones) el 13/08/2007 16:43:04
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dim fondo as New Skin
fondo.setSkin("Mascara\login02.bmp")
Me.BackgroundImage = fondo.imagenes
Me.Height = fondo.imagenes.Height
Me.Width = fondo.imagenes.Width
Dim mibitmap As Bitmap = CType(fondo.imagenes, Bitmap)
Me.Region = fondo.ObtenerRegionDelBitmap(mibitmap, mibitmap.GetPixel(0, 0))
End Sub

Asi funciona la clase, y tendras tu formulario de la forma de la imagen.
Ahora, disculpa si la clase te bota un error, es que me faltaba un metodo (es que esto lo use en un sistema y estaba separado por varios motivos. )
Agrega esta funcion a la clase:

private Function path() As String
Dim ruta As String = IO.Path.GetDirectoryName (GetExecutingAssembly.GetCallingAssembly.Location)
ruta &= "\"
Return ruta
End Function

Y porsiaca importa:
Imports System.Reflection.Assembly
Imports System.IO

Disculpa si esta algo desordenado, ojala me hayas entendido, suerte !
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar