elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  Scroll de Imagenes?
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: 1 [2] 3 4 5 6 7 Ir Abajo Respuesta Imprimir
Autor Tema: Scroll de Imagenes?  (Leído 26,437 veces)
Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.813



Ver Perfil
Re: Scroll de Imagenes?
« Respuesta #10 en: 4 Junio 2013, 14:25 pm »

Esto ya está mejor, aunque la parte "alternativa" no está pulida, la parte "progresiva" está sin bugs:



Código
  1. Public Class Form1
  2.  
  3.    Dim Scroll_Position As Int32 = 0
  4.    Dim Button_Down_Is_Pressed As Boolean = False
  5.    Dim Button_Up_Is_Pressed As Boolean = False
  6.    Dim WithEvents Progressive_Scroll_Timer As New Timer
  7.    Dim SmallChange As Int32 = 10
  8.    Dim Largechange As Int32 = 20
  9.    Dim Maximum As Int64 = 0
  10.  
  11.    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  12.        Panel1.AutoScroll = True
  13.        Maximum = Panel1.VerticalScroll.Maximum
  14.        Panel1.AutoScroll = False
  15.        Panel1.VerticalScroll.Maximum = Maximum / 2
  16.        Progressive_Scroll_Timer.Interval = 50
  17.        Panel1.BackColor = Color.FromArgb(150, 0, 0, 0)
  18.  
  19.        For Each PicBox As PictureBox In Panel1.Controls
  20.            AddHandler PicBox.MouseHover, AddressOf Panel_MouseHover
  21.        Next
  22.  
  23.    End Sub
  24.  
  25.    Private Sub Panel_MouseHover(sender As Object, e As EventArgs) Handles Panel1.MouseHover
  26.        sender.select()
  27.        sender.focus()
  28.    End Sub
  29.  
  30.    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Progressive_Scroll_Timer.Tick
  31.        If Button_Down_Is_Pressed Then
  32.            Scroll_Down(SmallChange)
  33.        ElseIf Button_Up_Is_Pressed Then
  34.            Scroll_Up(SmallChange)
  35.        Else
  36.            sender.stop()
  37.        End If
  38.    End Sub
  39.  
  40.    Private Sub Scroll_Up(ByVal Change As Int32)
  41.        Scroll_Position -= Change
  42.        Try
  43.            Panel1.VerticalScroll.Value = Scroll_Position
  44.        Catch
  45.            Scroll_Position = 0
  46.        End Try
  47.    End Sub
  48.  
  49.    Private Sub Scroll_Down(ByVal Change As Int32)
  50.        Scroll_Position += Change
  51.        Try
  52.            Panel1.VerticalScroll.Value = Scroll_Position
  53.        Catch
  54.            Scroll_Position -= Change
  55.        End Try
  56.    End Sub
  57.  
  58.    Private Sub Button_Down_MouseDown(sender As Object, e As MouseEventArgs) Handles Button2.MouseDown
  59.        If e.Button = Windows.Forms.MouseButtons.Left Then
  60.            Button_Down_Is_Pressed = True
  61.            Progressive_Scroll_Timer.Start()
  62.        End If
  63.    End Sub
  64.  
  65.    Private Sub Button_Up_MouseDown(sender As Object, e As MouseEventArgs) Handles Button1.MouseDown
  66.        If e.Button = Windows.Forms.MouseButtons.Left Then
  67.            Button_Up_Is_Pressed = True
  68.            Progressive_Scroll_Timer.Start()
  69.        End If
  70.    End Sub
  71.  
  72.    Private Sub Button_Down_MouseUp(sender As Object, e As MouseEventArgs) Handles Button2.MouseUp
  73.        Button_Down_Is_Pressed = False
  74.    End Sub
  75.  
  76.    Private Sub Button_Up_MouseUp(sender As Object, e As MouseEventArgs) Handles Button1.MouseUp
  77.        Button_Up_Is_Pressed = False
  78.    End Sub
  79.  
  80.    Private Sub Form_MouseWheel(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Panel1.MouseWheel
  81.        Select Case Math.Sign(e.Delta)
  82.            Case Is > 0 : Scroll_Up(Largechange)
  83.            Case Is < 0 : Scroll_Down(Largechange)
  84.        End Select
  85.    End Sub
  86.  
  87.  
  88.  
  89.    ' Versión alternativa:
  90.    Dim PictureBoxes_Height As Int64 = 100 ' La altura de cada picturebox
  91.  
  92.    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  93.        Scroll_Position -= PictureBoxes_Height
  94.        Try
  95.            Panel1.VerticalScroll.Value = Scroll_Position
  96.        Catch
  97.            Panel1.VerticalScroll.Value = 1
  98.            Scroll_Position += PictureBoxes_Height
  99.        End Try
  100.    End Sub
  101.  
  102.    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  103.        Scroll_Position += PictureBoxes_Height
  104.        Try
  105.            Panel1.VerticalScroll.Value = Scroll_Position
  106.        Catch
  107.  
  108.            Scroll_Position -= PictureBoxes_Height
  109.        End Try
  110.    End Sub
  111.    ' Fin de versión alternativa
  112.  
  113. End Class

Código
  1. Public Class DoubleBufferedPanel
  2.    Inherits Panel
  3.  
  4.    Public Sub New()
  5.        DoubleBuffered = True
  6.        ResumeLayout(False)
  7.    End Sub
  8.  
  9.    Protected Overrides ReadOnly Property CreateParams() As CreateParams
  10.        Get
  11.            Dim cp As CreateParams = MyBase.CreateParams
  12.            cp.ExStyle = cp.ExStyle Or &H2000000
  13.            Return cp
  14.        End Get
  15.    End Property
  16.  
  17. End Class


En línea

z3nth10n


Desconectado Desconectado

Mensajes: 1.583


"Jack of all trades, master of none." - Zenthion


Ver Perfil WWW
Re: Scroll de Imagenes?
« Respuesta #11 en: 5 Junio 2013, 21:15 pm »

Con pulir a que te refieres?

Por cierto, necesito una ultima cosa si no es mucho pedir... Un loop infinito, es decir cuando termine las imagenes vuelve a mostrarse el inicio... Se puede hacer? :silbar:


En línea


Interesados hablad por Discord.
Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.813



Ver Perfil
Re: Scroll de Imagenes?
« Respuesta #12 en: 5 Junio 2013, 21:23 pm »

Con pulir a que te refieres?

Me refería a que no está sin bugs, da un pequeño problema al sobrepasar el tope del margen del scroll hacia arriba o hacia abajo, solo me he preocupado en perfeccionar el scroll progresivo, porque es como a mi me gusta xD.

Por cierto, necesito una ultima cosa si no es mucho pedir... Un loop infinito, es decir cuando termine las imagenes vuelve a mostrarse el inicio... Se puede hacer? :silbar:

Mira, iba a mandarte a la ***** por tanto pedir y que te lo hicieras tu solo, sincéramente xD,
pero me ha gustado la idea del loop infinito, creo que voy a desarrollar un panel heredado desde 0 con lo que ya llevo hecho y le añadiré una propiedad pública que se llame "Loop" para habilitar/deshabilitar el loop del scroll.

Poder, se puede hacer, solo hay que reiniciar los valores del scroll... lo podrías hacer tu mismo.

Salu2!
« Última modificación: 5 Junio 2013, 21:25 pm por EleKtro H@cker » En línea

z3nth10n


Desconectado Desconectado

Mensajes: 1.583


"Jack of all trades, master of none." - Zenthion


Ver Perfil WWW
Re: Scroll de Imagenes?
« Respuesta #13 en: 5 Junio 2013, 21:31 pm »

Ya pero no se.  ;D

PD: Ya se que soy un poco cabroncete. xD
PDS: El scroll de Black lo tiene...  :silbar:

Un saludo y perdon por ser un incordio xD
PDSS:
Te recompensaré con dubstep  >:D
En línea


Interesados hablad por Discord.
Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.813



Ver Perfil
Re: Scroll de Imagenes?
« Respuesta #14 en: 5 Junio 2013, 23:46 pm »

Mi panel extendido tiene una propiedad para activar el "Scroll Loop" (el cual solo funciona con la propiedad AutoScroll activada).

Para hacer un "Scroll Loop" inteligente sin AutoScroll, ya te lo he dicho, resetea los valores del "Me.VerticalScroll.Value" al sobrepasar "X" valor, hazlo como quieras.

Código
  1. '
  2. '  /*               *\
  3. ' |#* Panel Elektro *#|
  4. '  \*               */
  5. '
  6. ' // By Elektro H@cker
  7. '
  8. '   Properties:
  9. '   ...........
  10. ' · Disable_Flickering
  11. ' · Double_Buffer
  12. ' · Opaccity
  13. ' · Scroll_Loop
  14.  
  15. Public Class Panel_Elektro
  16.    Inherits Panel
  17.  
  18.    Private _Opaccity As Int16 = 100
  19.    Private _Diable_Flickering As Boolean = True
  20.    Private _Scroll_Loop As Boolean = False
  21.  
  22.    Dim Scroll_Range As Int64 = 0
  23.  
  24.    Public Sub New()
  25.        Me.Name = "Panel_Elektro"
  26.        ' Me.AutoScroll = True
  27.        ' ResumeLayout(False)
  28.    End Sub
  29.  
  30. #Region " Properties "
  31.  
  32.    ''' <summary>
  33.    ''' Enable/Disable any flickering effect on the panel.
  34.    ''' </summary>
  35.    Protected Overrides ReadOnly Property CreateParams() As CreateParams
  36.        Get
  37.            If _Diable_Flickering Then
  38.                Dim cp As CreateParams = MyBase.CreateParams
  39.                cp.ExStyle = cp.ExStyle Or &H2000000
  40.                Return cp
  41.            Else
  42.                Return MyBase.CreateParams
  43.            End If
  44.        End Get
  45.    End Property
  46.  
  47.    ''' <summary>
  48.    ''' Set the Double Buffer.
  49.    ''' </summary>
  50.    Public Property Double_Buffer() As Boolean
  51.        Get
  52.            Return Me.DoubleBuffered
  53.        End Get
  54.        Set(ByVal Value As Boolean)
  55.            Me.DoubleBuffered = Value
  56.        End Set
  57.    End Property
  58.  
  59.    ''' <summary>
  60.    ''' Set the transparency for this panel.
  61.    ''' </summary>
  62.    Public Property Opaccity() As Short
  63.        Get
  64.            Return _Opaccity
  65.        End Get
  66.        Set(ByVal Value As Short)
  67.            If Value > 100 Then Throw New Exception("Opaccity range is from 0 to 100")
  68.            If Value < 0 Then Throw New Exception("Opaccity range is from 0 to 100")
  69.            Me._Opaccity = Value
  70.            Make_Opaccity(Value, Me.BackColor)
  71.        End Set
  72.    End Property
  73.  
  74.    ''' <summary>
  75.    ''' Enable/Disable the flickering effects on this panel.
  76.    '''
  77.    ''' This property turns off any Flicker effect on the panel
  78.    ''' ...but also reduces the performance (speed) of the panel about 30% slower.
  79.    ''' This don't affect to the performance of the application itself, only to the performance of this control.
  80.    ''' </summary>
  81.    Public Property Diable_Flickering() As Boolean
  82.        Get
  83.            Return _Diable_Flickering
  84.        End Get
  85.        Set(ByVal Value As Boolean)
  86.            Me._Diable_Flickering = Value
  87.        End Set
  88.    End Property
  89.  
  90.    ''' <summary>
  91.    ''' Enable/Disable the scroll loop effect.
  92.    ''' Only when AutoScroll option is set to "True".
  93.    ''' </summary>
  94.    Public Property Scroll_Loop() As Boolean
  95.        Get
  96.            Return _Scroll_Loop
  97.        End Get
  98.        Set(ByVal Value As Boolean)
  99.            Me._Scroll_Loop = Value
  100.        End Set
  101.    End Property
  102.  
  103. #End Region
  104.  
  105. #Region " Event handlers "
  106.  
  107.    ' Scroll
  108.    Private Sub Infinite_Scroll_Button(sender As Object, e As ScrollEventArgs) Handles Me.Scroll
  109.  
  110.        If _Scroll_Loop AndAlso Me.AutoScroll Then
  111.  
  112.            Set_Scroll_Range()
  113.  
  114.            If Me.VerticalScroll.Value >= Scroll_Range - 4 Then ' Button Down
  115.                Me.VerticalScroll.Value = 1
  116.            ElseIf Me.VerticalScroll.Value <= 0 Then ' Button Up
  117.                Me.VerticalScroll.Value = Scroll_Range
  118.            End If
  119.  
  120.        End If
  121.  
  122.    End Sub
  123.  
  124.    ' MouseWheel (Scroll)
  125.    Private Sub Infinite_Scroll_MouseWheel(sender As Object, e As MouseEventArgs) Handles Me.MouseWheel
  126.  
  127.        If _Scroll_Loop AndAlso Me.AutoScroll Then
  128.  
  129.            Set_Scroll_Range()
  130.  
  131.            If e.Delta < 0 AndAlso Me.VerticalScroll.Value >= Scroll_Range - 4 Then ' MouseWheel Down
  132.                Me.VerticalScroll.Value = 1
  133.            ElseIf e.Delta > 0 AndAlso Me.VerticalScroll.Value <= 0 Then ' MouseWheel Up
  134.                Me.VerticalScroll.Value = Scroll_Range
  135.            End If
  136.  
  137.        End If
  138.  
  139.    End Sub
  140.  
  141. #End Region
  142.  
  143. #Region " Methods / Functions "
  144.  
  145.    ''' <summary>
  146.    ''' Changes the transparency of this panel.
  147.    ''' </summary>
  148.    Private Sub Make_Opaccity(ByVal Percent As Short, ByVal colour As Color)
  149.        Me.BackColor = Color.FromArgb(Percent * 255 / 100, colour.R, colour.G, colour.B)
  150.    End Sub
  151.  
  152.    ''' <summary>
  153.    ''' Set the VerticalScrollBar Range.
  154.    ''' </summary>
  155.    Private Sub Set_Scroll_Range()
  156.        Scroll_Range = Me.VerticalScroll.Maximum - Me.VerticalScroll.LargeChange + Me.VerticalScroll.SmallChange
  157.    End Sub
  158.  
  159. #End Region
  160.  
  161. End Class
« Última modificación: 6 Junio 2013, 02:26 am por EleKtro H@cker » En línea

BlackM4ster


Desconectado Desconectado

Mensajes: 499


Error, el teclado no funciona. Pulse F1 para continuar


Ver Perfil WWW
Re: Scroll de Imagenes?
« Respuesta #15 en: 6 Junio 2013, 17:58 pm »

Con pulir a que te refieres?

Por cierto, necesito una ultima cosa si no es mucho pedir... Un loop infinito, es decir cuando termine las imagenes vuelve a mostrarse el inicio... Se puede hacer? :silbar:

Oye, mi código ya hace eso...  :-\
En línea

- Pásate por mi web -
https://codeisc.com
z3nth10n


Desconectado Desconectado

Mensajes: 1.583


"Jack of all trades, master of none." - Zenthion


Ver Perfil WWW
Re: Scroll de Imagenes?
« Respuesta #16 en: 6 Junio 2013, 18:51 pm »

Ya lo sé, no te mosquees, voy a probar los dos y el que más me guste me lo quedo.. xD

Por cierto, ayudame con lo del botón y ya está. :P

El code de leer los inis ya lo tienes  :silbar:
En línea


Interesados hablad por Discord.
BlackM4ster


Desconectado Desconectado

Mensajes: 499


Error, el teclado no funciona. Pulse F1 para continuar


Ver Perfil WWW
Re: Scroll de Imagenes?
« Respuesta #17 en: 6 Junio 2013, 18:55 pm »

Ya lo sé, no te mosquees, voy a probar los dos y el que más me guste me lo quedo.. xD

Por cierto, ayudame con lo del botón y ya está. :P

El code de leer los inis ya lo tienes  :silbar:

El modulo que lee inis si lo tengo, el source del boton ya te lo pasé
Skype
En línea

- Pásate por mi web -
https://codeisc.com
z3nth10n


Desconectado Desconectado

Mensajes: 1.583


"Jack of all trades, master of none." - Zenthion


Ver Perfil WWW
Re: Scroll de Imagenes?
« Respuesta #18 en: 6 Junio 2013, 21:55 pm »

Okeys, ehm, tengo un problemi, y es que no se adaptar tu code del infiloop... Si fueras tan amable de decirme mañana como es... Gracias! :D

PD: Ya he estado probando, pero ahora el scroll no baja, por no decir que aun ni le he puesto el infiloop xD
« Última modificación: 7 Junio 2013, 07:54 am por Ikillnukes » En línea


Interesados hablad por Discord.
z3nth10n


Desconectado Desconectado

Mensajes: 1.583


"Jack of all trades, master of none." - Zenthion


Ver Perfil WWW
Re: Scroll de Imagenes?
« Respuesta #19 en: 9 Junio 2013, 19:27 pm »

A ver aquí dejo un vídeo mostrando lo que me pasa con el Scroll



Si necesitas el proyecto Elektro por MP te lo mando. ;)
En línea


Interesados hablad por Discord.
Páginas: 1 [2] 3 4 5 6 7 Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Scroll
Programación Visual Basic
Piojoman 0 1,558 Último mensaje 20 Octubre 2005, 16:56 pm
por Piojoman
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines