elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Ingresar Registrarse
05 Septiembre 2008, 16:25  



+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (Moderadores: BADBYTE-K, hadess_inf)
| | | |-+  {RUTINA} Arrastrar Controles VB 2008
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Imprimir
Autor Tema: {RUTINA} Arrastrar Controles VB 2008  (Leído 344 veces)
ActiveSheet

Desconectado Desconectado

Mensajes: 383


Feeling Jazz


Ver Perfil WWW
{RUTINA} Arrastrar Controles VB 2008
« en: 22 Agosto 2007, 08:27 »

Esta rutina es para arrastrar y redimenzionar contrles en tiempo de ejecucion
para el VB 2008

para redimenzionar con el boton derecho

Código
Friend Class MoverControles
   Inherits System.Windows.Forms.Form
 
   Private DX, DY As Integer
   Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer) As Integer
   Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
   Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, _
   ByVal X As Integer, ByVal Y As Integer, ByVal cX As Integer, ByVal cY As Integer, ByVal wFlags As Integer) As Integer
 
   Const GWL_STYLE As Integer = (-16)
   Const WS_THICKFRAME As Integer = &H40000
   Const SWP_DRAWFRAME As Integer = &H20
   Const SWP_NOMOVE As Integer = &H2
   Const SWP_NOSIZE As Integer = &H1
   Const SWP_NOZORDER As Integer = &H4
   Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
       AsignarEventos(Me)
 
   End Sub
   Private Sub Control_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
       DX = e.X
       DY = e.Y
       If e.Button = MouseButtons.Right Then
           CambiarEstilo(CType(sender, Control))
       Else
           CType(sender, Control).BringToFront()
       End If
   End Sub
   Private Sub Control_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
       If e.Button = MouseButtons.Left Then
           CType(sender, Control).Left = e.X + CType(sender, Control).Left - DX
           CType(sender, Control).Top = e.Y + CType(sender, Control).Top - DY
       End If
   End Sub
   Private Sub AsignarEventos(ByVal elControl As Control)
       Dim ctrl As Control
       For Each ctrl In elControl.Controls
           If ctrl.Name <> "cmdAlgo" And ctrl.Name <> "txtControl1" And ctrl.Name <> "txtControl1" Then ' aqui vaz agregando los controles que quieres estaticos y no redimensionables
               AddHandler ctrl.MouseDown, AddressOf Me.Control_MouseDown
               AddHandler ctrl.MouseMove, AddressOf Me.Control_MouseMove
               AsignarEventos(ctrl)
           End If
       Next
   End Sub
   Private Sub CambiarEstilo(ByVal aControl As Control)
       Dim Style As Integer
       Try
           Style = GetWindowLong(aControl.Handle.ToInt32, GWL_STYLE)
           If (Style And WS_THICKFRAME) = WS_THICKFRAME Then
               Style = Style Xor WS_THICKFRAME
           Else
               Style = Style Or WS_THICKFRAME
           End If
           SetWindowLong(aControl.Handle.ToInt32, GWL_STYLE, Style)
           SetWindowPos(aControl.Handle.ToInt32, Me.Handle.ToInt32, 0, 0, 0, 0, SWP_NOZORDER Or SWP_NOSIZE Or SWP_NOMOVE Or SWP_DRAWFRAME)
       Catch
       End Try
   End Sub
End Class
« Última modificación: 22 Agosto 2007, 12:58 por ActiveSheet » En línea

MANULOMM

Desconectado Desconectado

Mensajes: 265



Ver Perfil
Re: {RUTINA} Arrastrar Controles VB 2008
« Respuesta #1 en: 25 Agosto 2007, 06:20 »

esto va en .net... no en vb6.0.....  :-X :-X :-X

Atentamente,


Juan Manuel Lombana
Medellín - Colombia
En línea



ActiveSheet

Desconectado Desconectado

Mensajes: 383


Feeling Jazz


Ver Perfil WWW
Re: {RUTINA} Arrastrar Controles VB 2008
« Respuesta #2 en: 25 Agosto 2007, 06:38 »

y el foro de VB 2008?
En línea

robbie110487

Conectado Conectado

Mensajes: 91


Ver Perfil
Re: {RUTINA} Arrastrar Controles VB 2008
« Respuesta #3 en: 25 Agosto 2007, 09:12 »

Desde Visual Basic 7.0, 2003, 2005 y ahora el 2008 usan la tecnologia .NET...

http://es.wikipedia.org/wiki/Visual_Basic.NET   ;D

Saludos
« Última modificación: 25 Agosto 2007, 09:15 por robbie110487 » En línea
Páginas: [1] Ir Arriba Imprimir 
Ir a:  







Consolas     La Web de Goku     MilW0rm     MundoDivx

Hispabyte     Truzone     TodoReviews     ZonaPhotoshop

hard-h2o modding    Foros de ayuda    Yashira.org    Videojuegos    indetectables.net   

Noticias Informatica    Seguridad Informática    ADSL    Foros en español    eNYe Sec

Todas las webs afiliadas están libres de publicidad engañosa.

Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC