|
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. ' Get Numbers Not In Range. ' ( By Elektro ) ' ' Usage Examples: ' ' MsgBox(String.Join(", ", GetNumbersNotInRange({1, 3, 5, 7, 9}, 0, 10).ToArray)) ' Result: 0, 2, 4, 6, 8, 10 ' ''' <summary> ''' Given a numeric collection, gets all the numbers which are not in a specified range. ''' </summary> ''' <param name="NumbersInRange">Indicates the numbers collection which are in range.</param> ''' <param name="MinRange">Indicates the minimum range.</param> ''' <param name="MaxRange">Indicates the maximum range.</param> ''' <returns>System.Collections.Generic.IEnumerable(Of System.Int32).</returns> Private Function GetNumbersNotInRange(ByVal NumbersInRange As IEnumerable(Of Integer), ByVal MinRange As Integer, ByVal MaxRange As Integer) As IEnumerable(Of Integer) Return From Number As Integer In Enumerable.Range(MinRange, MaxRange + 1) Where Not NumbersInRange.Contains(Number) 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: ' ---------- ' Properties ' ---------- ' ' MainBin.Files ' MainBin.Folders ' MainBin.Items ' MainBin.ItemsCount ' MainBin.LastDeletedFile ' MainBin.LastDeletedFolder ' MainBin.LastDeletedItem ' MainBin.Size ' ------- ' Methods ' ------- ' ' MainBin.Empty() ' MainBin.RefreshIcon() ' ' Tools.Empty() ' Tools.GetSize() ' Tools.GetDeletedFiles() ' Tools.GetDeletedFolders() ' Tools.GetDeletedItems() ' Tools.GetItemsCount() ' Tools.GetLastDeletedFile() ' Tools.GetLastDeletedFolder() ' Tools.GetLastDeletedItem() ' Tools.DeleteItem ' Tools.UndeleteItem ' Tools.InvokeItemVerb
Ejemplos de uso: 1. ' Empties all the Recycle Bins. RecycleBinManager.MainBin.Empty() ' Empties the Recycle Bin of the "E" drive. RecycleBinManager.Tools.Empty("E", RecycleBinManager.Tools.RecycleBinFlags.DontShowConfirmation) ' Updates the Main Recycle Bin icon. RecycleBinManager.MainBin.RefreshIcon() ' Gets the accumulated size (in bytes) of the Main Recycle Bin. Dim RecycledSize As Long = RecycleBinManager.MainBin.Size ' Gets the accumulated size (in bytes) of the Recycle Bin on "E" drive. Dim RecycledSizeE As Long = RecycleBinManager.Tools.GetSize("E") ' Gets the total deleted items count of the Main recycle bin. Dim RecycledItemsCount As Long = RecycleBinManager.MainBin.ItemsCount ' Gets the total deleted items count of the Recycle Bin on "E" drive. Dim RecycledItemsCountE As Long = RecycleBinManager.Tools.GetDeletedItems("E").Count ' Get all the deleted items inside the Main Recycle Bin. Dim RecycledItems As ShellObject() = RecycleBinManager.MainBin.Items ' Get all the deleted files inside the Main Recycle Bin. Dim RecycledFiles As ShellFile () = RecycleBinManager. MainBin. Files ' Get all the deleted folders inside the Main Recycle Bin. Dim RecycledFolders As ShellFolder () = RecycleBinManager. MainBin. Folders ' Get all the deleted items inside the Recycle Bin on "E" drive. Dim RecycledItemsE As ShellObject() = RecycleBinManager.Tools.GetDeletedItems("E") ' Get all the deleted files inside the Recycle Bin on "E" drive. Dim RecycledFilesE As ShellFile() = RecycleBinManager.Tools.GetDeletedFiles("E") ' Get all the deleted folders inside the Recycle Bin on "E" drive. Dim RecycledFoldersE As ShellFolder() = RecycleBinManager.Tools.GetDeletedFolders("E") ' Gets the Last deleted Item inside the Main Recycle Bin. MsgBox(RecycleBinManager.MainBin.LastDeletedItem.Name) ' Gets the Last deleted Item inside the Recycle Bin on "E" drive MsgBox(RecycleBinManager.Tools.GetLastDeletedItem("E").Name) ' Undeletes an item. RecycleBinManager.Tools.UndeleteItem(RecycleBinManager.MainBin.LastDeletedItem) ' Permanently deletes an item. RecycleBinManager.Tools.DeleteItem(RecycleBinManager.MainBin.LastDeletedItem) ' Invokes an Item-Verb RecycleBinManager.Tools.InvokeItemVerb(RecycleBinManager.MainBin.LastDeletedItem, "properties")
2. Private Sub Test() Handles MyBase.Shown Dim sb As New System.Text.StringBuilder ' Get all the deleted items inside all the Recycle Bins. Dim RecycledItems As ShellObject() = RecycleBinManager.MainBin.Items ' Loop through the deleted Items (Ordered by las deleted). For Each Item As ShellFile In (From itm In RecycledItems Order By itm.Properties.GetProperty("System.Recycle.DateDeleted").ValueAsObject Descending) ' Append the property bags information. sb.AppendLine(String.Format("Full Name....: {0}", Item.Name)) sb.AppendLine(String.Format("Item Name....: {0}", Item.Properties.System.ItemNameDisplay.Value)) sb.AppendLine(String.Format("Deleted From.: {0}", Item.Properties.GetProperty("System.Recycle.DeletedFrom").ValueAsObject)) sb.AppendLine(String.Format("Item Type....: {0}", Item.Properties.System.ItemTypeText.Value)) sb.AppendLine(String.Format("Item Size....: {0}", CStr(Item.Properties.System.Size.Value))) sb.AppendLine(String.Format("Attributes...: {0}", [Enum].Parse(GetType(IO.FileAttributes), Item.Properties.System.FileAttributes.Value).ToString)) sb.AppendLine(String.Format("Date Deleted.: {0}", Item.Properties.GetProperty("System.Recycle.DateDeleted").ValueAsObject)) sb.AppendLine(String.Format("Date Modified: {0}", CStr(Item.Properties.System.DateModified.Value))) sb.AppendLine(String.Format("Date Created.: {0}", CStr(Item.Properties.System.DateCreated.Value))) MsgBox(sb.ToString) sb.Clear() Next Item 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. ' DotNetBar [KeyboardControl] Example to create a Keyboard Layout at execution-time. ' ' Instructions: ' 1. Add a reference to 'DevComponents.DotNetBar.dll'. ' 2. Add a 'KeyboardControl' control. Private Sub Test(sender As Object, e As EventArgs) Handles MyBase.Shown ' Set the new Keyboard Layout KeyboardControl1.Keyboard = CreateDefaultKeyboard() End Sub ''' <summary> ''' Creates the default keyboard. ''' </summary> ''' <returns>Keyboard.</returns> Public Shared Function CreateDefaultKeyboard() As Keyboard Dim keyboard As New Keyboard ' Actually there are 4 layout objects, ' but for code simplicity this variable is reused for creating each of them. Dim kc As LinearKeyboardLayout '#Region "Normal style configuration (no modifier keys pressed)" kc = New LinearKeyboardLayout() keyboard.Layouts.Add(kc) kc.AddKey("q") kc.AddKey("w") kc.AddKey("e") kc.AddKey("r") kc.AddKey("t") kc.AddKey("y") kc.AddKey("u") kc.AddKey("i") kc.AddKey("o") kc.AddKey("p") kc.AddKey("Backspace", info:="{BACKSPACE}", width:=21) kc.AddLine() kc.AddSpace(4) kc.AddKey("a") kc.AddKey("s") kc.AddKey("d") kc.AddKey("f") kc.AddKey("g") kc.AddKey("h") kc.AddKey("j") kc.AddKey("k") kc.AddKey("l") kc.AddKey("'") kc.AddKey("Enter", info:="{ENTER}", width:=17) kc.AddLine() kc.AddKey("Shift", info:="", style:=KeyStyle.Dark, layout:=1) kc.AddKey("z") kc.AddKey("x") kc.AddKey("c") kc.AddKey("v") kc.AddKey("b") kc.AddKey("n") kc.AddKey("m") kc.AddKey(",") kc.AddKey(".") kc.AddKey("?") kc.AddKey("Shift", info:="", style:=KeyStyle.Dark, layout:=1) kc.AddLine() kc.AddKey("Ctrl", info:="", style:=KeyStyle.Dark, layout:=2) kc.AddKey("&123", info:="", style:=KeyStyle.Dark, layout:=3) kc.AddKey(":-)", info:=":-{)}", style:=KeyStyle.Dark) 'kc.AddKey("Alt", info: "%", style: KeyStyle.Dark); kc.AddKey(" ", width:=76) kc.AddKey("<", info:="{LEFT}", style:=KeyStyle.Dark) kc.AddKey(">", info:="{RIGHT}", style:=KeyStyle.Dark) '#End Region '#Region "Shift modifier pressed" kc = New LinearKeyboardLayout() keyboard.Layouts.Add(kc) kc.AddKey("Q", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("W", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("E", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("R", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("T", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("Y", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("U", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("I", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("O", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("P", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("Backspace", info:="{BACKSPACE}", width:=21) kc.AddLine() kc.AddSpace(4) kc.AddKey("A", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("S", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("D", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("F", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("G", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("H", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("J", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("K", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("L", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("""", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("Enter", info:="{ENTER}", width:=17) kc.AddLine() kc.AddKey("Shift", info:="", style:=KeyStyle.Pressed, layout:=0, layoutEx:=4) kc.AddKey("Z", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("X", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("C", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("V", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("B", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("N", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("M", layout:=KeyboardLayout.PreviousLayout) kc.AddKey(";", layout:=KeyboardLayout.PreviousLayout) kc.AddKey(":", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("!", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("Shift", info:="", style:=KeyStyle.Pressed, layout:=0, layoutEx:=4) kc.AddLine() kc.AddKey("Ctrl", info:="", style:=KeyStyle.Dark, layout:=2) kc.AddKey("&123", info:="", style:=KeyStyle.Dark, layout:=3) kc.AddKey(":-)", info:=":-{)}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout) kc.AddKey(" ", width:=76, layout:=KeyboardLayout.PreviousLayout) kc.AddKey("<", info:="+{LEFT}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout) kc.AddKey(">", info:="+{RIGHT}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout) '#End Region '#Region "Ctrl modifier pressed" kc = New LinearKeyboardLayout() keyboard.Layouts.Add(kc) kc.AddKey("q", info:="^q", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("w", info:="^w", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("e", info:="^e", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("r", info:="^r", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("t", info:="^t", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("y", info:="^y", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("u", info:="^u", hint:="Underline", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("i", info:="^i", hint:="Italic", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("o", info:="^o", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("p", info:="^p", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("Backspace", info:="^{BACKSPACE}", width:=21, layout:=KeyboardLayout.PreviousLayout) kc.AddLine() kc.AddSpace(4) kc.AddKey("a", info:="^a", hint:="Select all", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("s", info:="^s", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("d", info:="^d", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("f", info:="^f", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("g", info:="^g", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("h", info:="^h", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("j", info:="^j", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("k", info:="^k", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("l", info:="^l", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("'", info:="^'", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("Enter", info:="^{ENTER}", width:=17, layout:=KeyboardLayout.PreviousLayout) kc.AddLine() kc.AddKey("Shift", info:="", layout:=1) kc.AddKey("z", info:="^z", hint:="Undo", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("x", info:="^x", hint:="Cut", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("c", info:="^c", hint:="Copy", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("v", info:="^v", hint:="Paste", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("b", info:="^b", hint:="Bold", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("n", info:="^n", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("m", info:="^m", layout:=KeyboardLayout.PreviousLayout) kc.AddKey(",", info:="^,", layout:=KeyboardLayout.PreviousLayout) kc.AddKey(".", info:="^.", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("?", info:="^?", layout:=KeyboardLayout.PreviousLayout) kc.AddKey("Shift", info:="", layout:=1) kc.AddLine() kc.AddKey("Ctrl", info:="", style:=KeyStyle.Pressed, layout:=KeyboardLayout.PreviousLayout) kc.AddKey("&123", info:="", style:=KeyStyle.Dark, layout:=3) kc.AddKey(":-)", info:="^:-{)}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout) kc.AddKey(" ", info:="^ ", width:=76, layout:=KeyboardLayout.PreviousLayout) kc.AddKey("<", info:="^{LEFT}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout) kc.AddKey(">", info:="^{RIGHT}", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout) '#End Region '#Region "Symbols and numbers (&123) modifier pressed" kc = New LinearKeyboardLayout() keyboard.Layouts.Add(kc) kc.AddKey("!") kc.AddKey("@") kc.AddKey("#") kc.AddKey("$") kc.AddKey("½") kc.AddKey("-") kc.AddKey("+", info:="{+}") kc.AddSpace(5) kc.AddKey("1", style:=KeyStyle.Light) kc.AddKey("2", style:=KeyStyle.Light) kc.AddKey("3", style:=KeyStyle.Light) kc.AddSpace(5) kc.AddKey("Bcks", info:="{BACKSPACE}", style:=KeyStyle.Dark) kc.AddLine() ' second line kc.AddKey(";") kc.AddKey(":") kc.AddKey("""") kc.AddKey("%", info:="{%}") kc.AddKey("&") kc.AddKey("/") kc.AddKey("*") kc.AddSpace(5) kc.AddKey("4", style:=KeyStyle.Light) kc.AddKey("5", style:=KeyStyle.Light) kc.AddKey("6", style:=KeyStyle.Light) kc.AddSpace(5) kc.AddKey("Enter", info:="{ENTER}", style:=KeyStyle.Dark) kc.AddLine() ' third line kc.AddKey("(", info:="{(}") kc.AddKey(")", info:="{)}") kc.AddKey("[", info:="{[}") kc.AddKey("]", info:="{]}") kc.AddKey("_") kc.AddKey("\") kc.AddKey("=") kc.AddSpace(5) kc.AddKey("7", style:=KeyStyle.Light) kc.AddKey("8", style:=KeyStyle.Light) kc.AddKey("9", style:=KeyStyle.Light) kc.AddSpace(5) kc.AddKey("Tab", info:="{TAB}", style:=KeyStyle.Dark) kc.AddLine() ' forth line kc.AddKey("...", style:=KeyStyle.Dark, layout:=KeyboardLayout.PreviousLayout) kc.AddKey("&123", info:="", style:=KeyStyle.Pressed, layout:=KeyboardLayout.PreviousLayout) kc.AddKey(":-)", info:=":-{)}", style:=KeyStyle.Dark) kc.AddKey("<", info:="{LEFT}", style:=KeyStyle.Dark) kc.AddKey(">", info:="{RIGHT}", style:=KeyStyle.Dark) kc.AddKey("Space", info:="^ ", width:=21) kc.AddSpace(5) kc.AddKey("0", style:=KeyStyle.Light, width:=21) kc.AddKey(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, style:=KeyStyle.Dark) kc.AddSpace(5) kc.AddLine() '#End Region '#Region "Shift modifier toggled" kc = New LinearKeyboardLayout() keyboard.Layouts.Add(kc) kc.AddKey("Q") kc.AddKey("W") kc.AddKey("E") kc.AddKey("R") kc.AddKey("T") kc.AddKey("Y") kc.AddKey("U") kc.AddKey("I") kc.AddKey("O") kc.AddKey("P") kc.AddKey("Backspace", info:="{BACKSPACE}", width:=21) kc.AddLine() kc.AddSpace(4) kc.AddKey("A") kc.AddKey("S") kc.AddKey("D") kc.AddKey("F") kc.AddKey("G") kc.AddKey("H") kc.AddKey("J") kc.AddKey("K") kc.AddKey("L") kc.AddKey("'") kc.AddKey("Enter", info:="{ENTER}", width:=17) kc.AddLine() kc.AddKey("Shift", info:="", style:=KeyStyle.Toggled, layout:=0) kc.AddKey("Z") kc.AddKey("X") kc.AddKey("C") kc.AddKey("V") kc.AddKey("B") kc.AddKey("N") kc.AddKey("M") kc.AddKey(",") kc.AddKey(".") kc.AddKey("?") kc.AddKey("Shift", info:="", style:=KeyStyle.Toggled, layout:=0) kc.AddLine() kc.AddKey("Ctrl", info:="", style:=KeyStyle.Dark, layout:=2) kc.AddKey("&123", info:="", style:=KeyStyle.Dark, layout:=3) kc.AddKey(":-)", info:=":-{)}", style:=KeyStyle.Dark) kc.AddKey(" ", width:=76) kc.AddKey("<", info:="+{LEFT}", style:=KeyStyle.Dark) kc.AddKey(">", info:="+{RIGHT}", style:=KeyStyle.Dark) '#End Region Return keyboard 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. ' DotNetBar [Ballon] Example to create a new Ballon. ' ( By Elektro ) ' ' Instructions: ' 1. Add a reference to 'DevComponents.DotNetBar.dll'. ''' <summary> ''' The DotNetBar Ballon object. ''' </summary> Private WithEvents BallonTip As Balloon = Nothing ''' <summary> ''' Handles the MouseEnter event of the TextBox1 control. ''' </summary> ''' <param name="sender">The source of the event.</param> ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> Private Sub TextBox1_MouseEnter(ByVal sender As Object, ByVal e As EventArgs) _ Handles TextBox1.MouseEnter BallonTip = New Balloon() ' Set the properties to customize the Ballon. With BallonTip .Owner = Me .Style = eBallonStyle.Balloon .AutoCloseTimeOut = 5 ' In seconds. .BorderColor = Color.YellowGreen .BackColor = Color.FromArgb(80, 80, 80) .BackColor2 = Color.FromArgb(40, 40, 40) .BackColorGradientAngle = 90 .CaptionIcon = Nothing .CaptionImage = Nothing .CaptionText = "I'm a BallonTip" .CaptionFont = .Owner.Font .CaptionColor = Color.YellowGreen .Text = "I'm the BallonTip text" .ForeColor = Color.WhiteSmoke .AutoResize() ' Autoresize the Ballon, after setting the text. .Show(sender, False) ' Show it. End With End Sub ''' <summary> ''' Handles the MouseLeave event of the TextBox1 control. ''' </summary> ''' <param name="sender">The source of the event.</param> ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> Private Sub DisposeBallon(ByVal sender As Object, ByVal e As EventArgs) _ Handles TextBox1.MouseLeave If BallonTip IsNot Nothing AndAlso BallonTip.Visible Then BallonTip.Dispose() End If End Sub
Muestra un SuperTooltipInfo en unas coordenadas específicas. ' DotNetBar [SuperTooltipInfo] Show SuperTooltipInfo at MousePosition ' ( By Elektro ) ' ' Instructions: ' 1. Add a reference to 'DevComponents.DotNetBar.dll'. ' 2. Add a 'SuperToolTip' control in the Designer. ' ' Usage Examples: ' ShowSuperTooltipInfo(SuperTooltip1, ' "I'm the Header", "I'm the Body", , "I'm the Footer", , ' eTooltipColor.Blue, MousePosition, 2, False) ' ''' <summary> ''' Shows a SuperTooltipInfo on the specified location. ''' </summary> ''' <param name="SuperToolTip">Indicates the SuperTooltip control.</param> ''' <param name="HeaderText">Indicates the header text.</param> ''' <param name="BodyText">Indicates the body text.</param> ''' <param name="BodyImage">Indicates the body image.</param> ''' <param name="FooterText">Indicates the footer text.</param> ''' <param name="FooterImage">Indicates the footer image.</param> ''' <param name="BackColor">Indicates the Tooltip background color.</param> ''' <param name="Location">Indicates the location where to show the Tooltip.</param> ''' <param name="Duration">Indicates the Tooltip duration.</param> ''' <param name="PositionBelowControl">If set to <c>true</c> the tooltip is shown below the control.</param> Private Sub ShowSuperTooltip(ByVal SuperToolTip As SuperTooltip, Optional ByVal HeaderText As String = "", Optional ByVal BodyText As String = "", Optional ByVal BodyImage As Image = Nothing, Optional ByVal FooterText As String = "", Optional ByVal FooterImage As Image = Nothing, Optional ByVal BackColor As eTooltipColor = eTooltipColor.System, Optional ByVal Location As Point = Nothing, Optional ByVal Duration As Integer = 2, Optional ByVal PositionBelowControl As Boolean = False) ' Save the current SuperToolTip contorl properties to restore them at end. Dim CurrentProp_IgnoreFormActiveState As Boolean = SuperToolTip.IgnoreFormActiveState Dim CurrentProp_PositionBelowControl As Boolean = SuperToolTip.PositionBelowControl ' Create an invisible Form. Dim TooltipForm As New Form With TooltipForm .Size = New Size(0, 0) .Opacity = 0 .Location = Location ' Move the Form to the specified location. End With ' Create a SuperTooltipInfo. Dim MySuperTooltip As New SuperTooltipInfo() With MySuperTooltip .HeaderText = HeaderText .BodyText = BodyText .BodyImage = BodyImage .FooterText = FooterText .FooterImage = FooterImage .Color = BackColor End With ' Set the Supertooltip properties. With SuperToolTip .IgnoreFormActiveState = True ' Ignore the form state to display the tooltip. .PositionBelowControl = PositionBelowControl .TooltipDuration = Duration .SetSuperTooltip(TooltipForm, MySuperTooltip) ' Assign the SuperTooltip to the invisible form. .ShowTooltip(TooltipForm) ' Show the SuperTooltipInfo on the form. End With ' Restore the SuperTooltip properties. With SuperToolTip .IgnoreFormActiveState = CurrentProp_IgnoreFormActiveState .PositionBelowControl = CurrentProp_PositionBelowControl End With ' Dispose the invisible Form. TooltipForm.Dispose() End Sub
Ejemplo de como añadir soporte para mover un SideBar usando la rueda del ratón. ' DotNetBar [SideBar] Scroll SideBar using MouseWheel. ' ( By Elektro ) ' ' Instructions: ' 1. Reference 'DevComponents.DotNetBar.dll'. ' 2. Add a 'SideBar' control (with panel and buttons inside). ''' <summary> ''' Handles the MouseMove event of the SideBar1 control. ''' </summary> ''' <param name="sender">The source of the event.</param> ''' <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> Private Sub SideBar1_MouseMove(sender As Object, e As MouseEventArgs) _ Handles SideBar1.MouseMove SideBar1.Focus() End Sub ''' <summary> ''' Handles the MouseWheel event of the SideBar control. ''' </summary> ''' <param name="sender">The source of the event.</param> ''' <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> Private Sub SideBar1_MouseWheel(sender As Object, e As MouseEventArgs) _ Handles SideBar1.MouseWheel Dim TopItemIndex As Integer = sender.ExpandedPanel.TopItemIndex Dim ItemCount As Integer = sender.ExpandedPanel.SubItems.Count Select Case e.Delta Case Is < 0 If TopItemIndex < ItemCount - 1 Then TopItemIndex += 1 End If Case Else If TopItemIndex > 0 Then TopItemIndex -= 1 End If End Select End Sub
Ejemplo de como crear y o eliminar tabs de un SuperTabControl en tiempo de ejecución. ' DotNetBar [Ballon] Example to create a new Ballon. ' ( By Elektro ) ' ' Instructions: ' 1. Add a reference to 'DevComponents.DotNetBar.dll'. ' 2. Add a 'SuperTabControl' control. Private Sub Test(sender As Object, e As EventArgs) Handles MyBase.Shown ' Create a new Tab. Dim tab As SuperTabItem = SuperTabControl1.CreateTab("New Tab") ' Create a new Tab-Panel. Dim tabpanel As SuperTabControlPanel = DirectCast(tab.AttachedControl, SuperTabControlPanel) ' Create a random control. Dim wbr As New WebBrowser() With {.Dock = DockStyle.Fill} wbr.Navigate("google.com") 'Add the control to the Tab-Panel. tabpanel.Controls.Add(wbr) ' Remove the Tab. ' SuperTabControl1.Tabs.Remove(tab) ' And remember to dispose the Tab-Panel and the added Controls. ' tabpanel.Dispose() ' wbr.Dispose() End Sub
Ejemplo de como crear una Bar en tiempo de ejecución. ' DotNetBar [DotNetBarManager] Example to create a new Bar at execution-time. ' ( By Elektro ) ' ' Instructions: ' 1. Add a reference to 'DevComponents.DotNetBar.dll'. ' 2. Add a 'DotNetBarManager' control. Private Sub Test(sender As Object, e As EventArgs) Handles MyBase.Shown Dim bar As Bar Dim menu As ButtonItem Dim submenu As ButtonItem bar = New Bar("My Menu Bar") bar.ColorScheme.DockSiteBackColor = Color.YellowGreen bar.ColorScheme.DockSiteBackColor2 = Color.YellowGreen bar.ColorScheme.MenuBarBackground = Color.FromArgb(80, 80, 80) bar.ColorScheme.MenuBarBackground2 = Color.FromArgb(40, 40, 40) bar.ColorScheme.MenuSide = Color.Silver bar.ColorScheme.MenuSide2 = Color.FromArgb(80, 80, 80) bar.ColorScheme.ItemText = Color.Black bar.ColorScheme.ItemBackground = Color.Silver bar.ColorScheme.ItemBackground2 = Color.Silver bar.ColorScheme.ItemHotText = Color.Black bar.ColorScheme.ItemHotBackground = Color.YellowGreen bar.ColorScheme.ItemHotBackground2 = Color.YellowGreen bar.MenuBar = True bar.Stretch = True DotNetBarManager1.UseGlobalColorScheme = False DotNetBarManager1.Bars.Add(bar) bar.DockSide = eDockSide.Top menu = New ButtonItem("bFile", "&File") bar.Items.Add(menu) submenu = New ButtonItem("bOpen", "&Open") menu.SubItems.Add(submenu) submenu = New ButtonItem("bClose", "&Close") menu.SubItems.Add(submenu) submenu = New ButtonItem("bExit", "&Exit") submenu.BeginGroup = True menu.SubItems.Add(submenu) menu = New ButtonItem("bEdit", "&Edit") bar.Items.Add(menu) submenu = New ButtonItem("bCut", "&Cut") menu.SubItems.Add(submenu) submenu = New ButtonItem("bCopy", "&Copy") menu.SubItems.Add(submenu) submenu = New ButtonItem("bPaste", "&Paste") menu.SubItems.Add(submenu) submenu = New ButtonItem("bClear", "&Clear") submenu.BeginGroup = True menu.SubItems.Add(submenu) bar.RecalcLayout() End Sub
Ejemplo de como crear y asignar un SuperTooltipInfo ' DotNetBar [SuperTooltipInfo] Example to create a new SuperTooltipInfo. ' ( By Elektro ) ' ' Instructions: ' 1. Add a reference to 'DevComponents.DotNetBar.dll'. ' 2. Add a 'SuperToolTip' control in the Designer. ' SuperTooltipInfo type describes Super-Tooltip Dim superTooltip As New SuperTooltipInfo() With superTooltip .HeaderText = "Header text" .BodyText = "Body text with <strong>text-markup</strong> support. Header and footer support text-markup too." .FooterText = "My footer text" End With ' Assign tooltip to a control or DotNetBar component SuperTooltip1.SetSuperTooltip(TextBox1, superTooltip) ' To remove tooltip from a control or component use ' SuperTooltip1.SetSuperTooltip(TextBox1, Nothing)
Ejemplo de como crear y mostrar un ContextMenu. ' DotNetBar [ContextMenuBar] Create a new ContextMenu. ' ( By Elektro ) ' ' Instructions: ' 1. Add a reference to 'DevComponents.DotNetBar.dll'. Private Sub Test() Handles MyBase.Shown ' Create context menu item that is assigned to controls or items Dim ContextMenu As New ButtonItem("myContextMenuItemName") ' Create a Context MenuItem Dim MenuItem As New ButtonItem("MenuItemName1") MenuItem.Text = "Context MenuItem 1" AddHandler MenuItem.Click, AddressOf MenuItemClick ' Add item to Context Menu ContextMenu.SubItems.Add(MenuItem) ' Create second Context MenuItem MenuItem = New ButtonItem("MenuItemName2", "Context MenuItem 2") AddHandler MenuItem.Click, AddressOf MenuItemClick ' Add item to Context Menu ContextMenu.SubItems.Add(MenuItem) ' Add Context Menu to Context MenuBar ContextMenuBar1.Items.Add(ContextMenu) ' Assign context menu to text-box ContextMenuBar1.SetContextMenuEx(TextBox1, ContextMenu) 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. ' Mouse Is Over Control? ' ( By Elektro ) ' ' Usage Examples: ' MsgBox(MouseIsOverControl(PictureBox1)) ' ''' <summary> ''' Determinates whether the mouse pointer is over a pixel range of a specified control. ''' </summary> ''' <param name="Control">The control.</param> ''' <returns> ''' <c>true</c> if mouse is inside the pixel range, <c>false</c> otherwise. ''' </returns> Private Function MouseIsOverControl(ByVal [Control] As Control) As Boolean Return [Control].ClientRectangle.Contains([Control].PointToClient(MousePosition)) End Function
Crea un Bitmap y lo rellena con un color específico. ' Create Solid Bitmap ' ( By Elektro ) ' ' Usage Examples: ' PictureBox1.BackgroundImage = CreateSolidBitmap(New Size(16, 16), Color.Red) ' ''' <summary> ''' Creates a bitmap filled with a solid color. ''' </summary> ''' <param name="FillColor">Color to fill the Bitmap.</param> ''' <returns>A Bitmap filled with the specified color.</returns> Private Function CreateSolidBitmap(ByVal [Size] As Size, ByVal FillColor As Color) As Bitmap ' Create a bitmap. Dim bmp As New Bitmap([Size].Width, [Size].Height) ' Create a graphics object. Using g As Graphics = Graphics.FromImage(bmp) ' Create a brush using the specified color. Using br As New SolidBrush(FillColor) ' Fill the graphics object with the brush. g.FillRectangle(br, 0, 0, bmp.Width, bmp.Height) End Using ' br End Using ' g Return bmp End Function
Crea una serie de ToolStripItems en tiempo de ejecución. ' Create ToolStripItems at execution-time. ' ( By Elektro ) ' ''' <summary> ''' Handles the MouseEnter event of the ToolStripMenuItem control. ''' </summary> ''' <param name="sender">The source of the event.</param> ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> Private Sub ToolStripMenuItem1_MouseEnter(sender As Object, e As EventArgs) _ Handles ToolStripMenuItem1.MouseEnter ' Cast the Sender object. Dim MenuItem As ToolStripMenuItem = CType(sender, ToolStripMenuItem) ' Remove previous Item handlers. For Each Item As ToolStripItem In MenuItem.DropDown.Items RemoveHandler Item.Click, AddressOf DropDownItems_Click Next Item ' Clear previous items. MenuItem.DropDown.Items.Clear() ' Set the DropDown Backcolor. MenuItem.DropDown.BackColor = MenuItem.BackColor ' Create new items. For X As Integer = 0 To 5 ' Add the Item and set the Text, Image, and OnClick event handler. Dim Item As ToolStripItem = MenuItem.DropDown.Items.Add([Enum].Parse(GetType(ConsoleColor), X).ToString, New Bitmap(1, 1), AddressOf DropDownItems_Click) ' Set other item properties. With Item .Tag = X End With Next X End Sub ''' <summary> ''' Handles the Click event of the DropDownItems. ''' </summary> ''' <param name="sender">The source of the event.</param> ''' <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> Private Sub DropDownItems_Click(sender As Object, e As EventArgs) MsgBox(String.Format("Item clicked: {0} | {1}", CStr(sender.Tag), CStr(sender.Text))) 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
|
|
|
|
|
|
|