Ver Mensaje Individual
  #2 (permalink)  
Antiguo 07/06/2006, 03:01
Avatar de victoryiyo
victoryiyo
 
Fecha de Ingreso: mayo-2006
Mensajes: 187
Antigüedad: 18 años
Puntos: 0
Imports System.Drawing.Drawing2D
Imports System.Drawing
Public Class Form1
Dim x As Boolean
Private Const WM_SYSCOMMAND As Integer = &H112&
Private Const MOUSE_MOVE As Integer = &HF012&
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'objeto Bitmap para contener la imagen que se usa de fondo del formulario
Me.Panel1.Hide()
Me.Panel2.Hide()
Dim bmp As Bitmap
bmp = New Bitmap(Application.StartupPath & "\fondo_htgas_prueba.bmp")
'el color del pixel(1,1) (esquina sup. izda.) del Bitmap será renderizado
'como transparente en el Bitmap (color RGB 255,0,0)
bmp.MakeTransparent(bmp.GetPixel(1, 1))
'colocar el Bitmap como fondo del formulario
Me.BackgroundImage = bmp
'el color del pixel(1,1) (esquina sup. izda.) del Bitmap será renderizado
'como transparente también en el formulario (color RGB 255,0,0)
Me.TransparencyKey = bmp.GetPixel(1, 1)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub

'Declaraciones de Api al estilo api
<System.Runtime.InteropServices.DllImport("user32. DLL", EntryPoint:="ReleaseCapture")> _
Private Shared Sub ReleaseCapture()
End Sub
'
<System.Runtime.InteropServices.DllImport("user32. DLL", EntryPoint:="SendMessage")> _
Private Shared Sub SendMessage(ByVal hWnd As System.IntPtr, ByVal wMsg As Integer, _
ByVal wParam As Integer, ByVal lParam As Integer)
End Sub
'
' función privada usada para mover el formulario actual
Private Sub moverForm()
ReleaseCapture()
SendMessage(Me.Handle, WM_SYSCOMMAND, MOUSE_MOVE, 0)
End Sub

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove, Panel1.MouseMove, Panel2.MouseMove, Button2.MouseMove, Button3.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
moverForm()
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

'Me.Panel2.Visible = False
With Me.Panel1
.BackColor = Color.Aqua
.Show()
'.Visible = True
End With
Me.Panel2.Hide()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

'Me.Panel1.Visible = False
With Me.Panel2
.BackColor = Color.Plum
.Show()
'.Visible = True
End With
Me.Panel1.Hide()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.Close()
End Sub
End Class

Esto lo hago con visual 2005.
Espero que te funcione.