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


Tema destacado: Security Series.XSS. [Cross Site Scripting]


  Mostrar Mensajes
Páginas: 1 ... 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 [812] 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 ... 1254
8111  Programación / .NET (C#, VB.NET, ASP) / Re: Proyecto GamesRec 8 meses despues [Dev version,prox Alpha1] en: 22 Octubre 2013, 16:05 pm
He crackeado algunos programas hechos con .NET. Entre ellos, uno cifrado con Crypto

Perdón si meto la pata pero no te habrás confundido con el "SmartAssembly" (que también es de los mejores) en lugar del "Crypto"?

Lo comento porque hasta donde yo sé el SAE no tiene plugin para deofuscar un ensamblado de Crypto, o al menos no disponen de dicho plugin en la página oficial, pero de todas formas no he intentado deofuscar un exe del Crypto en el SAE.

PD: Si dispones de dicho plugin o sabes de alguna página donde lo hosteen estaría muy bien que compartas esa información.

Un saludo!
8112  Foros Generales / Sugerencias y dudas sobre el Foro / Re: Ataque al foro? en: 22 Octubre 2013, 15:52 pm
Para dejar constancia, yo accedo desde España (Valencia), y uso ONO.

El resto de páginas me funcionan perféctamente menos el foro de EHN  :-(

Se puede decir que la página ya lleva medio dia tirando a duras penas, es insoportable, creo que hasta la noche ya no volveré a conectarme para ver si se ha resuelto el problema.

Saludos!
8113  Foros Generales / Sugerencias y dudas sobre el Foro / Re: Ataque al foro? en: 22 Octubre 2013, 13:17 pm
Pues si algunos estamos sufriendo esta insoportable lentitud pero a otros como Songoku le va rápido la navegación pues... entonces ¿Que está pasando aquí? xD

Saludos!
8114  Foros Generales / Sugerencias y dudas sobre el Foro / Ataque al foro? en: 22 Octubre 2013, 12:21 pm
Hola

Me da la sensación de que le están haciendo un DDOS a la página de elhacker.net, lleva unas 3 o 4 horas mínimo que la navegación funciona lentísima en el foro, acceder a una url cuesta entre 5-10 minutos de espera.

Me pregunto si este individuo (por llamarlo de alguna manera) que atacó la página hace relatívamente poco tendrá algo que ver en el asunto... -> Inzect02

http://foro.elhacker.net/sugerencias_y_dudas_sobre_el_foro/problemas_de_acceso_al_foro-t399535.0.html;msg1889627#msg1889627

Solo lo comento para que no os olvideis de un posible culpable ;)

Un saludo!
8115  Programación / .NET (C#, VB.NET, ASP) / Re: [Duda] Registro con password. en: 22 Octubre 2013, 08:24 am
Creo que la época de manejar contraseñas desde archivos de texto ya quedó muy en el pasado :-/

¿No te parece mejor usar el registro?

1. El user escribe por primera vez el password en la UI
2. Escribes ese password en un valor del registro. ("HKCU\Software\Tu Programa" "Pass" "String") y si quieres le metes un sencillo Base64, o algo mucho más compejo.
3. Al siguiente inicio de la aplicación verificas si existe el valor, y lo lees.

Saludos!
8116  Foros Generales / Dudas Generales / Re: ayuda a traducir programa o archivo lang_en.ini a español en: 22 Octubre 2013, 08:19 am
No creo que nadie esté por la labor de traducirte 381 líneas para un programa que ni sabemos cual es ni tampcoo vamos a usar.

Esto es abusar demasiado de la confianza de los demás, ¿no crees?

Para tus dudas sobre el léxico Inglés -> English Language Learners

Saludos!
8117  Foros Generales / Dudas Generales / Re: problema con eventos keypress en c# en: 21 Octubre 2013, 21:12 pm
quiero hacer que todos los eventos keypress los maneje el form

No hay quien lo entienda :-/

Imagino que lo que pretendes decir es que TÚ quieres manejar el evento KeyPress para filtrar las Keys que se deben escribir y las que no...

Leí que tengo que poner en true la propiedad KeyPressEventArgs.Handled

Así es, "False" para escribir la tecla pulsada, y "True" para omitirla.

Es algo muy sencillo, pero yo no manejo C#, aquí puedes ver un ejemplo para C#: http://msdn.microsoft.com/en-us/library/system.windows.forms.keypresseventargs.handled.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2

PD: Porfavor muevan esto al subforo de .NET
8118  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 21 Octubre 2013, 19:29 pm
Le he hecho una revisión de código a un ListView extendio que ya compartí hace tiempo, le he añadido la ProgressBar que he comentado más arriba, no lo he testeado mucho pero parece que todo funciona como debe funcionar,
que lo disfruteis!

Código
  1. '  /*                  *\
  2. ' |#* ListView Elektro *#|
  3. '  \*                  */
  4. '
  5. ' // By Elektro H@cker
  6. '
  7. '   Properties:
  8. '   ...........
  9. ' · Disable_Flickering
  10. ' · Double_Buffer
  11. ' · GridLineColor
  12. ' · ItemHighlightColor
  13. ' · ItemNotFocusedHighlighColor
  14. ' · DrawCustomGridLines
  15. ' · UseDefaultGridLines
  16. ' · Enable_ProgressBar
  17. ' · Progressbar_Column
  18. ' · Percent
  19. ' · Percent_Decimal
  20. ' · Percent_Font
  21. ' · Percent_Text
  22. ' · Percent_Forecolor
  23. ' · Percent_Text_Allignment
  24. ' · ProgressBar_BackColor
  25. ' · ProgressBar_BorderColor
  26. ' · ProgressBar_FillColor1
  27. ' · ProgressBar_FillColor2
  28. '
  29. '   Events:
  30. '   .......
  31. ' · ItemAdded
  32. ' · ItemRemoved
  33. '
  34. '   Methods:
  35. '   .......
  36. ' · AddItem
  37. ' · RemoveItem
  38.  
  39. Public Class ListView_Elektro : Inherits ListView
  40.  
  41.    Public Event ItemAdded()
  42.    Public Event ItemRemoved()
  43.  
  44.    Private _Disable_Flickering As Boolean = True
  45.    Private _gridLines As Boolean = False
  46.    Private _useDefaultGridLines As Boolean = False
  47.    Private _gridLineColor As Color = Color.Black
  48.    Private _itemHighlightColor As Color = Color.FromKnownColor(KnownColor.Highlight)
  49.    Private _itemNotFocusedHighlighColor As Color = Color.FromKnownColor(KnownColor.MenuBar)
  50.  
  51.    Private _enable_progressbar As Boolean = False
  52.    Private _progressbar_column As Integer = Nothing
  53.  
  54.    Private _percent As Double = 0
  55.    Private _percent_decimal As Short = 2
  56.    Private _percent_text As String = "%"
  57.    Private _percent_text_allignment As StringAlignment = StringAlignment.Center
  58.    Private _percent_stringformat As StringFormat = New StringFormat With {.Alignment = _percent_text_allignment}
  59.    Private _percent_font As Font = Me.Font
  60.    Private _percent_forecolor As SolidBrush = New SolidBrush(Color.Black)
  61.  
  62.    Private _progressBar_backcolor As SolidBrush = New SolidBrush(Color.Red)
  63.    Private _progressBar_bordercolor As Pen = New Pen(Color.LightGray)
  64.    Private _progressBar_fillcolor1 As Color = Color.YellowGreen
  65.    Private _progressBar_fillcolor2 As Color = Color.White
  66.  
  67.    Public Sub New()
  68.  
  69.        Me.Name = "ListView_Elektro"
  70.        Me.DoubleBuffered = True
  71.        Me.UseDefaultGridLines = True
  72.  
  73.        ' Set Listview OwnerDraw to True, so we can draw the progressbar inside.
  74.        If Me.Enable_ProgressBar Then Me.OwnerDraw = True
  75.  
  76.        ' Me.GridLines = True
  77.        ' Me.MultiSelect = True
  78.        ' Me.FullRowSelect = True
  79.        ' Me.View = View.Details
  80.  
  81.    End Sub
  82.  
  83. #Region " Properties "
  84.  
  85.    ''' <summary>
  86.    ''' Enable/Disable any flickering effect on the ListView.
  87.    ''' </summary>
  88.    Protected Overrides ReadOnly Property CreateParams() As CreateParams
  89.        Get
  90.            If _Disable_Flickering Then
  91.                Dim cp As CreateParams = MyBase.CreateParams
  92.                cp.ExStyle = cp.ExStyle Or &H2000000
  93.                Return cp
  94.            Else
  95.                Return MyBase.CreateParams
  96.            End If
  97.        End Get
  98.    End Property
  99.  
  100.    ''' <summary>
  101.    ''' Set the Double Buffer.
  102.    ''' </summary>
  103.    Public Property Double_Buffer() As Boolean
  104.        Get
  105.            Return Me.DoubleBuffered
  106.        End Get
  107.        Set(ByVal Value As Boolean)
  108.            Me.DoubleBuffered = Value
  109.        End Set
  110.    End Property
  111.  
  112.    ''' <summary>
  113.    ''' Enable/Disable the flickering effects on this ListView.
  114.    '''
  115.    ''' This property turns off any Flicker effect on the ListView
  116.    ''' ...but also reduces the performance (speed) of the ListView about 30% slower.
  117.    ''' This don't affect to the performance of the application itself, only to the performance of this control.
  118.    ''' </summary>
  119.    Public Property Disable_Flickering() As Boolean
  120.        Get
  121.            Return _Disable_Flickering
  122.        End Get
  123.        Set(ByVal Value As Boolean)
  124.            Me._Disable_Flickering = Value
  125.        End Set
  126.    End Property
  127.  
  128.    ''' <summary>
  129.    ''' Changes the gridline color.
  130.    ''' </summary>
  131.    Public Property GridLineColor() As Color
  132.        Get
  133.            Return _gridLineColor
  134.        End Get
  135.        Set(ByVal value As Color)
  136.            If value <> _gridLineColor Then
  137.                _gridLineColor = value
  138.                If _gridLines Then
  139.                    Me.Invalidate()
  140.                End If
  141.            End If
  142.        End Set
  143.    End Property
  144.  
  145.    ''' <summary>
  146.    ''' Changes the color when item is highlighted.
  147.    ''' </summary>
  148.    Public Property ItemHighlightColor() As Color
  149.        Get
  150.            Return _itemHighlightColor
  151.        End Get
  152.        Set(ByVal value As Color)
  153.            If value <> _itemHighlightColor Then
  154.                _itemHighlightColor = value
  155.                Me.Invalidate()
  156.            End If
  157.        End Set
  158.    End Property
  159.  
  160.    ''' <summary>
  161.    ''' Changes the color when the item is not focused.
  162.    ''' </summary>
  163.    Public Property ItemNotFocusedHighlighColor() As Color
  164.        Get
  165.            Return _itemNotFocusedHighlighColor
  166.        End Get
  167.        Set(ByVal value As Color)
  168.            If value <> _itemNotFocusedHighlighColor Then
  169.                _itemNotFocusedHighlighColor = value
  170.                Me.Invalidate()
  171.            End If
  172.        End Set
  173.    End Property
  174.  
  175.    Private ReadOnly Property DrawCustomGridLines() As Boolean
  176.        Get
  177.            Return (_gridLines And Not _useDefaultGridLines)
  178.        End Get
  179.    End Property
  180.  
  181.    Public Shadows Property GridLines() As Boolean
  182.        Get
  183.            Return _gridLines
  184.        End Get
  185.        Set(ByVal value As Boolean)
  186.            _gridLines = value
  187.        End Set
  188.    End Property
  189.  
  190.    ''' <summary>
  191.    ''' use the default gridlines.
  192.    ''' </summary>
  193.    Public Property UseDefaultGridLines() As Boolean
  194.        Get
  195.            Return _useDefaultGridLines
  196.        End Get
  197.        Set(ByVal value As Boolean)
  198.            If _useDefaultGridLines <> value Then
  199.                _useDefaultGridLines = value
  200.            End If
  201.            MyBase.GridLines = value
  202.            MyBase.OwnerDraw = Not value
  203.        End Set
  204.    End Property
  205. #End Region
  206.  
  207. #Region " Procedures "
  208.  
  209.    ''' <summary>
  210.    ''' Monitors when an Item is added to the ListView.
  211.    ''' </summary>
  212.    Public Function AddItem(ByVal Text As String) As ListViewItem
  213.        RaiseEvent ItemAdded()
  214.        Return MyBase.Items.Add(Text)
  215.    End Function
  216.  
  217.    ''' <summary>
  218.    ''' Monitors when an Item is removed from the ListView.
  219.    ''' </summary>
  220.    Public Sub RemoveItem(ByVal Item As ListViewItem)
  221.        RaiseEvent ItemRemoved()
  222.        MyBase.Items.Remove(Item)
  223.    End Sub
  224.  
  225.    Protected Overrides Sub OnDrawColumnHeader(ByVal e As DrawListViewColumnHeaderEventArgs)
  226.        e.DrawDefault = True
  227.        MyBase.OnDrawColumnHeader(e)
  228.    End Sub
  229.  
  230.    Protected Overrides Sub OnLostFocus(ByVal e As System.EventArgs)
  231.        For Each selectedIndex As Integer In MyBase.SelectedIndices
  232.            MyBase.RedrawItems(selectedIndex, selectedIndex, False)
  233.        Next
  234.        MyBase.OnLostFocus(e)
  235.    End Sub
  236.  
  237.    Protected Overrides Sub OnDrawSubItem(ByVal e As DrawListViewSubItemEventArgs)
  238.  
  239.        Dim drawAsDefault As Boolean = False
  240.        Dim highlightBounds As Rectangle = Nothing
  241.        Dim highlightBrush As SolidBrush = Nothing
  242.  
  243.        'FIRST DETERMINE THE COLOR
  244.        If e.Item.Selected Then
  245.            If MyBase.Focused Then
  246.                highlightBrush = New SolidBrush(_itemHighlightColor)
  247.            ElseIf HideSelection Then
  248.                drawAsDefault = True
  249.            Else
  250.                highlightBrush = New SolidBrush(_itemNotFocusedHighlighColor)
  251.            End If
  252.        Else
  253.            drawAsDefault = True
  254.        End If
  255.  
  256.        If drawAsDefault Then
  257.            e.DrawBackground()
  258.        Else
  259.            'NEXT DETERMINE THE BOUNDS IN WHICH TO DRAW THE BACKGROUND
  260.            If FullRowSelect Then
  261.                highlightBounds = e.Bounds
  262.            Else
  263.                highlightBounds = e.Item.GetBounds(ItemBoundsPortion.Label)
  264.            End If
  265.  
  266.            'ONLY DRAW HIGHLIGHT IN 1 OF 2 CASES
  267.            'CASE 1 - FULL ROW SELECT (AND DRAWING ANY ITEM)
  268.            'CASE 2 - NOT FULL ROW SELECT (AND DRAWING 1ST ITEM)
  269.            If FullRowSelect Then
  270.                e.Graphics.FillRectangle(highlightBrush, highlightBounds)
  271.            ElseIf e.ColumnIndex = 0 Then
  272.                e.Graphics.FillRectangle(highlightBrush, highlightBounds)
  273.            Else
  274.                e.DrawBackground()
  275.            End If
  276.        End If
  277.  
  278.        e.DrawText()
  279.  
  280.        If _gridLines Then
  281.            e.Graphics.DrawRectangle(New Pen(_gridLineColor), e.Bounds)
  282.        End If
  283.  
  284.  
  285.        If FullRowSelect Then
  286.            e.DrawFocusRectangle(e.Item.GetBounds(ItemBoundsPortion.Entire))
  287.        Else
  288.            e.DrawFocusRectangle(e.Item.GetBounds(ItemBoundsPortion.Label))
  289.        End If
  290.  
  291.        MyBase.OnDrawSubItem(e)
  292.  
  293.    End Sub
  294.  
  295. #End Region
  296.  
  297. #Region " ProgressBar Properties "
  298.  
  299.    ''' <summary>
  300.    ''' Enables the drawing of a ProgressBar
  301.    ''' This property should be "True" to use any of the ProgressBar properties.
  302.    ''' </summary>
  303.    Public Property Enable_ProgressBar As Boolean
  304.        Get
  305.            Return _enable_progressbar
  306.        End Get
  307.        Set(ByVal value As Boolean)
  308.            Me.OwnerDraw = value
  309.            _enable_progressbar = value
  310.        End Set
  311.    End Property
  312.  
  313.    ''' <summary>
  314.    ''' The column index to draw the ProgressBar
  315.    ''' </summary>
  316.    Public Property Progressbar_Column As Integer
  317.        Get
  318.            Return _progressbar_column
  319.        End Get
  320.        Set(ByVal value As Integer)
  321.            _progressbar_column = value
  322.        End Set
  323.    End Property
  324.  
  325.    ''' <summary>
  326.    ''' The ProgressBar progress percentage
  327.    ''' </summary>
  328.    Public Property Percent As Double
  329.        Get
  330.            Return _percent
  331.        End Get
  332.        Set(ByVal value As Double)
  333.            _percent = value
  334.        End Set
  335.    End Property
  336.  
  337.    ''' <summary>
  338.    ''' The decimal factor which should be displayed for the ProgressBar progress percentage
  339.    ''' </summary>
  340.    Public Property Percent_Decimal As Short
  341.        Get
  342.            Return _percent_decimal
  343.        End Get
  344.        Set(ByVal value As Short)
  345.            _percent_decimal = value
  346.        End Set
  347.    End Property
  348.  
  349.    ''' <summary>
  350.    ''' The Font to be used as the ProgressBar Percent text
  351.    ''' </summary>
  352.    Public Property Percent_Font As Font
  353.        Get
  354.            Return _percent_font
  355.        End Get
  356.        Set(ByVal value As Font)
  357.            _percent_font = value
  358.        End Set
  359.    End Property
  360.  
  361.    ''' <summary>
  362.    ''' The additional text to add to the ProgressBar Percent value
  363.    ''' </summary>
  364.    Public Property Percent_Text As String
  365.        Get
  366.            Return _percent_text
  367.        End Get
  368.        Set(ByVal value As String)
  369.            _percent_text = value
  370.        End Set
  371.    End Property
  372.  
  373.    ''' <summary>
  374.    ''' The ForeColor of the ProgressBar Percent Text
  375.    ''' </summary>
  376.    Public Property Percent_Forecolor As Color
  377.        Get
  378.            Return _percent_forecolor.Color
  379.        End Get
  380.        Set(ByVal value As Color)
  381.            _percent_forecolor = New SolidBrush(value)
  382.        End Set
  383.    End Property
  384.  
  385.    ''' <summary>
  386.    ''' The text allignment to use for the ProgressBar
  387.    ''' </summary>
  388.    Public Property Percent_Text_Allignment As StringAlignment
  389.        Get
  390.            Return _percent_stringformat.Alignment
  391.        End Get
  392.        Set(ByVal value As StringAlignment)
  393.            _percent_stringformat.Alignment = value
  394.        End Set
  395.    End Property
  396.  
  397.    ''' <summary>
  398.    ''' The ProgressBar BackColor
  399.    ''' </summary>
  400.    Public Property ProgressBar_BackColor As Color
  401.        Get
  402.            Return _progressBar_backcolor.Color
  403.        End Get
  404.        Set(ByVal value As Color)
  405.            _progressBar_backcolor = New SolidBrush(value)
  406.        End Set
  407.    End Property
  408.  
  409.    ''' <summary>
  410.    ''' The ProgressBar BorderColor
  411.    ''' </summary>
  412.    Public Property ProgressBar_BorderColor As Color
  413.        Get
  414.            Return _progressBar_bordercolor.Color
  415.        End Get
  416.        Set(ByVal value As Color)
  417.            _progressBar_bordercolor = New Pen(value)
  418.        End Set
  419.    End Property
  420.  
  421.    ''' <summary>
  422.    ''' The First ProgressBar Gradient color
  423.    ''' </summary>
  424.    Public Property ProgressBar_FillColor1 As Color
  425.        Get
  426.            Return _progressBar_fillcolor1
  427.        End Get
  428.        Set(ByVal value As Color)
  429.            _progressBar_fillcolor1 = value
  430.        End Set
  431.    End Property
  432.  
  433.    ''' <summary>
  434.    ''' The Last ProgressBar Gradient color
  435.    ''' </summary>
  436.    Public Property ProgressBar_FillColor2 As Color
  437.        Get
  438.            Return _progressBar_fillcolor2
  439.        End Get
  440.        Set(ByVal value As Color)
  441.            _progressBar_fillcolor2 = value
  442.        End Set
  443.    End Property
  444.  
  445. #End Region
  446.  
  447. #Region " ProgressBar EventHandlers "
  448.  
  449.    ' ListView [DrawColumnHeader]
  450.    Public Sub Me_DrawColumnHeader(ByVal sender As Object, ByVal e As DrawListViewColumnHeaderEventArgs) Handles Me.DrawColumnHeader
  451.  
  452.        e.DrawDefault = True ' Draw default ColumnHeader.
  453.  
  454.    End Sub
  455.  
  456.    ' ListView [DrawItem]
  457.    Public Sub Me_DrawItem(ByVal sender As Object, ByVal e As DrawListViewItemEventArgs) 'Handles Me.DrawItem
  458.  
  459.        e.DrawDefault = False ' Draw default main item.
  460.  
  461.    End Sub
  462.  
  463.    ' ListView [DrawSubItem]
  464.    Public Sub Me_DrawSubItem(ByVal sender As Object, ByVal e As DrawListViewSubItemEventArgs) Handles Me.DrawSubItem
  465.  
  466.        If (e.ItemState And ListViewItemStates.Selected) <> 0 Then
  467.            ' Item is highlighted.
  468.            e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds)
  469.        End If
  470.  
  471.        ' Draw the progressbar.
  472.        If e.ColumnIndex = Me.Progressbar_Column Then
  473.  
  474.            If (Not Me.Enable_ProgressBar OrElse Me.Progressbar_Column = Nothing) Then Exit Sub
  475.  
  476.            ' Background color of the progressbar is white.
  477.            e.Graphics.FillRectangle(Me._progressBar_backcolor, e.Bounds)
  478.  
  479.            ' This creates a nice color gradient to fill.
  480.            Dim brGradient As Brush = _
  481.                New System.Drawing.Drawing2D.LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), _
  482.                                                                 Me.ProgressBar_FillColor1, Me.ProgressBar_FillColor2, 270, True)
  483.            ' Draw the actual progressbar.
  484.            e.Graphics.FillRectangle(brGradient, _
  485.                                     e.Bounds.X + 1, e.Bounds.Y + 2, _
  486.                                     CInt(((Me.Percent) / 100) * (e.Bounds.Width - 2)), e.Bounds.Height - 3)
  487.  
  488.            ' Draw the percentage number and percent sign.
  489.            e.Graphics.DrawString(Me.Percent.ToString("n" & Me.Percent_Decimal) & Me.Percent_Text, _
  490.                                  Me.Percent_Font, Me._percent_forecolor, _
  491.                                  CSng(e.Bounds.X + (e.Bounds.Width / 2)), e.Bounds.Y + 3, _
  492.                                  _percent_stringformat)
  493.  
  494.            ' Draw a light gray rectangle/border around the progressbar.
  495.            e.Graphics.DrawRectangle(Me._progressBar_bordercolor, _
  496.                                     e.Bounds.X, e.Bounds.Y + 1, _
  497.                                     e.Bounds.Width - 1, e.Bounds.Height - 2)
  498.        Else
  499.            e.DrawDefault = True
  500.  
  501.        End If
  502.  
  503.    End Sub
  504.  
  505. #End Region
  506.  
  507. End Class
8119  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 21 Octubre 2013, 19:11 pm
· Dibujar una barra de progreso en un Item de un ListView:







PD: Es preferible adaptar el siguiente código para hacer un user-control heredado de un Listview (solo hay que modificar 4 tonterías sencillas de este código) y añadirle anti-flickering al user-control, pero bueno, pueden dibujar el Listview desde otra Class como se muestra en este ejemplo, el código no es mio, solo lo he adaptado.

Código
  1. #Region " [ListView] Draw ProgressBar "
  2.  
  3.    ' [ [ListView] Draw ProgressBar ]
  4.  
  5.    Private Listview_Column As Integer = 4 ' The column index to draw the ProgressBar
  6.  
  7.    Private Percent As Double = 0 ' The progress percentage
  8.    Private Percent_DecimalFactor As Short = 1 ' Example: 0.1
  9.    Private Percent_Text As String = "% Done" ' Example: 0.1% Done
  10.    Private Percent_Forecolor As Brush = Brushes.Black
  11.    Private Percent_Font As Font = Me.Font
  12.  
  13.    Private ProgressBar_BackColor As Brush = Brushes.White
  14.    Private ProgressBar_BorderColor As Pen = Pens.LightGray
  15.    Private ProgressBar_FillColor1 As Color = Color.YellowGreen
  16.    Private ProgressBar_FillColor2 As Color = Color.White
  17.  
  18.    ' ListView [Layout]
  19.    Private Sub ListView1_Layout(sender As Object, e As LayoutEventArgs) _
  20.    Handles ListView1.Layout
  21.  
  22.        ' Set Listview OwnerDraw to True, so we can draw the progressbar.
  23.        ListView1.OwnerDraw = True
  24.  
  25.    End Sub
  26.  
  27.    ' ListView [DrawColumnHeader]
  28.    Private Sub ListView_DrawColumnHeader(ByVal sender As Object, ByVal e As DrawListViewColumnHeaderEventArgs) _
  29.    Handles ListView1.DrawColumnHeader
  30.  
  31.        e.DrawDefault = True ' Draw default ColumnHeader.
  32.  
  33.    End Sub
  34.  
  35.    ' ListView [DrawItem]
  36.    Private Sub ListView_DrawItem(ByVal sender As Object, ByVal e As DrawListViewItemEventArgs) _
  37.    Handles ListView1.DrawItem
  38.  
  39.        e.DrawDefault = False ' Draw default main item.
  40.  
  41.    End Sub
  42.  
  43.    ' ListView [DrawSubItem]
  44.    Private Sub ListView_DrawSubItem(ByVal sender As Object, ByVal e As DrawListViewSubItemEventArgs) _
  45.    Handles ListView1.DrawSubItem
  46.  
  47.        If (e.ItemState And ListViewItemStates.Selected) <> 0 Then
  48.            ' Item is highlighted.
  49.            e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds)
  50.        End If
  51.  
  52.        ' Draw the progressbar.
  53.        If e.ColumnIndex = Listview_Column Then
  54.  
  55.            ' Center the text in the progressbar.
  56.            Dim sf As New StringFormat
  57.            sf.Alignment = StringAlignment.Center
  58.  
  59.            ' Background color of the progressbar is white.
  60.            e.Graphics.FillRectangle(ProgressBar_BackColor, e.Bounds)
  61.  
  62.            ' Percentage of the progressbar to fill.
  63.            Dim FillPercent As Integer = CInt(((Percent) / 100) * (e.Bounds.Width - 2))
  64.  
  65.            ' This creates a nice color gradient to fill.
  66.            Dim brGradient As Brush = _
  67.                New System.Drawing.Drawing2D.LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), _
  68.                                                                 ProgressBar_FillColor1, ProgressBar_FillColor2, 270, True)
  69.            ' Draw the actual progressbar.
  70.            e.Graphics.FillRectangle(brGradient, _
  71.                                     e.Bounds.X + 1, e.Bounds.Y + 2, _
  72.                                     FillPercent, e.Bounds.Height - 3)
  73.  
  74.            ' Draw the percentage number and percent sign.
  75.            ' NOTE: make sure that e.SubItem.Text only contains a number or an error will occur.
  76.            e.Graphics.DrawString(Percent.ToString("n" & Percent_DecimalFactor) & Percent_Text, _
  77.                                  Percent_Font, Percent_Forecolor, _
  78.                                  CSng(e.Bounds.X + (e.Bounds.Width / 2)), e.Bounds.Y + 3, _
  79.                                  sf)
  80.  
  81.            ' Draw a light gray rectangle/border around the progressbar.
  82.            e.Graphics.DrawRectangle(ProgressBar_BorderColor, _
  83.                                     e.Bounds.X, e.Bounds.Y + 1, _
  84.                                     e.Bounds.Width - 1, e.Bounds.Height - 2)
  85.        Else
  86.            e.DrawDefault = True
  87.  
  88.        End If
  89.  
  90.    End Sub
  91.  
  92. #End Region
  93.  



· Un ejemplo que he hecho para mostrar como usar una expresión Lambda al Invocar propiedades de controles:

Código
  1. #Region " Invoke Lambda "
  2.  
  3.    ' Create a thread.
  4.    Private t As Threading.Thread = New Threading.Thread(AddressOf UI_Thread)
  5.  
  6.    ' Create two Textbox.
  7.    Dim tb1 As New TextBox With {.Text = "Hello World!"}
  8.    Dim tb2 As New TextBox With {.Location = New Point(tb1.Location.X, (tb1.Location.Y + tb1.Height))}
  9.  
  10.    Private Sub Form1_Load(sender As Object, e As EventArgs) _
  11.    Handles MyBase.Load
  12.  
  13.        Me.Controls.AddRange({tb1, tb2}) ' Add the Textbox to the UI.
  14.        t.Start() ' Start the thread.
  15.  
  16.    End Sub
  17.  
  18.    Private Sub UI_Thread()
  19.  
  20.        If tb2.InvokeRequired Then ' Check if invocation is required for the TextBox on the main thread.
  21.            tb2.Invoke(Sub() tb2.Text = tb1.Text) ' Then Invoke a Lambda method.
  22.        Else
  23.            tb2.Text = tb1.Text
  24.        End If
  25.  
  26.    End Sub
  27.  
  28. #End Region



· Un ejemplo que muestra como crear y usar un delegado para actualizar un control desde otro thread:

Código
  1. #Region " Delegate Example "
  2.  
  3.   ' Create the delegate to be able to update the TextBox.
  4.    Private Delegate Sub TextBoxUpdateUI(ByVal txt As String)
  5.  
  6.    ' Create a thread.
  7.    Private t As Threading.Thread = New Threading.Thread(AddressOf UI_Thread)
  8.  
  9.    ' Create two Textbox.
  10.    Dim tb1 As New TextBox With {.Text = "Hello World!"}
  11.    Dim tb2 As New TextBox With {.Location = New Point(tb1.Location.X, (tb1.Location.Y + tb1.Height))}
  12.  
  13.    Private Sub Form1_Load(sender As Object, e As EventArgs) _
  14.    Handles MyBase.Load
  15.  
  16.        Me.Controls.AddRange({tb1, tb2}) ' Add the Textbox to the UI.
  17.        t.Start() ' Start the thread.
  18.  
  19.    End Sub
  20.  
  21.    Private Sub UI_Thread()
  22.  
  23.        If tb2.InvokeRequired Then ' Check if invocation is required for the TextBox on the main thread.
  24.            Dim tb_delegate As New TextBoxUpdateUI(AddressOf UI_Thread) ' Set the TextBox delegate.
  25.            tb2.Invoke(tb_delegate, Text) ' Invoke the delegate and the control property to update.
  26.        Else
  27.            tb2.Text = tb1.Text
  28.        End If
  29.  
  30.    End Sub
  31.  
  32. #End Region
8120  Sistemas Operativos / Windows / Re: Diseño conceptual muestra la posible apariencia de Windows 9 en: 21 Octubre 2013, 17:55 pm
No os peleeis por el diseño!,
creo que estais olvidando lo más importante... ESO LO DISEÑÓ UN TIO DE LA PÁGINA DEVIANT ART, QUE NADA TIENE QUE VER CON EL TEAM DE MICROSOFT !!

Sincéramente no se como hacen una noticia de algo así... se pone alguien a dibujar 4 cosas, lo sube a una página donde cada día suben miles de diseños ...y ya hacen una noticia, es que eso ni es noticia ni es nada, ni es de Microsoft ni es nadie conocido, esto es peor que los culebrones  :¬¬, ya no saben de donde sacar "noticias".

Aunque si hay que opinar sobre el diseño, puf, es malísimo!, hay diseños minimalistas buenos, y los hay malos, a mi me gusta el minimal, pero esto NO.

Un saludo!
Páginas: 1 ... 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 [812] 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 ... 1254
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines