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

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


  Mostrar Mensajes
Páginas: 1 ... 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 [756] 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 ... 1236
7551  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets) en: 19 Enero 2014, 16:59 pm
Dado una colección de números, devuelve todos los números que no están dentro de un rango especificado.

Código
  1.    ' Get Numbers Not In Range.
  2.    ' ( By Elektro )
  3.    '
  4.    ' Usage Examples:
  5.    '
  6.    ' MsgBox(String.Join(", ", GetNumbersNotInRange({1, 3, 5, 7, 9}, 0, 10).ToArray)) ' Result: 0, 2, 4, 6, 8, 10
  7.    '
  8.    ''' <summary>
  9.    ''' Given a numeric collection, gets all the numbers which are not in a specified range.
  10.    ''' </summary>
  11.    ''' <param name="NumbersInRange">Indicates the numbers collection which are in range.</param>
  12.    ''' <param name="MinRange">Indicates the minimum range.</param>
  13.    ''' <param name="MaxRange">Indicates the maximum range.</param>
  14.    ''' <returns>System.Collections.Generic.IEnumerable(Of System.Int32).</returns>
  15.    Private Function GetNumbersNotInRange(ByVal NumbersInRange As IEnumerable(Of Integer),
  16.                                          ByVal MinRange As Integer,
  17.                                          ByVal MaxRange As Integer) As IEnumerable(Of Integer)
  18.  
  19.        Return From Number As Integer
  20.               In Enumerable.Range(MinRange, MaxRange + 1)
  21.               Where Not NumbersInRange.Contains(Number)
  22.  
  23.    End Function
7552  Informática / Software / Re: VisualStudio 2013 U. (Instalador+Plantillas+Snippets+Libs+Controles+Tools) en: 19 Enero 2014, 06:54 am
@cybernen

Hola

Me he percatado de varias cosas extrañas en el problema que describes.

1. Por un lado, lo de que te tarde un buen rato en descomprimir y se quede en el "99%" no debería ocurrir, la razón es que el executable del instalador lo partí en 12 archivos pero sin compresión (Puesto que comprimir el instalador es una tontería igual que comprimir un video, ya que el compilador con el que hice el instalador se encarga de comprimir al máximo posible los archivos),
por esa razón la "descompresión" debería tardarte exáctamente lo mismo que copiar los 12 archivos de una carpeta a otra carpeta.

2. En la imagen que muestras, el executable no tiene icono (bueno, tiene el icono por defecto que asigna el SO a los archivos desconocidos), pero deberías ver un icono morado (de VisualStudio) o en su defecto el icono por defecto de archivo executable ...aunque este problema podría ser debido a una mala actualización de la cache de iconos de Windows, pero teniendo en cuenta el problema de descompresión ...descarto que este problema sea de la cache, para mi es más bien un problema del HDD.

3. Si el executable estuviera corrupto, lo normal sería que diréctamente el sistema te mostrase un mensaje de error, y solo eso ...un simple error, pero en lugar de eso se te queda colgado TODO EL PC.

4. El instalador es compatible con arquitectura x86/x64, el problema de que no se te inicie no es porque uses win8 x86.

Por estos motivos, intuyo que la posible causa del problema pueda ser una de estas dos:

1. Quizás tienes algunos sectores del disco duro dañados, ya que no es normal que se te cuelgue al ejecutar un archivo, y que tampoco te muestre un icono para un executable (de cualquier tipo).
Prueba a utilizar la herramienta de escaneo de errores de Windows en tu disco duro para arreglar los posibles problemas (CHKDISK), asegúrate de activar el parámetro para reparar errores de forma automática, y en caso de que se encontrasen problemas en tu disco duro ...entonces te sugiero que te vuelvas a descargar todos los archivos del pack por si algunó fue dañado antes del escaneo o imposible de recuperar despues dle escaneo.
...Pero antes de realizar el escaneo puedes probar a descomprimir el pack en un pendrive, o en otro PC para salir de dudas.

2. Quizás estás usando una versión beta problemática del programa que uses para descomprimir, o símplemente quizás sea una basura de descompresor.
En ese caso, puedes probar a descomprimirlo de nuevo usando WinRAR (la última versión estable, no betas).

¿Te sirvió?

Saludos!
7553  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets) en: 19 Enero 2014, 06:18 am
RecycleBin Manager (Versión mejorada ...y acabada)

Un ayudante para obtener información sobre la papelera de reciclaje principal o el resto de papeleras así como de los elementos eliminados,
además de realizar otras operaciones como eliminar permanentemente o deshacer la eliminación (invocando verbos).

Aquí pueden ver el código ~> http://pastebin.com/eRync5pA


Índice de miembros públicos:
Código
  1. ' ----------
  2. ' Properties
  3. ' ----------
  4. '
  5. ' MainBin.Files
  6. ' MainBin.Folders
  7. ' MainBin.Items
  8. ' MainBin.ItemsCount
  9. ' MainBin.LastDeletedFile
  10. ' MainBin.LastDeletedFolder
  11. ' MainBin.LastDeletedItem
  12. ' MainBin.Size
  13.  
  14. ' -------
  15. ' Methods
  16. ' -------
  17. '
  18. ' MainBin.Empty()
  19. ' MainBin.RefreshIcon()
  20. '
  21. ' Tools.Empty()
  22. ' Tools.GetSize()
  23. ' Tools.GetDeletedFiles()
  24. ' Tools.GetDeletedFolders()
  25. ' Tools.GetDeletedItems()
  26. ' Tools.GetItemsCount()
  27. ' Tools.GetLastDeletedFile()
  28. ' Tools.GetLastDeletedFolder()
  29. ' Tools.GetLastDeletedItem()
  30. ' Tools.DeleteItem
  31. ' Tools.UndeleteItem
  32. ' Tools.InvokeItemVerb


Ejemplos de uso:

1.
Código
  1.    ' Empties all the Recycle Bins.
  2.    RecycleBinManager.MainBin.Empty()
  3.  
  4.    ' Empties the Recycle Bin of the "E" drive.
  5.    RecycleBinManager.Tools.Empty("E", RecycleBinManager.Tools.RecycleBinFlags.DontShowConfirmation)
  6.  
  7.    ' Updates the Main Recycle Bin icon.
  8.    RecycleBinManager.MainBin.RefreshIcon()
  9.  
  10.  
  11.    ' Gets the accumulated size (in bytes) of the Main Recycle Bin.
  12.    Dim RecycledSize As Long = RecycleBinManager.MainBin.Size
  13.  
  14.    ' Gets the accumulated size (in bytes) of the Recycle Bin on "E" drive.
  15.    Dim RecycledSizeE As Long = RecycleBinManager.Tools.GetSize("E")
  16.  
  17.  
  18.    ' Gets the total deleted items count of the Main recycle bin.
  19.    Dim RecycledItemsCount As Long = RecycleBinManager.MainBin.ItemsCount
  20.  
  21.    ' Gets the total deleted items count of the Recycle Bin on "E" drive.
  22.    Dim RecycledItemsCountE As Long = RecycleBinManager.Tools.GetDeletedItems("E").Count
  23.  
  24.  
  25.    ' Get all the deleted items inside the Main Recycle Bin.
  26.    Dim RecycledItems As ShellObject() = RecycleBinManager.MainBin.Items
  27.  
  28.    ' Get all the deleted files inside the Main Recycle Bin.
  29.    Dim RecycledFiles As ShellFile() = RecycleBinManager.MainBin.Files
  30.  
  31.    ' Get all the deleted folders inside the Main Recycle Bin.
  32.    Dim RecycledFolders As ShellFolder() = RecycleBinManager.MainBin.Folders
  33.  
  34.  
  35.    ' Get all the deleted items inside the Recycle Bin on "E" drive.
  36.    Dim RecycledItemsE As ShellObject() = RecycleBinManager.Tools.GetDeletedItems("E")
  37.  
  38.    ' Get all the deleted files inside the Recycle Bin on "E" drive.
  39.    Dim RecycledFilesE As ShellFile() = RecycleBinManager.Tools.GetDeletedFiles("E")
  40.  
  41.    ' Get all the deleted folders inside the Recycle Bin on "E" drive.
  42.    Dim RecycledFoldersE As ShellFolder() = RecycleBinManager.Tools.GetDeletedFolders("E")
  43.  
  44.  
  45.    ' Gets the Last deleted Item inside the Main Recycle Bin.
  46.    MsgBox(RecycleBinManager.MainBin.LastDeletedItem.Name)
  47.  
  48.    ' Gets the Last deleted Item inside the Recycle Bin on "E" drive
  49.    MsgBox(RecycleBinManager.Tools.GetLastDeletedItem("E").Name)
  50.  
  51.  
  52.    ' Undeletes an item.
  53.    RecycleBinManager.Tools.UndeleteItem(RecycleBinManager.MainBin.LastDeletedItem)
  54.  
  55.    ' Permanently deletes an item.
  56.    RecycleBinManager.Tools.DeleteItem(RecycleBinManager.MainBin.LastDeletedItem)
  57.  
  58.    ' Invokes an Item-Verb
  59.    RecycleBinManager.Tools.InvokeItemVerb(RecycleBinManager.MainBin.LastDeletedItem, "properties")

2.
Código
  1.    Private Sub Test() Handles MyBase.Shown
  2.  
  3.        Dim sb As New System.Text.StringBuilder
  4.  
  5.        ' Get all the deleted items inside all the Recycle Bins.
  6.        Dim RecycledItems As ShellObject() = RecycleBinManager.MainBin.Items
  7.  
  8.        ' Loop through the deleted Items (Ordered by las deleted).
  9.        For Each Item As ShellFile In (From itm In RecycledItems
  10.                                       Order By itm.Properties.GetProperty("System.Recycle.DateDeleted").ValueAsObject
  11.                                       Descending)
  12.  
  13.            ' Append the property bags information.
  14.            sb.AppendLine(String.Format("Full Name....: {0}",
  15.                                        Item.Name))
  16.  
  17.            sb.AppendLine(String.Format("Item Name....: {0}",
  18.                                        Item.Properties.System.ItemNameDisplay.Value))
  19.  
  20.            sb.AppendLine(String.Format("Deleted From.: {0}",
  21.                                        Item.Properties.GetProperty("System.Recycle.DeletedFrom").ValueAsObject))
  22.  
  23.            sb.AppendLine(String.Format("Item Type....: {0}",
  24.                                       Item.Properties.System.ItemTypeText.Value))
  25.  
  26.            sb.AppendLine(String.Format("Item Size....: {0}",
  27.                                        CStr(Item.Properties.System.Size.Value)))
  28.  
  29.            sb.AppendLine(String.Format("Attributes...: {0}",
  30.                                        [Enum].Parse(GetType(IO.FileAttributes),
  31.                                                     Item.Properties.System.FileAttributes.Value).ToString))
  32.  
  33.            sb.AppendLine(String.Format("Date Deleted.: {0}",
  34.                                        Item.Properties.GetProperty("System.Recycle.DateDeleted").ValueAsObject))
  35.  
  36.            sb.AppendLine(String.Format("Date Modified: {0}",
  37.                                        CStr(Item.Properties.System.DateModified.Value)))
  38.  
  39.            sb.AppendLine(String.Format("Date Created.: {0}",
  40.                                        CStr(Item.Properties.System.DateCreated.Value)))
  41.  
  42.            MsgBox(sb.ToString)
  43.            sb.Clear()
  44.  
  45.        Next Item
  46.  
  47.    End Sub
7554  Programación / .NET (C#, VB.NET, ASP) / Re: Como puedo saber los números que faltan dentro del rango ? en: 19 Enero 2014, 04:15 am
Se referirá a los numeros que no esten entre 0 y 99 !!!CREO!!!

Aquí no es necesario el sarcasmo, primero habla del rango, pero luego según dice: 'me gustaria mostrar en otro listbox los números que " NO " están dentro de estas sumas', como ves no dice: 'los números que NO están dentro del rango'.

Si tu comprendes lo que significa "un número que no está dentro de una suma", me parece bien, aunque digo yo que si sumas 1+1 todo el resto de números existentes estarán fuera de la suma, así que a dudas poco detalladas prefiero preguntar para estar seguro de lo que quiere.

Saludos
7555  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets) en: 19 Enero 2014, 02:02 am
Otro snippet para los controles de DotNetBar, para el 'KeyboardControl' en concreto.

Ejemplo de como crear una un Layout personalizado del teclado.

Código
  1.    ' DotNetBar [KeyboardControl] Example to create a Keyboard Layout at execution-time.
  2.    '
  3.    ' Instructions:
  4.    ' 1. Add a reference to 'DevComponents.DotNetBar.dll'.
  5.    ' 2. Add a 'KeyboardControl' control.
  6.  
  7.    Private Sub Test(sender As Object, e As EventArgs) Handles MyBase.Shown
  8.  
  9.        ' Set the new Keyboard Layout
  10.        KeyboardControl1.Keyboard = CreateDefaultKeyboard()
  11.  
  12.    End Sub
  13.  
  14.    ''' <summary>
  15.    ''' Creates the default keyboard.
  16.    ''' </summary>
  17.    ''' <returns>Keyboard.</returns>
  18.    Public Shared Function CreateDefaultKeyboard() As Keyboard
  19.        Dim keyboard As New Keyboard
  20.  
  21.        ' Actually there are 4 layout objects,
  22.        ' but for code simplicity this variable is reused for creating each of them.
  23.        Dim kc As LinearKeyboardLayout
  24.  
  25.        '#Region "Normal style configuration (no modifier keys pressed)"
  26.  
  27.        kc = New LinearKeyboardLayout()
  28.        keyboard.Layouts.Add(kc)
  29.  
  30.        kc.AddKey("q")
  31.        kc.AddKey("w")
  32.        kc.AddKey("e")
  33.        kc.AddKey("r")
  34.        kc.AddKey("t")
  35.        kc.AddKey("y")
  36.        kc.AddKey("u")
  37.        kc.AddKey("i")
  38.        kc.AddKey("o")
  39.        kc.AddKey("p")
  40.        kc.AddKey("Backspace", info:="{BACKSPACE}", width:=21)
  41.  
  42.        kc.AddLine()
  43.        kc.AddSpace(4)
  44.  
  45.        kc.AddKey("a")
  46.        kc.AddKey("s")
  47.        kc.AddKey("d")
  48.        kc.AddKey("f")
  49.        kc.AddKey("g")
  50.        kc.AddKey("h")
  51.        kc.AddKey("j")
  52.        kc.AddKey("k")
  53.        kc.AddKey("l")
  54.        kc.AddKey("'")
  55.        kc.AddKey("Enter", info:="{ENTER}", width:=17)
  56.  
  57.        kc.AddLine()
  58.  
  59.        kc.AddKey("Shift", info:="", style:=KeyStyle.Dark, layout:=1)
  60.        kc.AddKey("z")
  61.        kc.AddKey("x")
  62.        kc.AddKey("c")
  63.        kc.AddKey("v")
  64.        kc.AddKey("b")
  65.        kc.AddKey("n")
  66.        kc.AddKey("m")
  67.        kc.AddKey(",")
  68.        kc.AddKey(".")
  69.        kc.AddKey("?")
  70.        kc.AddKey("Shift", info:="", style:=KeyStyle.Dark, layout:=1)
  71.  
  72.        kc.AddLine()
  73.  
  74.        kc.AddKey("Ctrl", info:="", style:=KeyStyle.Dark, layout:=2)
  75.        kc.AddKey("&123", info:="", style:=KeyStyle.Dark, layout:=3)
  76.        kc.AddKey(":-)", info:=":-{)}", style:=KeyStyle.Dark)
  77.        'kc.AddKey("Alt", info: "%", style: KeyStyle.Dark);
  78.        kc.AddKey(" ", width:=76)
  79.        kc.AddKey("<", info:="{LEFT}", style:=KeyStyle.Dark)
  80.        kc.AddKey(">", info:="{RIGHT}", style:=KeyStyle.Dark)
  81.  
  82.        '#End Region
  83.  
  84.        '#Region "Shift modifier pressed"
  85.  
  86.        kc = New LinearKeyboardLayout()
  87.        keyboard.Layouts.Add(kc)
  88.  
  89.        kc.AddKey("Q", layout:=KeyboardLayout.PreviousLayout)
  90.        kc.AddKey("W", layout:=KeyboardLayout.PreviousLayout)
  91.        kc.AddKey("E", layout:=KeyboardLayout.PreviousLayout)
  92.        kc.AddKey("R", layout:=KeyboardLayout.PreviousLayout)
  93.        kc.AddKey("T", layout:=KeyboardLayout.PreviousLayout)
  94.        kc.AddKey("Y", layout:=KeyboardLayout.PreviousLayout)
  95.        kc.AddKey("U", layout:=KeyboardLayout.PreviousLayout)
  96.        kc.AddKey("I", layout:=KeyboardLayout.PreviousLayout)
  97.        kc.AddKey("O", layout:=KeyboardLayout.PreviousLayout)
  98.        kc.AddKey("P", layout:=KeyboardLayout.PreviousLayout)
  99.        kc.AddKey("Backspace", info:="{BACKSPACE}", width:=21)
  100.  
  101.        kc.AddLine()
  102.        kc.AddSpace(4)
  103.  
  104.        kc.AddKey("A", layout:=KeyboardLayout.PreviousLayout)
  105.        kc.AddKey("S", layout:=KeyboardLayout.PreviousLayout)
  106.        kc.AddKey("D", layout:=KeyboardLayout.PreviousLayout)
  107.        kc.AddKey("F", layout:=KeyboardLayout.PreviousLayout)
  108.        kc.AddKey("G", layout:=KeyboardLayout.PreviousLayout)
  109.        kc.AddKey("H", layout:=KeyboardLayout.PreviousLayout)
  110.        kc.AddKey("J", layout:=KeyboardLayout.PreviousLayout)
  111.        kc.AddKey("K", layout:=KeyboardLayout.PreviousLayout)
  112.        kc.AddKey("L", layout:=KeyboardLayout.PreviousLayout)
  113.        kc.AddKey("""", layout:=KeyboardLayout.PreviousLayout)
  114.        kc.AddKey("Enter", info:="{ENTER}", width:=17)
  115.  
  116.        kc.AddLine()
  117.  
  118.        kc.AddKey("Shift", info:="", style:=KeyStyle.Pressed, layout:=0, layoutEx:=4)
  119.        kc.AddKey("Z", layout:=KeyboardLayout.PreviousLayout)
  120.        kc.AddKey("X", layout:=KeyboardLayout.PreviousLayout)
  121.        kc.AddKey("C", layout:=KeyboardLayout.PreviousLayout)
  122.        kc.AddKey("V", layout:=KeyboardLayout.PreviousLayout)
  123.        kc.AddKey("B", layout:=KeyboardLayout.PreviousLayout)
  124.        kc.AddKey("N", layout:=KeyboardLayout.PreviousLayout)
  125.        kc.AddKey("M", layout:=KeyboardLayout.PreviousLayout)
  126.        kc.AddKey(";", layout:=KeyboardLayout.PreviousLayout)
  127.        kc.AddKey(":", layout:=KeyboardLayout.PreviousLayout)
  128.        kc.AddKey("!", layout:=KeyboardLayout.PreviousLayout)
  129.        kc.AddKey("Shift", info:="", style:=KeyStyle.Pressed, layout:=0, layoutEx:=4)
  130.  
  131.        kc.AddLine()
  132.  
  133.        kc.AddKey("Ctrl", info:="", style:=KeyStyle.Dark, layout:=2)
  134.        kc.AddKey("&123", info:="", style:=KeyStyle.Dark, layout:=3)
  135.        kc.AddKey(":-)", info:=":-{)}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout)
  136.        kc.AddKey(" ", width:=76, layout:=KeyboardLayout.PreviousLayout)
  137.        kc.AddKey("<", info:="+{LEFT}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout)
  138.        kc.AddKey(">", info:="+{RIGHT}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout)
  139.  
  140.        '#End Region
  141.  
  142.        '#Region "Ctrl modifier pressed"
  143.  
  144.        kc = New LinearKeyboardLayout()
  145.        keyboard.Layouts.Add(kc)
  146.  
  147.        kc.AddKey("q", info:="^q", layout:=KeyboardLayout.PreviousLayout)
  148.        kc.AddKey("w", info:="^w", layout:=KeyboardLayout.PreviousLayout)
  149.        kc.AddKey("e", info:="^e", layout:=KeyboardLayout.PreviousLayout)
  150.        kc.AddKey("r", info:="^r", layout:=KeyboardLayout.PreviousLayout)
  151.        kc.AddKey("t", info:="^t", layout:=KeyboardLayout.PreviousLayout)
  152.        kc.AddKey("y", info:="^y", layout:=KeyboardLayout.PreviousLayout)
  153.        kc.AddKey("u", info:="^u", hint:="Underline", layout:=KeyboardLayout.PreviousLayout)
  154.        kc.AddKey("i", info:="^i", hint:="Italic", layout:=KeyboardLayout.PreviousLayout)
  155.        kc.AddKey("o", info:="^o", layout:=KeyboardLayout.PreviousLayout)
  156.        kc.AddKey("p", info:="^p", layout:=KeyboardLayout.PreviousLayout)
  157.        kc.AddKey("Backspace", info:="^{BACKSPACE}", width:=21, layout:=KeyboardLayout.PreviousLayout)
  158.  
  159.        kc.AddLine()
  160.        kc.AddSpace(4)
  161.  
  162.        kc.AddKey("a", info:="^a", hint:="Select all", layout:=KeyboardLayout.PreviousLayout)
  163.        kc.AddKey("s", info:="^s", layout:=KeyboardLayout.PreviousLayout)
  164.        kc.AddKey("d", info:="^d", layout:=KeyboardLayout.PreviousLayout)
  165.        kc.AddKey("f", info:="^f", layout:=KeyboardLayout.PreviousLayout)
  166.        kc.AddKey("g", info:="^g", layout:=KeyboardLayout.PreviousLayout)
  167.        kc.AddKey("h", info:="^h", layout:=KeyboardLayout.PreviousLayout)
  168.        kc.AddKey("j", info:="^j", layout:=KeyboardLayout.PreviousLayout)
  169.        kc.AddKey("k", info:="^k", layout:=KeyboardLayout.PreviousLayout)
  170.        kc.AddKey("l", info:="^l", layout:=KeyboardLayout.PreviousLayout)
  171.        kc.AddKey("'", info:="^'", layout:=KeyboardLayout.PreviousLayout)
  172.        kc.AddKey("Enter", info:="^{ENTER}", width:=17, layout:=KeyboardLayout.PreviousLayout)
  173.  
  174.        kc.AddLine()
  175.  
  176.        kc.AddKey("Shift", info:="", layout:=1)
  177.        kc.AddKey("z", info:="^z", hint:="Undo", layout:=KeyboardLayout.PreviousLayout)
  178.        kc.AddKey("x", info:="^x", hint:="Cut", layout:=KeyboardLayout.PreviousLayout)
  179.        kc.AddKey("c", info:="^c", hint:="Copy", layout:=KeyboardLayout.PreviousLayout)
  180.        kc.AddKey("v", info:="^v", hint:="Paste", layout:=KeyboardLayout.PreviousLayout)
  181.        kc.AddKey("b", info:="^b", hint:="Bold", layout:=KeyboardLayout.PreviousLayout)
  182.        kc.AddKey("n", info:="^n", layout:=KeyboardLayout.PreviousLayout)
  183.        kc.AddKey("m", info:="^m", layout:=KeyboardLayout.PreviousLayout)
  184.        kc.AddKey(",", info:="^,", layout:=KeyboardLayout.PreviousLayout)
  185.        kc.AddKey(".", info:="^.", layout:=KeyboardLayout.PreviousLayout)
  186.        kc.AddKey("?", info:="^?", layout:=KeyboardLayout.PreviousLayout)
  187.        kc.AddKey("Shift", info:="", layout:=1)
  188.  
  189.        kc.AddLine()
  190.  
  191.        kc.AddKey("Ctrl", info:="", style:=KeyStyle.Pressed, layout:=KeyboardLayout.PreviousLayout)
  192.        kc.AddKey("&123", info:="", style:=KeyStyle.Dark, layout:=3)
  193.        kc.AddKey(":-)", info:="^:-{)}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout)
  194.        kc.AddKey(" ", info:="^ ", width:=76, layout:=KeyboardLayout.PreviousLayout)
  195.        kc.AddKey("<", info:="^{LEFT}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout)
  196.        kc.AddKey(">", info:="^{RIGHT}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout)
  197.  
  198.        '#End Region
  199.  
  200.        '#Region "Symbols and numbers (&123) modifier pressed"
  201.  
  202.        kc = New LinearKeyboardLayout()
  203.        keyboard.Layouts.Add(kc)
  204.  
  205.        kc.AddKey("!")
  206.        kc.AddKey("@")
  207.        kc.AddKey("#")
  208.        kc.AddKey("$")
  209.        kc.AddKey("½")
  210.        kc.AddKey("-")
  211.        kc.AddKey("+", info:="{+}")
  212.  
  213.        kc.AddSpace(5)
  214.  
  215.        kc.AddKey("1", style:=KeyStyle.Light)
  216.        kc.AddKey("2", style:=KeyStyle.Light)
  217.        kc.AddKey("3", style:=KeyStyle.Light)
  218.  
  219.        kc.AddSpace(5)
  220.  
  221.        kc.AddKey("Bcks", info:="{BACKSPACE}", style:=KeyStyle.Dark)
  222.  
  223.        kc.AddLine()
  224.  
  225.        ' second line
  226.        kc.AddKey(";")
  227.        kc.AddKey(":")
  228.        kc.AddKey("""")
  229.        kc.AddKey("%", info:="{%}")
  230.        kc.AddKey("&")
  231.        kc.AddKey("/")
  232.        kc.AddKey("*")
  233.  
  234.        kc.AddSpace(5)
  235.  
  236.        kc.AddKey("4", style:=KeyStyle.Light)
  237.        kc.AddKey("5", style:=KeyStyle.Light)
  238.        kc.AddKey("6", style:=KeyStyle.Light)
  239.  
  240.        kc.AddSpace(5)
  241.  
  242.        kc.AddKey("Enter", info:="{ENTER}", style:=KeyStyle.Dark)
  243.  
  244.        kc.AddLine()
  245.  
  246.        ' third line
  247.        kc.AddKey("(", info:="{(}")
  248.        kc.AddKey(")", info:="{)}")
  249.        kc.AddKey("[", info:="{[}")
  250.        kc.AddKey("]", info:="{]}")
  251.        kc.AddKey("_")
  252.        kc.AddKey("\")
  253.        kc.AddKey("=")
  254.  
  255.        kc.AddSpace(5)
  256.  
  257.        kc.AddKey("7", style:=KeyStyle.Light)
  258.        kc.AddKey("8", style:=KeyStyle.Light)
  259.        kc.AddKey("9", style:=KeyStyle.Light)
  260.  
  261.        kc.AddSpace(5)
  262.  
  263.        kc.AddKey("Tab", info:="{TAB}", style:=KeyStyle.Dark)
  264.  
  265.        kc.AddLine()
  266.  
  267.        ' forth line
  268.        kc.AddKey("...", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout)
  269.        kc.AddKey("&123", info:="", style:=KeyStyle.Pressed, layout:=KeyboardLayout.PreviousLayout)
  270.        kc.AddKey(":-)", info:=":-{)}", style:=KeyStyle.Dark)
  271.        kc.AddKey("<", info:="{LEFT}", style:=KeyStyle.Dark)
  272.        kc.AddKey(">", info:="{RIGHT}", style:=KeyStyle.Dark)
  273.        kc.AddKey("Space", info:="^ ", width:=21)
  274.  
  275.        kc.AddSpace(5)
  276.  
  277.        kc.AddKey("0", style:=KeyStyle.Light, width:=21)
  278.        kc.AddKey(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, style:=KeyStyle.Dark)
  279.  
  280.        kc.AddSpace(5)
  281.  
  282.        kc.AddLine()
  283.  
  284.        '#End Region
  285.  
  286.        '#Region "Shift modifier toggled"
  287.  
  288.        kc = New LinearKeyboardLayout()
  289.        keyboard.Layouts.Add(kc)
  290.  
  291.        kc.AddKey("Q")
  292.        kc.AddKey("W")
  293.        kc.AddKey("E")
  294.        kc.AddKey("R")
  295.        kc.AddKey("T")
  296.        kc.AddKey("Y")
  297.        kc.AddKey("U")
  298.        kc.AddKey("I")
  299.        kc.AddKey("O")
  300.        kc.AddKey("P")
  301.        kc.AddKey("Backspace", info:="{BACKSPACE}", width:=21)
  302.  
  303.        kc.AddLine()
  304.        kc.AddSpace(4)
  305.  
  306.        kc.AddKey("A")
  307.        kc.AddKey("S")
  308.        kc.AddKey("D")
  309.        kc.AddKey("F")
  310.        kc.AddKey("G")
  311.        kc.AddKey("H")
  312.        kc.AddKey("J")
  313.        kc.AddKey("K")
  314.        kc.AddKey("L")
  315.        kc.AddKey("'")
  316.        kc.AddKey("Enter", info:="{ENTER}", width:=17)
  317.  
  318.        kc.AddLine()
  319.  
  320.        kc.AddKey("Shift", info:="", style:=KeyStyle.Toggled, layout:=0)
  321.        kc.AddKey("Z")
  322.        kc.AddKey("X")
  323.        kc.AddKey("C")
  324.        kc.AddKey("V")
  325.        kc.AddKey("B")
  326.        kc.AddKey("N")
  327.        kc.AddKey("M")
  328.        kc.AddKey(",")
  329.        kc.AddKey(".")
  330.        kc.AddKey("?")
  331.        kc.AddKey("Shift", info:="", style:=KeyStyle.Toggled, layout:=0)
  332.  
  333.        kc.AddLine()
  334.  
  335.        kc.AddKey("Ctrl", info:="", style:=KeyStyle.Dark, layout:=2)
  336.        kc.AddKey("&123", info:="", style:=KeyStyle.Dark, layout:=3)
  337.        kc.AddKey(":-)", info:=":-{)}", style:=KeyStyle.Dark)
  338.        kc.AddKey(" ", width:=76)
  339.        kc.AddKey("<", info:="+{LEFT}", style:=KeyStyle.Dark)
  340.        kc.AddKey(">", info:="+{RIGHT}", style:=KeyStyle.Dark)
  341.  
  342.        '#End Region
  343.  
  344.        Return keyboard
  345.  
  346.    End Function
7556  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets) en: 19 Enero 2014, 02:01 am
Unos Snippets que he escrito para algunos de los controles de usuario de DotNetBar.

Ejemplo de como crear y mostrar un Ballon.

Código
  1.    ' DotNetBar [Ballon] Example to create a new Ballon.
  2.    ' ( By Elektro )
  3.    '
  4.    ' Instructions:
  5.    ' 1. Add a reference to 'DevComponents.DotNetBar.dll'.
  6.  
  7.    ''' <summary>
  8.    ''' The DotNetBar Ballon object.
  9.    ''' </summary>
  10.    Private WithEvents BallonTip As Balloon = Nothing
  11.  
  12.    ''' <summary>
  13.    ''' Handles the MouseEnter event of the TextBox1 control.
  14.    ''' </summary>
  15.    ''' <param name="sender">The source of the event.</param>
  16.    ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  17.    Private Sub TextBox1_MouseEnter(ByVal sender As Object, ByVal e As EventArgs) _
  18.    Handles TextBox1.MouseEnter
  19.  
  20.        BallonTip = New Balloon()
  21.  
  22.        ' Set the properties to customize the Ballon.
  23.        With BallonTip
  24.  
  25.            .Owner = Me
  26.            .Style = eBallonStyle.Balloon
  27.            .AutoCloseTimeOut = 5 ' In seconds.
  28.  
  29.            .BorderColor = Color.YellowGreen
  30.            .BackColor = Color.FromArgb(80, 80, 80)
  31.            .BackColor2 = Color.FromArgb(40, 40, 40)
  32.            .BackColorGradientAngle = 90
  33.  
  34.            .CaptionIcon = Nothing
  35.            .CaptionImage = Nothing
  36.            .CaptionText = "I'm a BallonTip"
  37.            .CaptionFont = .Owner.Font
  38.            .CaptionColor = Color.YellowGreen
  39.  
  40.            .Text = "I'm the BallonTip text"
  41.            .ForeColor = Color.WhiteSmoke
  42.  
  43.            .AutoResize() ' Autoresize the Ballon, after setting the text.
  44.            .Show(sender, False) ' Show it.
  45.  
  46.        End With
  47.  
  48.    End Sub
  49.  
  50.    ''' <summary>
  51.    ''' Handles the MouseLeave event of the TextBox1 control.
  52.    ''' </summary>
  53.    ''' <param name="sender">The source of the event.</param>
  54.    ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  55.    Private Sub DisposeBallon(ByVal sender As Object, ByVal e As EventArgs) _
  56.    Handles TextBox1.MouseLeave
  57.  
  58.        If BallonTip IsNot Nothing AndAlso BallonTip.Visible Then
  59.            BallonTip.Dispose()
  60.        End If
  61.  
  62.    End Sub




Muestra un SuperTooltipInfo en unas coordenadas específicas.

Código
  1.    ' DotNetBar [SuperTooltipInfo] Show SuperTooltipInfo at MousePosition
  2.    ' ( By Elektro )
  3.    '
  4.    ' Instructions:
  5.    ' 1. Add a reference to 'DevComponents.DotNetBar.dll'.
  6.    ' 2. Add a 'SuperToolTip' control in the Designer.
  7.    '
  8.    ' Usage Examples:
  9.    ' ShowSuperTooltipInfo(SuperTooltip1,
  10.    '                      "I'm the Header", "I'm the Body", , "I'm the Footer", ,
  11.    '                      eTooltipColor.Blue, MousePosition, 2, False)
  12.    '
  13.    ''' <summary>
  14.    ''' Shows a SuperTooltipInfo on the specified location.
  15.    ''' </summary>
  16.    ''' <param name="SuperToolTip">Indicates the SuperTooltip control.</param>
  17.    ''' <param name="HeaderText">Indicates the header text.</param>
  18.    ''' <param name="BodyText">Indicates the body text.</param>
  19.    ''' <param name="BodyImage">Indicates the body image.</param>
  20.    ''' <param name="FooterText">Indicates the footer text.</param>
  21.    ''' <param name="FooterImage">Indicates the footer image.</param>
  22.    ''' <param name="BackColor">Indicates the Tooltip background color.</param>
  23.    ''' <param name="Location">Indicates the location where to show the Tooltip.</param>
  24.    ''' <param name="Duration">Indicates the Tooltip duration.</param>
  25.    ''' <param name="PositionBelowControl">If set to <c>true</c> the tooltip is shown below the control.</param>
  26.    Private Sub ShowSuperTooltip(ByVal SuperToolTip As SuperTooltip,
  27.                                 Optional ByVal HeaderText As String = "",
  28.                                 Optional ByVal BodyText As String = "",
  29.                                 Optional ByVal BodyImage As Image = Nothing,
  30.                                 Optional ByVal FooterText As String = "",
  31.                                 Optional ByVal FooterImage As Image = Nothing,
  32.                                 Optional ByVal BackColor As eTooltipColor = eTooltipColor.System,
  33.                                 Optional ByVal Location As Point = Nothing,
  34.                                 Optional ByVal Duration As Integer = 2,
  35.                                 Optional ByVal PositionBelowControl As Boolean = False)
  36.  
  37.        ' Save the current SuperToolTip contorl properties to restore them at end.
  38.        Dim CurrentProp_IgnoreFormActiveState As Boolean = SuperToolTip.IgnoreFormActiveState
  39.        Dim CurrentProp_PositionBelowControl As Boolean = SuperToolTip.PositionBelowControl
  40.  
  41.        ' Create an invisible Form.
  42.        Dim TooltipForm As New Form
  43.        With TooltipForm
  44.            .Size = New Size(0, 0)
  45.            .Opacity = 0
  46.            .Location = Location ' Move the Form to the specified location.
  47.        End With
  48.  
  49.        ' Create a SuperTooltipInfo.
  50.        Dim MySuperTooltip As New SuperTooltipInfo()
  51.        With MySuperTooltip
  52.            .HeaderText = HeaderText
  53.            .BodyText = BodyText
  54.            .BodyImage = BodyImage
  55.            .FooterText = FooterText
  56.            .FooterImage = FooterImage
  57.            .Color = BackColor
  58.        End With
  59.  
  60.        ' Set the Supertooltip properties.
  61.        With SuperToolTip
  62.            .IgnoreFormActiveState = True ' Ignore the form state to display the tooltip.
  63.            .PositionBelowControl = PositionBelowControl
  64.            .TooltipDuration = Duration
  65.            .SetSuperTooltip(TooltipForm, MySuperTooltip) ' Assign the SuperTooltip to the invisible form.
  66.            .ShowTooltip(TooltipForm) ' Show the SuperTooltipInfo on the form.
  67.        End With
  68.  
  69.        ' Restore the SuperTooltip properties.
  70.        With SuperToolTip
  71.            .IgnoreFormActiveState = CurrentProp_IgnoreFormActiveState
  72.            .PositionBelowControl = CurrentProp_PositionBelowControl
  73.        End With
  74.  
  75.        ' Dispose the invisible Form.
  76.        TooltipForm.Dispose()
  77.  
  78.    End Sub



 Ejemplo de como añadir soporte para mover un SideBar usando la rueda del ratón.

Código
  1.    ' DotNetBar [SideBar] Scroll SideBar using MouseWheel.
  2.    ' ( By Elektro )
  3.    '
  4.    ' Instructions:
  5.    ' 1. Reference 'DevComponents.DotNetBar.dll'.
  6.    ' 2. Add a 'SideBar' control (with panel and buttons inside).
  7.  
  8.    ''' <summary>
  9.    ''' Handles the MouseMove event of the SideBar1 control.
  10.    ''' </summary>
  11.    ''' <param name="sender">The source of the event.</param>
  12.    ''' <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
  13.    Private Sub SideBar1_MouseMove(sender As Object, e As MouseEventArgs) _
  14.    Handles SideBar1.MouseMove
  15.  
  16.        SideBar1.Focus()
  17.  
  18.    End Sub
  19.  
  20.    ''' <summary>
  21.    ''' Handles the MouseWheel event of the SideBar control.
  22.    ''' </summary>
  23.    ''' <param name="sender">The source of the event.</param>
  24.    ''' <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
  25.    Private Sub SideBar1_MouseWheel(sender As Object, e As MouseEventArgs) _
  26.    Handles SideBar1.MouseWheel
  27.  
  28.        Dim TopItemIndex As Integer = sender.ExpandedPanel.TopItemIndex
  29.        Dim ItemCount As Integer = sender.ExpandedPanel.SubItems.Count
  30.  
  31.        Select Case e.Delta
  32.  
  33.            Case Is < 0
  34.                If TopItemIndex < ItemCount - 1 Then
  35.                    TopItemIndex += 1
  36.                End If
  37.  
  38.            Case Else
  39.                If TopItemIndex > 0 Then
  40.                    TopItemIndex -= 1
  41.                End If
  42.  
  43.        End Select
  44.  
  45.    End Sub



Ejemplo de como crear y o eliminar tabs de un SuperTabControl en tiempo de ejecución.

Código
  1.    ' DotNetBar [Ballon] Example to create a new Ballon.
  2.    ' ( By Elektro )
  3.    '
  4.    ' Instructions:
  5.    ' 1. Add a reference to 'DevComponents.DotNetBar.dll'.
  6.    ' 2. Add a 'SuperTabControl' control.
  7.  
  8.    Private Sub Test(sender As Object, e As EventArgs) Handles MyBase.Shown
  9.  
  10.        ' Create a new Tab.
  11.        Dim tab As SuperTabItem = SuperTabControl1.CreateTab("New Tab")
  12.  
  13.        ' Create a new Tab-Panel.
  14.        Dim tabpanel As SuperTabControlPanel = DirectCast(tab.AttachedControl, SuperTabControlPanel)
  15.  
  16.        ' Create a random control.
  17.        Dim wbr As New WebBrowser() With {.Dock = DockStyle.Fill}
  18.        wbr.Navigate("google.com")
  19.  
  20.        'Add the control to the Tab-Panel.
  21.        tabpanel.Controls.Add(wbr)
  22.  
  23.        ' Remove the Tab.
  24.        ' SuperTabControl1.Tabs.Remove(tab)
  25.  
  26.        ' And remember to dispose the Tab-Panel and the added Controls.
  27.        ' tabpanel.Dispose()
  28.        ' wbr.Dispose()
  29.  
  30.    End Sub



Ejemplo de como crear una Bar en tiempo de ejecución.

Código
  1.    ' DotNetBar [DotNetBarManager] Example to create a new Bar at execution-time.
  2.    ' ( By Elektro )
  3.    '
  4.    ' Instructions:
  5.    ' 1. Add a reference to 'DevComponents.DotNetBar.dll'.
  6.    ' 2. Add a 'DotNetBarManager' control.
  7.  
  8.    Private Sub Test(sender As Object, e As EventArgs) Handles MyBase.Shown
  9.  
  10.        Dim bar As Bar
  11.        Dim menu As ButtonItem
  12.        Dim submenu As ButtonItem
  13.  
  14.        bar = New Bar("My Menu Bar")
  15.  
  16.        bar.ColorScheme.DockSiteBackColor = Color.YellowGreen
  17.        bar.ColorScheme.DockSiteBackColor2 = Color.YellowGreen
  18.  
  19.        bar.ColorScheme.MenuBarBackground = Color.FromArgb(80, 80, 80)
  20.        bar.ColorScheme.MenuBarBackground2 = Color.FromArgb(40, 40, 40)
  21.  
  22.        bar.ColorScheme.MenuSide = Color.Silver
  23.        bar.ColorScheme.MenuSide2 = Color.FromArgb(80, 80, 80)
  24.  
  25.        bar.ColorScheme.ItemText = Color.Black
  26.        bar.ColorScheme.ItemBackground = Color.Silver
  27.        bar.ColorScheme.ItemBackground2 = Color.Silver
  28.  
  29.        bar.ColorScheme.ItemHotText = Color.Black
  30.        bar.ColorScheme.ItemHotBackground = Color.YellowGreen
  31.        bar.ColorScheme.ItemHotBackground2 = Color.YellowGreen
  32.  
  33.        bar.MenuBar = True
  34.        bar.Stretch = True
  35.  
  36.        DotNetBarManager1.UseGlobalColorScheme = False
  37.        DotNetBarManager1.Bars.Add(bar)
  38.        bar.DockSide = eDockSide.Top
  39.  
  40.        menu = New ButtonItem("bFile", "&File")
  41.        bar.Items.Add(menu)
  42.  
  43.        submenu = New ButtonItem("bOpen", "&Open")
  44.        menu.SubItems.Add(submenu)
  45.  
  46.        submenu = New ButtonItem("bClose", "&Close")
  47.        menu.SubItems.Add(submenu)
  48.  
  49.        submenu = New ButtonItem("bExit", "&Exit")
  50.  
  51.        submenu.BeginGroup = True
  52.        menu.SubItems.Add(submenu)
  53.  
  54.        menu = New ButtonItem("bEdit", "&Edit")
  55.        bar.Items.Add(menu)
  56.  
  57.        submenu = New ButtonItem("bCut", "&Cut")
  58.        menu.SubItems.Add(submenu)
  59.  
  60.        submenu = New ButtonItem("bCopy", "&Copy")
  61.        menu.SubItems.Add(submenu)
  62.  
  63.        submenu = New ButtonItem("bPaste", "&Paste")
  64.        menu.SubItems.Add(submenu)
  65.  
  66.        submenu = New ButtonItem("bClear", "&Clear")
  67.  
  68.        submenu.BeginGroup = True
  69.        menu.SubItems.Add(submenu)
  70.  
  71.        bar.RecalcLayout()
  72.  
  73.    End Sub




Ejemplo de como crear y asignar un SuperTooltipInfo

Código
  1.        ' DotNetBar [SuperTooltipInfo] Example to create a new SuperTooltipInfo.
  2.        ' ( By Elektro )
  3.        '
  4.        ' Instructions:
  5.        ' 1. Add a reference to 'DevComponents.DotNetBar.dll'.
  6.        ' 2. Add a 'SuperToolTip' control in the Designer.
  7.  
  8.        ' SuperTooltipInfo type describes Super-Tooltip
  9.        Dim superTooltip As New SuperTooltipInfo()
  10.  
  11.        With superTooltip
  12.  
  13.            .HeaderText = "Header text"
  14.            .BodyText = "Body text with <strong>text-markup</strong> support. Header and footer support text-markup too."
  15.            .FooterText = "My footer text"
  16.  
  17.        End With
  18.  
  19.        ' Assign tooltip to a control or DotNetBar component
  20.        SuperTooltip1.SetSuperTooltip(TextBox1, superTooltip)
  21.  
  22.        ' To remove tooltip from a control or component use
  23.        '  SuperTooltip1.SetSuperTooltip(TextBox1, Nothing)



Ejemplo de como crear y mostrar un ContextMenu.

Código
  1.    ' DotNetBar [ContextMenuBar] Create a new ContextMenu.
  2.    ' ( By Elektro )
  3.    '
  4.    ' Instructions:
  5.    ' 1. Add a reference to 'DevComponents.DotNetBar.dll'.
  6.  
  7.    Private Sub Test() Handles MyBase.Shown
  8.  
  9.        ' Create context menu item that is assigned to controls or items
  10.        Dim ContextMenu As New ButtonItem("myContextMenuItemName")
  11.  
  12.        ' Create a Context MenuItem
  13.        Dim MenuItem As New ButtonItem("MenuItemName1")
  14.        MenuItem.Text = "Context MenuItem 1"
  15.        AddHandler MenuItem.Click, AddressOf MenuItemClick
  16.  
  17.        ' Add item to Context Menu
  18.        ContextMenu.SubItems.Add(MenuItem)
  19.  
  20.        ' Create second Context MenuItem
  21.        MenuItem = New ButtonItem("MenuItemName2", "Context MenuItem 2")
  22.        AddHandler MenuItem.Click, AddressOf MenuItemClick
  23.  
  24.        ' Add item to Context Menu
  25.        ContextMenu.SubItems.Add(MenuItem)
  26.  
  27.        ' Add Context Menu to Context MenuBar
  28.        ContextMenuBar1.Items.Add(ContextMenu)
  29.  
  30.        ' Assign context menu to text-box
  31.        ContextMenuBar1.SetContextMenuEx(TextBox1, ContextMenu)
  32.  
  33.    End Sub
7557  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Compartan aquí sus snippets) en: 19 Enero 2014, 01:54 am
Determina si el ratón está dentro del rango de pixels de un Control.

Código
  1.    ' Mouse Is Over Control?
  2.    ' ( By Elektro )
  3.    '
  4.    ' Usage Examples:
  5.    ' MsgBox(MouseIsOverControl(PictureBox1))
  6.    '
  7.    ''' <summary>
  8.    ''' Determinates whether the mouse pointer is over a pixel range of a specified control.
  9.    ''' </summary>
  10.    ''' <param name="Control">The control.</param>
  11.    ''' <returns>
  12.    ''' <c>true</c> if mouse is inside the pixel range, <c>false</c> otherwise.
  13.    ''' </returns>
  14.    Private Function MouseIsOverControl(ByVal [Control] As Control) As Boolean
  15.  
  16.        Return [Control].ClientRectangle.Contains([Control].PointToClient(MousePosition))
  17.  
  18.    End Function



 Crea un Bitmap y lo rellena con un color específico.

Código
  1.    ' Create Solid Bitmap
  2.    ' ( By Elektro )
  3.    '
  4.    ' Usage Examples:
  5.    ' PictureBox1.BackgroundImage = CreateSolidBitmap(New Size(16, 16), Color.Red)
  6.    '
  7.    ''' <summary>
  8.    ''' Creates a bitmap filled with a solid color.
  9.    ''' </summary>
  10.    ''' <param name="FillColor">Color to fill the Bitmap.</param>
  11.    ''' <returns>A Bitmap filled with the specified color.</returns>
  12.    Private Function CreateSolidBitmap(ByVal [Size] As Size,
  13.                                       ByVal FillColor As Color) As Bitmap
  14.  
  15.        ' Create a bitmap.
  16.        Dim bmp As New Bitmap([Size].Width, [Size].Height)
  17.  
  18.        ' Create a graphics object.
  19.        Using g As Graphics = Graphics.FromImage(bmp)
  20.  
  21.            ' Create a brush using the specified color.
  22.            Using br As New SolidBrush(FillColor)
  23.  
  24.                ' Fill the graphics object with the brush.
  25.                g.FillRectangle(br, 0, 0, bmp.Width, bmp.Height)
  26.  
  27.            End Using ' br
  28.  
  29.        End Using ' g
  30.  
  31.        Return bmp
  32.  
  33.    End Function



 Crea una serie de ToolStripItems en tiempo de ejecución.

Código
  1.    ' Create ToolStripItems at execution-time.
  2.    ' ( By Elektro )
  3.    '
  4.    ''' <summary>
  5.    ''' Handles the MouseEnter event of the ToolStripMenuItem control.
  6.    ''' </summary>
  7.    ''' <param name="sender">The source of the event.</param>
  8.    ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  9.    Private Sub ToolStripMenuItem1_MouseEnter(sender As Object, e As EventArgs) _
  10.    Handles ToolStripMenuItem1.MouseEnter
  11.  
  12.        ' Cast the Sender object.
  13.        Dim MenuItem As ToolStripMenuItem = CType(sender, ToolStripMenuItem)
  14.  
  15.        ' Remove previous Item handlers.
  16.        For Each Item As ToolStripItem In MenuItem.DropDown.Items
  17.            RemoveHandler Item.Click, AddressOf DropDownItems_Click
  18.        Next Item
  19.  
  20.        ' Clear previous items.
  21.        MenuItem.DropDown.Items.Clear()
  22.  
  23.        ' Set the DropDown Backcolor.
  24.        MenuItem.DropDown.BackColor = MenuItem.BackColor
  25.  
  26.        ' Create new items.
  27.        For X As Integer = 0 To 5
  28.  
  29.            ' Add the Item and set the Text, Image, and OnClick event handler.
  30.            Dim Item As ToolStripItem =
  31.                MenuItem.DropDown.Items.Add([Enum].Parse(GetType(ConsoleColor), X).ToString,
  32.                                            New Bitmap(1, 1),
  33.                                            AddressOf DropDownItems_Click)
  34.  
  35.            ' Set other item properties.
  36.            With Item
  37.                .Tag = X
  38.            End With
  39.  
  40.        Next X
  41.  
  42.    End Sub
  43.  
  44.    ''' <summary>
  45.    ''' Handles the Click event of the DropDownItems.
  46.    ''' </summary>
  47.    ''' <param name="sender">The source of the event.</param>
  48.    ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  49.    Private Sub DropDownItems_Click(sender As Object, e As EventArgs)
  50.  
  51.        MsgBox(String.Format("Item clicked: {0} | {1}", CStr(sender.Tag), CStr(sender.Text)))
  52.  
  53.    End Sub
7558  Sistemas Operativos / Windows / Re: Opciones de rendimiento en: 19 Enero 2014, 01:28 am
Si quieres un buen consejo, usa siempre "ALTO RENDIMIENTO", nunca utilices el perfil "equilibrado" en un pc de mesa, ya que podría causarte diveros problemas con otros componentes del equipo, sin ir más lejos, a mi me daban incomprensibles parones los hdd en dos pc's distintos , y no sé cuantos posts llegué a publicar sobre este problema en el foro, y al final descubrí que la causa del problema era el perfil "equilibrado" de rendimiento ...es decir, el problema era por no usar "Alto rendimiento", ya ves que ridiculez ...y con eso se solucionó, no te lo pienses, usa siempre "Alto rendimiento", no vale la pena arriesgar.

Saludos
7559  Media / Multimedia / Re: Codec de audio twos: 16-bit signed big-endian en: 18 Enero 2014, 20:29 pm
-.- y te das cuenta ahora xD

saludos
7560  Programación / .NET (C#, VB.NET, ASP) / Re: Como puedo saber los números que faltan dentro del rango ? en: 18 Enero 2014, 20:28 pm
Yo no entiendo muy bien la pregunta "saber los números que faltan dentro del rango".

saludos
Páginas: 1 ... 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 [756] 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines