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

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 ... 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 [870] 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 ... 1236
8691  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 28 Junio 2013, 17:03 pm
A ti te dejan doble postear? >:(

No lo considero doble-postear, posteo cuando tengo un nuevo snippet o una cantidad de snippets, a veces me los creo/consigo de 1 en 1 o de 5 en 5, nunca se sabe...

PD: A mi no me trollees xD



¿En la del listview no se puede hacer listview.items.indexof("txt")? ¿o utiliza algún tipo de encapsulación distinta al string cada item?

El ...IndexOf("text") rquiere pasarle un "ListiewItem", no he podido pasarle un string para probar.

PD: A ver si consigues mejorarlo tu :P

un saludo!
8692  Programación / .NET (C#, VB.NET, ASP) / Re: Dar margin a un texto dentro de un TextBox? en: 28 Junio 2013, 16:55 pm
Pero que no quiero alinear nada... además si se pudiese alinear verticalmente como en los Labeles... :P

pues prueba a hacerlo multiline y le añades un vbnewline y luego el texto

EDITO: O mejor aún... adapta el tamaño del textbox al tamaño de la fuente, y listo.
8693  Programación / .NET (C#, VB.NET, ASP) / Re: Dar margin a un texto dentro de un TextBox? en: 28 Junio 2013, 16:49 pm
Como ves donde está el texto que pone mi nombre, está muy pegado al borde del TextBox, por no decir que está junto. ;)
Eso quiero separarlo. :P

. . .

Lee las propiedades del textbox, pero no busques por "margen" sinó por "alinear"

Edito: También influye en el margen que tipo de borde estés usando "borderstyle", y bueno... el margen opcional se lo puedes añadir con espacios.

saludos!
8694  Programación / .NET (C#, VB.NET, ASP) / Re: Dar margin a un texto dentro de un TextBox? en: 28 Junio 2013, 16:31 pm
Dar margin a un texto dentro de un TextBox?

puedes explicarlo mejor? que tipo de margen? algun ejemplo de como es tu texto y como debería ser? ...
8695  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 28 Junio 2013, 16:30 pm
[Textbox] Show end part of text

Este snippet no se muy bien como explicarlo en pocas palabras, así que lo voy a explicar con imágenes...

Cuando excedemos el límite visible del textbox, la parte del final, es decir la parte derecha no se muestra:



Pues con este snippet omitiremos la parte de la izquierda, mostrando hasta la parte final del texto:



Código
  1.    Private Sub TextBox_TextChanged(sender As Object, e As EventArgs) _
  2.    Handles TextBox1.TextChanged
  3.  
  4.        ' If the text reaches the writable box size then this shows the end part of the text.                                                          
  5.        sender.Select(sender.TextLength, sender.TextLength)
  6.  
  7.    End Sub

Saludos!
8696  Programación / .NET (C#, VB.NET, ASP) / Re: Insertar <Script> en VB.NET en: 28 Junio 2013, 16:18 pm
Añado: Además lo del html 5 solo funcionará si en el equipo se dispone de iexplorer 9 o superior (creo que el soporte para HTML 5 empezaba desde la versión ie9, corregirme si me equivoco).

EDITO: sería más factible hardcodearlo, ¿no?, un par de trackbars y de botones, y listo!

Saludos!
8697  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 28 Junio 2013, 12:34 pm
Función para comprobar si un ListView contiene cierto texto:

PD: La verdad es que no es muy útil a menos que le añada más opciones, la hice porque muchas veces se me olvida el nombre del método "FindItemWithText" y eso me hace perder tiempo :silbar:

Código
  1. #Region " Find ListView Text "
  2.  
  3.    ' [ Find ListView Text Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    ' MsgBox(Find_ListView_Text(ListView1, "Hello"))
  9.    ' If Find_ListView_Text(ListView1, "Hello") Then...
  10.  
  11.    Private Function Find_ListView_Text(ByVal ListView As ListView, ByVal Text As String) As Boolean
  12.        Try : Return Convert.ToBoolean(ListView.FindItemWithText(Text)) : Catch : Return True : End Try
  13.    End Function
  14.  
  15. #End Region

Ejemplo de uso:

Código
  1.    Private Sub Status_Timer_Tick(sender As Object, e As EventArgs) Handles Status_Timer.Tick
  2.  
  3.        If Find_ListView_Text(ListView1, TextBox_Filename.Text) Then
  4.            Label_Status.Text = "Current song found"
  5.        Else
  6.            Label_Status.Text = "Current song not found"
  7.        End If
  8.  
  9.    End Sub
8698  Programación / .NET (C#, VB.NET, ASP) / Re: Hook global para los Windows Messages? en: 28 Junio 2013, 11:06 am
@Maurice_Lupin

Gracias, ya no recordaba que hice esta pregunta xD

Al final ya lo conseguí, conseguí usar la API para capturar si la rueda que se mueve es la de arriba o la de abajo, lo que no conseguí era una vez capturado, reproducir ese movimiento del ratón fuera de la APP, es decir mover la rueda del ratón, así que lo dejé a medias.

Bueno,
un saludo!
8699  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 27 Junio 2013, 17:20 pm
Hoy pensé en añadir la funcionalidad de seleccionar todo el texto haciendo triple click sobre un textbox... y he dado con este snippet: http://www.codeproject.com/Articles/23498/A-Simple-Method-for-Handling-Multiple-Clicking-on

Es un contador de clicks, así que se puede utilizar como Triple-Click, o Cuadruple-Click o lo que quieran... xD

Código
  1. Public Class Form1
  2.  
  3. #Region " Mouse-Click Count "
  4.  
  5.    ''' <summary>
  6.    ''' The Click-Timer area bounds.
  7.    ''' </summary>
  8.    ''' <remarks></remarks>
  9.    Private ClickArea As Rectangle
  10.  
  11.    ''' <summary>
  12.    ''' The mouse button clicked.
  13.    ''' </summary>
  14.    ''' <remarks></remarks>
  15.    Private ClickButton As MouseButtons
  16.  
  17.    ''' <summary>
  18.    ''' Accumulate clicks for the Click-Timer.
  19.    ''' </summary>
  20.    ''' <remarks></remarks>
  21.    Private ClickCount As Int32
  22.  
  23.    ''' <summary>
  24.    ''' Save the Click-Timer double-click delay time (ms).
  25.    ''' </summary>
  26.    ''' <remarks></remarks>
  27.    Private ClickDelay As Int32 = SystemInformation.DoubleClickTime
  28.  
  29.    ''' <summary>
  30.    ''' String description of the appropriate owner of the Click-Timer expiry event.
  31.    ''' </summary>
  32.    ''' <remarks></remarks>
  33.    Private ClickOwner As String = ""
  34.  
  35.    ''' <summary>
  36.    ''' Save the Click-Timer double-click area bounds.
  37.    ''' </summary>
  38.    ''' <remarks></remarks>
  39.    Private ClickSize As Size = SystemInformation.DoubleClickSize
  40.  
  41.    ''' <summary>
  42.    ''' Create a new Click-Timer with events.
  43.    ''' </summary>
  44.    ''' <remarks></remarks>
  45.    Private WithEvents ClickTimer As New Timer
  46.  
  47.    ''' <summary>
  48.    ''' Click-Timer "Tick" event handler.
  49.    ''' </summary>
  50.    ''' <param name="sender">Event object owner.</param>
  51.    ''' <param name="e">Event arguments.</param>
  52.    ''' <remarks></remarks>
  53.    Private Sub ClickTimer_TickHandler(ByVal sender As Object, ByVal e As EventArgs) Handles ClickTimer.Tick
  54.        Me.ClickTimer.Stop()
  55.        Me.ClickCount = 0
  56.    End Sub
  57.  
  58.    ''' <summary>
  59.    ''' Initialise the Click-Timer with Owner and valid double-click area.
  60.    ''' </summary>
  61.    ''' <param name="aOwnerControl">Click-Timer owner control (string).</param>
  62.    ''' <param name="aMouseButton">Mouse button clicked.</param>
  63.    ''' <param name="aClickPoint">Click point for definition of the valid double-click area.</param>
  64.    ''' <remarks></remarks>
  65.    Private Sub ClickTimer_Initialise(ByVal aOwnerControl As String, _
  66.                                      ByVal aMouseButton As MouseButtons, _
  67.                                      ByVal aClickPoint As Point)
  68.  
  69.        ' Stop the Click-Timer.
  70.        Me.ClickTimer.Stop()
  71.        ' Save the owner control text.
  72.        Me.ClickOwner = aOwnerControl
  73.        ' Save the mouse button.
  74.        Me.ClickButton = aMouseButton
  75.        ' This is the first click.
  76.        Me.ClickCount = 1
  77.        ' Define the valid double-click area for any multi-clicking.
  78.        Me.ClickArea = New Rectangle _
  79.              (aClickPoint.X - Me.ClickSize.Width \ 2 _
  80.              , aClickPoint.Y - Me.ClickSize.Height \ 2 _
  81.              , Me.ClickSize.Width, Me.ClickSize.Height)
  82.        ' Set the system default double-click delay.
  83.        Me.ClickTimer.Interval = Me.ClickDelay
  84.        ' Start the Click-Timer.
  85.        Me.ClickTimer.Start()
  86.  
  87.    End Sub
  88.  
  89.    ''' <summary>
  90.    ''' Register a mouse click (or double click) event.
  91.    ''' </summary>
  92.    ''' <param name="aOwnerControl">Click-Timer owner control (string).</param>
  93.    ''' <param name="aMouseButton">Mouse button clicked.</param>
  94.    ''' <param name="aClickPoint">Click point for definition of the valid double-click area.</param>
  95.    ''' <remarks></remarks>
  96.    Private Sub ClickTimer_Click(ByVal aOwnerControl As String, _
  97.                                 ByVal aMouseButton As MouseButtons, _
  98.                                 ByVal aClickPoint As Point)
  99.  
  100.        ' Handle this click event.
  101.        If Me.ClickTimer.Enabled Then
  102.            ' The Click-Timer is going, stop it and check we haven't changed controls.
  103.            Me.ClickTimer.Stop()
  104.            If Me.ClickOwner = aOwnerControl _
  105.            AndAlso Me.ClickButton = aMouseButton _
  106.            AndAlso Me.ClickArea.Contains(aClickPoint) Then
  107.                ' Working with the same control, same button within a valid double-click area so bump the count.
  108.                Me.ClickCount += 1
  109.                ' Set the system default double-click delay.
  110.                Me.ClickTimer.Interval = Me.ClickDelay
  111.                ' Start the Click-Timer.
  112.                Me.ClickTimer.Start()
  113.            Else
  114.                ' Not working with the same control. Initialise the Click-Timer.
  115.                Me.ClickTimer_Initialise(aOwnerControl, aMouseButton, aClickPoint)
  116.            End If
  117.        Else
  118.            ' The timer is not enabled. Initialise the Click-Timer.
  119.            Me.ClickTimer_Initialise(aOwnerControl, aMouseButton, aClickPoint)
  120.        End If
  121.  
  122.    End Sub
  123.  
  124. #End Region
  125.  
  126.    Private Sub TextBox1_Clicked(ByVal sender As Object, ByVal e As MouseEventArgs) _
  127.    Handles TextBox1.MouseClick, TextBox1.MouseDoubleClick
  128.  
  129.        Me.ClickTimer_Click(sender.name, e.Button, e.Location)
  130.  
  131.        If ClickCount = 3 Then ' Triple Click to select all text.
  132.            sender.SelectAll()
  133.        End If
  134.  
  135.    End Sub
  136.  
  137. End Class

Saludos.
8700  Programación / Programación General / Re: [?]Crear un programa que piense por si mismo? en: 27 Junio 2013, 16:28 pm
¿Quién sabe si en unos 50 años crearán a Terminator (Lol)?

Cada 12 o 14 meses se duplica el potencial de la tecnología, pero no nos engañemos... la humanidad solo creará robots para esto:

     

:D
Páginas: 1 ... 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 [870] 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines