|
9811
|
Programación / Scripting / Re: Como puedo hacer un launcher asi, con VBS o con HTML, decidme
|
en: 11 Enero 2013, 11:19 am
|
700 líneas de código para hacer un maldito launcher, y las líneas que faltan para acabarlo... Si es que es una locura de código, como tu dices has cojido varios snippets, los has colocado y los has editado un poco, yo tambíen uso muchas veces snippets de internet para ahorrarme el trabajo de hacerlo a mano, pero joder, hay que saber un poco lo que estás usando, hay código de JS, VBS, CSS y HTML, y no sabes casi nada de ninguno de los 4 lenguajes, lo digo sin ofender, es que no sé para que te metes a usar 4 lenguajes si los desconoces. En fín, es una completa locura de código, como para encontrar el error, aunque alguien te arreglase el código un poco mañana te saldrían 50 errores más por la forma en la que haces las cosas, y aquí estamos para ayudar y enseñar, pero con un arreglo ni aprendes bien ni se arregla . Te repito mi consejo, hazlo en VB.NET, (en un par de líneas se hace), ya lo habrías terminado, deja de complicarte.
Te voy a decir las cosas que encuentro echándole un vistazo en el editor (no pienso esforzarme mucho en buscar errores) objshell.run appdata & "\Ikillnukes\RUN.bat" objshell.run appdata & "\Ikillnukes\OPT.hta" A menos que cierres el argumento completo con comillas, cualquier usuario que tenga espacios en el nombre de la ruta no le funcionará. Function runear() setTimeout "ejecutar()",1000 End Function Deberías buscar en Google lo que es una función, en tu HTA usas para todo funciones de VBS cuando estas no devuelven ningún valor, funcionar funcionan como un sub, pero es muy incorrecto lo que estás haciendo. Cada pequeño código que veo de VBS lo separas en bloques, ¿Y si empiezas por juntar todos los VBS en un solo bloque?: <script type="text/javascript"> TODOS los códigos de VBS aquí, comentados y organizados. </script> Y lo mismo con los de JS y CSS. Saludos!
|
|
|
9812
|
Programación / .NET (C#, VB.NET, ASP) / Como veo el standardoutput de la CMD en la própia CMD?
|
en: 11 Enero 2013, 10:29 am
|
Estoy intentando hacer pruebas, Lo que quiero es poder abrir un comando en la CMD y que la consola no se cierre, por ejemplo: My_Process_Info.FileName = "CMD.exe" My_Process_Info.Arguments = "/k pause"
Pero la CMD se cierra. Así que he intentado ejecutar un FOR de Batch muy largo en la CMD para ver si así no se cierra... My_Process_Info.FileName = "CMD.exe" ' Process filename My_Process_Info.Arguments = "/k For /L %a in (1,1,100000) do echo afijgifjigjfgjifjgi" ' Process arguments
y no, no se cierra (Porque el FOR tarda en finalizar, cuando acaba si que se cierra claro xD) pero ahora lo que ocurre además es que el output de la CMD no se muestra en la CMD!, es decir, el FOR no muestra nada. EDITO: Vale, he descubierto que el output no se muestra en la CMD porque al habilitar la propiedad de redireccionar el Standard u Error output, no muestra el output en la CMD. Así que quiero solucionar los dos problemas: 1. Que la CMD no se cierre cuando finaliza la orden, el comando. 2. Que el output se muestre en la CMD cuando habilito la propiedad RedirectStandardOutput = True y/o RedirectStandardError = True Este es el code, es un snippet que estoy intentando hacer: Dim My_Process As New Process() Dim My_Process_Info As New ProcessStartInfo() My_Process_Info.FileName = "CMD.exe" ' Process filename My_Process_Info.Arguments = "/k For /L %a in (1,1,100000) do echo afijgifjigjfgjifjgi" ' Process arguments My_Process_Info.UseShellExecute = False ' Don't use system shell to execute the process My_Process_Info.CreateNoWindow = False ' Show the CMD Window My_Process_Info.RedirectStandardOutput = True ' Redirect (1) Output My_Process_Info.RedirectStandardError = True ' Redirect non (1) Output My_Process.EnableRaisingEvents = True My_Process.StartInfo = My_Process_Info My_Process.Start() ' Run the process My_Process.WaitForExit() ' Wait X miliseconds to kill the process Dim Process_StandardOutput = My_Process.StandardOutput.ReadToEnd() ' Stores the Standard Output (If any) Dim Process_ErrorOutput = My_Process.StandardOutput.ReadToEnd() ' Stores the Error Output (If any) Dim Process_StartTime As String = My_Process.StartTime ' Stores the time when the process was launched Dim Process_EndTime As String = My_Process.ExitTime ' Stores the time when the process was finished Dim ERRORLEVEL = My_Process.ExitCode ' Stores the ExitCode of the process Dim result = Process_StartTime & vbNewLine & Process_EndTime & vbNewLine & ERRORLEVEL MsgBox(result) MsgBox(Process_StandardOutput) MsgBox(Process_ErrorOutput)
|
|
|
9813
|
Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets (ACTUALIZADO 11/01/2013)
|
en: 11 Enero 2013, 09:39 am
|
Para una aplicación necesité dividir el tamaño de unos MEgaBytes entre la capacidad de un DVD5, así que ya puestos he hecho este snippet que divide el tamaño entre varios formatos de discos, para la próxima ocasión. PD: Las medidas están sacadas de la Wikipedia, para los más... Saludos. ' Usage: ' ' MsgBox(ConvertToDiscSize(737280000, "Bytes", "CD")) ' MsgBox(ConvertToDiscSize(700, "MB", "CD")) ' MsgBox(Math.Ceiling(ConvertToDiscSize(6.5, "GB", "DVD"))) ' MsgBox(ConvertToDiscSize(40, "GB", "BR").ToString.Substring(0, 3) & " Discs") #Region " Convert To Disc Size function" Private Function ConvertToDiscSize(ByVal FileSize As Double, ByVal FileKindSize As String, ByVal To_DiscKindCapacity As String) ' KindSize Measures: ' -------------------------- ' Bytes ' KB ' MB ' GB ' ToDiscKind Measures: ' ----------------------------- ' CD ' CD800 ' CD900 ' DVD ' DVD-DL ' BR ' BR-DL ' BR-3L ' BR-4L ' BR-MD ' BR-MD-DL ' Bytes If FileKindSize.ToUpper = "BYTES" Then If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 737280000 ' CD Standard If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 829440393.216 ' CD 800 MB If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 912383803.392 ' CD 900 MB If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4700000000 ' DVD Standard (DVD5 If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 8500000000 ' DVD Double Layer (DVD9) If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 25025314816 ' BluRay Standard If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 50050629632 ' BluRay Double Layer If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 100103356416 ' BluRay x3 Layers If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 128001769472 ' BluRay x4 Layers If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7791181824 ' BluRay MiniDisc Standard If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 15582363648 ' BluRay MiniDisc Double Layer ' KB ElseIf FileKindSize.ToUpper = "KB" Then If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 720000 ' CD Standard If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 810000.384 ' CD 800 MB If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 890999.808 ' CD 900 MB If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4589843.75 ' DVD Standard (DVD5) If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 8300781.25 ' DVD Double Layer (DVD9) If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 24438784 ' BluRay Standard If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 48877568 ' BluRay Double Layer If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 97757184 ' BluRay x3 Layers If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 125001728 ' BluRay x4 Layers If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7608576 ' BluRay MiniDisc Standard If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 15217152 ' BluRay MiniDisc Double Layer ' MB ElseIf FileKindSize.ToUpper = "MB" Then If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 703.125 ' CD Standard If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 791.016 ' CD 800 MB If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 870.117 ' CD 900 MB If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4482.26929 ' DVD Standard (DVD5) If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 8106.23169 ' DVD Double Layer (DVD9) If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 23866 ' BluRay Standard If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 47732 ' BluRay Double Layer If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 95466 ' BluRay x3 Layers If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 122072 ' BluRay x4 Layers If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7430.25 ' BluRay MiniDisc Standard If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 14860.5 ' BluRay MiniDisc Double Layer ' GB ElseIf FileKindSize.ToUpper = "GB" Then If To_DiscKindCapacity.ToUpper = "CD" Then Return FileSize / 0.68665 ' CD Standard If To_DiscKindCapacity.ToUpper = "CD800" Then Return FileSize / 0.77248 ' CD 800 MB If To_DiscKindCapacity.ToUpper = "CD900" Then Return FileSize / 0.84972 ' CD 900 MB If To_DiscKindCapacity.ToUpper = "DVD" Then Return FileSize / 4.37722 ' DVD Standard (DVD5) If To_DiscKindCapacity.ToUpper = "DVD-DL" Then Return FileSize / 7.91624 ' DVD Double Layer (DVD9) If To_DiscKindCapacity.ToUpper = "BR" Then Return FileSize / 23.30664 ' BluRay Standard If To_DiscKindCapacity.ToUpper = "BR-DL" Then Return FileSize / 46.61328 ' BluRay Double Layer If To_DiscKindCapacity.ToUpper = "BR-3L" Then Return FileSize / 93.22852 ' BluRay x3 Layers If To_DiscKindCapacity.ToUpper = "BR-4L" Then Return FileSize / 119.21094 ' BluRay x4 Layers If To_DiscKindCapacity.ToUpper = "BR-MD" Then Return FileSize / 7.2561 ' BluRay MiniDisc Standard If To_DiscKindCapacity.ToUpper = "BR-MD-DL" Then Return FileSize / 14.51221 ' BluRay MiniDisc Double Layer End If Return Nothing ' Argument measure not found End Function #End Region
|
|
|
9814
|
Programación / .NET (C#, VB.NET, ASP) / Re: [APORTE] Snippets (ACTUALIZADO 21/12/2012)
|
en: 11 Enero 2013, 06:30 am
|
Deberían hacer un post en esta sección que contenga sólamente snippets y donde todos aporten snippets útiles
He hecho este snippet para agilizar el renombramiento de archivos, aquí tienen PD: Uso "MOVE" porque de otra forma es imposible renombrar el archivo con el mismo nombre, como bien está explicado aquí por NovLucker: http://foro.elhacker.net/net/solucionado_iquestcomo_renombrar_un_archivo_o_carpeta_con_el_mismo_nombre-t378839.0.html ' Usage: ' ' RenameFile("C:\Test.txt", "TeSt.TxT") ' RenameFile("C:\Test.txt", "Test", "doc") ' RenameFile(FileInfoObject.FullName, FileInfoObject.Name.ToLower, FileInfoObject.Extension.ToUpper) ' If RenameFile("C:\Test.txt", "TeSt.TxT") Is Nothing Then MsgBox("El archivo no existe!") #Region " RenameFile function " Private Function RenameFile (ByVal File As String, ByVal NewFileName As String, Optional ByVal NewFileExtension As String = Nothing) Try Dim FileToBeRenamed As New System. IO. FileInfo(File) If NewFileExtension Is Nothing Then FileToBeRenamed.MoveTo(FileToBeRenamed.Directory.FullName & "\" & NewFileName) ' Rename file with same extension Else FileToBeRenamed.MoveTo(FileToBeRenamed.Directory.FullName & "\" & NewFileName & NewFileExtension) ' Rename file with new extension End If Return True ' File was renamed OK Catch ex As Exception ' MsgBox(ex.Message) Return False ' File can't be renamed maybe because User Permissions End Try Else Return Nothing ' File doesn't exist End If End Function #End Region
Y unos cuantos más... Modificar atributos de archivos: ' Usage: ' Attrib("File.txt", IO.FileAttributes.ReadOnly + IO.FileAttributes.Hidden) ' If Attrib("File.txt", IO.FileAttributes.System) Is Nothing Then MsgBox("File doesn't exist!") Private Function Attrib (ByVal File As String, ByVal Attributes As System. IO. FileAttributes) Try FileSystem. SetAttr(File, Attributes ) Return True ' File was modified OK Catch ex As Exception ' MsgBox(ex.Message) Return False ' File can't be modified maybe because User Permissions End Try Else Return Nothing ' File doesn't exist End If End Function
Controlar el mismo evento para varios controles: Private Sub Button_Is_Clicked(sender As Object, e As EventArgs) Handles _ Button1.Click, _ Button2.Click, _ Button3.Click Dim Clicked_Button As Button = CType(sender, Button) If Clicked_Button.Name = "Button1" Then ' Things for Button1 ElseIf Clicked_Button.Name = "Button2" Then ' Things for Button2 ElseIf Clicked_Button.Name = "Button3" Then ' Things for Button3 End If Ens Sub
Un link label: ' First add a LinkLabel control into the form. Private Sub LinkLabel_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start("http://www.Google.com") System.Diagnostics.Process.Start("mailto:ME@Hotmail.com") End Sub
Procesar todos los archivos de texto de My.Resources: For Each ResourceFile As DictionaryEntry In My.Resources.ResourceManager.GetResourceSet(Globalization.CultureInfo.CurrentCulture, True, True).OfType(Of Object)() If TypeOf (ResourceFile.Value) Is String Then MsgBox(My.Resources.ResourceManager.GetObject(ResourceFile.Key)) 'MsgBox(ResourceFile.Key) ' Resource Name 'MsgBox(ResourceFile.Value) ' Resource FileContent End If Next
Procesar todos los archivos de imagen de My.Resources: For Each ResourceFile As DictionaryEntry In My.Resources.ResourceManager.GetResourceSet(Globalization.CultureInfo.CurrentCulture, True, True).OfType(Of Object)() If TypeOf (ResourceFile.Value) Is Drawing.Image Then Button_2000_2006.Image = ResourceFile.Value 'MsgBox(ResourceFile.Key) ' Resource Name 'MsgBox(ResourceFile.Value) ' Resource FileContent End If Next
Ordenar un listview al clickar sobre la columna a ordenar: ' Instructions: ' 1. Add the class ' 2. Add the declaration ' 3. Add a listview Dim ColumnOrder As String = "Down" #Region " ListView Sort Column event " Private Sub ListView_ColumnClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ColumnClickEventArgs) Handles ListView1.ColumnClick If ColumnOrder = "Down" Then Me.ListView1.ListViewItemSorter = New OrdenarListview(e.Column, SortOrder.Ascending) ListView1.Sort() ColumnOrder = "Up" ElseIf ColumnOrder = "Up" Then Me.ListView1.ListViewItemSorter = New OrdenarListview(e.Column, SortOrder.Descending) ListView1.Sort() ColumnOrder = "Down" End If End Sub #End Region #Region " OrdenarListView [CLASS] " Public Class OrdenarListview Implements IComparer Private vIndiceColumna As Integer Private vTipoOrden As SortOrder Public Sub New(ByVal pIndiceColumna As Integer, ByVal pTipoOrden As SortOrder) vIndiceColumna = pIndiceColumna vTipoOrden = pTipoOrden End Sub Public Function Ordenar(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare Dim item_x As ListViewItem = DirectCast(x, ListViewItem) Dim item_y As ListViewItem = DirectCast(y, ListViewItem) Dim string_x As String If item_x.SubItems.Count <= vIndiceColumna Then string_x = "" Else string_x = item_x.SubItems(vIndiceColumna).Text End If Dim string_y As String If item_y.SubItems.Count <= vIndiceColumna Then string_y = "" Else string_y = item_y.SubItems(vIndiceColumna).Text End If If vTipoOrden = SortOrder.Ascending Then If IsNumeric(string_x) And IsNumeric(string_y) Then Return Val(string_x).CompareTo(Val(string_y)) ElseIf IsDate(string_x) And IsDate(string_y) Then Return DateTime.Parse(string_x).CompareTo(DateTime.Parse(string_y)) Else Return String.Compare(string_x, string_y) End If Else If IsNumeric(string_x) And IsNumeric(string_y) Then Return Val(string_y).CompareTo(Val(string_x)) ElseIf IsDate(string_x) And IsDate(string_y) Then Return DateTime.Parse(string_y).CompareTo(DateTime.Parse(string_x)) Else Return String.Compare(string_y, string_x) End If End If End Function End Class #End Region
Un ejemplo de un SaveFileDialog: Dim SaveFile As New SaveFileDialog SaveFile.Title = "Save a Report File" SaveFile.InitialDirectory = Environ("programfiles") SaveFile.RestoreDirectory = True SaveFile.DefaultExt = "txt" SaveFile.Filter = "txt file (*.txt)|*.txt" SaveFile.CheckPathExists = True 'SaveFile.CheckFileExists = True 'SaveFile.ShowDialog() If SaveFile.ShowDialog() = DialogResult.OK Then MsgBox(SaveFile.FileName) End If
Centrar un form secundario en el form principal: #Region " CenterForm function " Function CenterForm(ByVal Form_to_Center As Form, ByVal Form_Location As Point) As Point Dim FormLocation As New Point FormLocation.X = (Me.Left + (Me.Width - Form_to_Center.Width) / 2) ' set the X coordinates. FormLocation.Y = (Me.Top + (Me.Height - Form_to_Center.Height) / 2) ' set the Y coordinates. Return FormLocation ' return the Location to the Form it was called from. End Function #End Region ' Form2 Load Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.Location = Form1.centerForm(Me, Me.Location) End Sub ' Private Sub Button_MouseHover(sender As Object, e As EventArgs) Handles Button1.MouseHover ' Form2.Show() ' End Sub ' Private Sub Button_MouseLeave(sender As Object, e As EventArgs) Handles Button1.MouseLeave ' Form2.Dispose() ' End Sub
Saludos!
|
|
|
9816
|
Media / Diseño Gráfico / Re: Busco iconos de años (50s,60s,70s,80s,90s,2000,2001,2002,etc...)
|
en: 11 Enero 2013, 04:25 am
|
Gracias, pero quedaría todo muy "aleatório", no creo que pueda encontrar imagenes de ese estilo con el "año" y que sigan el mismo patrón... eso es lo que quiero evitar.
Saludos!
|
|
|
9818
|
Programación / Programación General / [APORTE] Lección útil para bebés 1.0
|
en: 11 Enero 2013, 03:57 am
|
UPS, ME EQUIVOQUÉ DE SECCIÓN, LO PUEDEN MOVER A VB.NET PORFAVOR? XD SORRY
Estaba ayudando a un user que no sabía como usar una barra de progreso, y bueno, hice este form. Cuando lo completé me dí cuenta de que a mi me habría servido cuando no sabía hacer nada de esto, así que quiero compartirlo por si a alguien le puede servir Con mi ejemplo puedes aprender a...: · Crear / Añadir controles en tiempo de ejecución, · Modificar algunas propiedades de controles · Asociar el evento de un control en tiempo de ejecución a una subrutina · Usar las variables de entorno · Obtener todos los archivos de un directorio · Crear un array y procesar su contenido · Usar y conocer una barra de progreso, · Algunos métodos útiles como "Update"
Eso sí, sin threads, esto es un ejemplo MUY básico. PD: En serio, no quiero comentarios como "Esto no vale nada", si no te gusta no comentes, a un novato le servirá. Public Class Form1 ' Declaro los controles que vamos a usar en este form: Dim Label_Origen As New Label Dim Label_Destino As New Label Dim Label_FileName As New Label Dim Label_Restantes As New Label Dim WithEvents Button_Copiar As New Button Dim ProgressBar_1 As New ProgressBar Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.Size = New Point(420, 320) ' Le otorgo las propiedades a los controles ' ------------------------------------------------------- ' Label Origen Dim Fuente As New Font("Sans Serif", 20, FontStyle.Regular) ' Seteo la fuente personalizada que quiero usar, porque me apetece usar una distinta y así aprendes xD Label_Origen.Font = Fuente Label_Origen.Text = "Origen: " & Environment.GetFolderPath(Environment.SpecialFolder.Windows) & "\Fonts" Label_Origen.AutoSize = False Label_Origen.Size = New Point(640, 40) Label_Origen.Location = New Point(0, 0) ' Label Destino Label_Destino.Font = Fuente Label_Destino.Text = "Destino: " & Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\Test" ' O Environment.SpecialFolder.ProgramFilesX86 Label_Destino.AutoSize = False Label_Destino.Size = New Point(640, 40) Label_Destino.Location = New Point(0, 50) ' Botón Copiar Button_Copiar.Size = New Point(180, 80) Button_Copiar.Text = "Copiar!" Button_Copiar.Location = New Point(100, 100) AddHandler Button_Copiar.Click, AddressOf Button_Copiar_Sub ' Añado el evento "Click" que sucede cuando pinchas el botón, y se llama a la subrutina "Button_Copiar_Sub" ' ProgressBar_1 ProgressBar_1.Size = New Point(180, 20) ProgressBar_1.Location = New Point(100, 200) ' Label FileName Label_FileName.AutoSize = True Label_FileName.Location = New Point(100, 230) ' Label Restantes Label_Restantes.AutoSize = True Label_Restantes.Location = New Point(100, 250) ' Añado los controles al form principal: Me.Controls.Add(Label_Origen) Me.Controls.Add(Label_Destino) Me.Controls.Add(Button_Copiar) Me.Controls.Add(ProgressBar_1) Me.Controls.Add(Label_FileName) Me.Controls.Add(Label_Restantes) End Sub Private Sub Button_Copiar_Sub(sender As Object, e As EventArgs) ' Seteo las variables de origen y destino de carpetas Dim Origen As String = Label_Origen.Text.Split(" ")(1) Dim Destino As String = Label_Destino.Text.Split(" ")(1) ' Creo un array con todos los archivos del directorio de origen Dim Directory As New System.IO.DirectoryInfo(Origen) Dim Array_Files As System.IO.FileInfo() = Directory.GetFiles("*") ' A la progressBar tenemos que darle un valor "Máximo" (SIEMPRE) (El máximo por defecto es 100, pero si tenemos 101 archivos nos joderá porque no podemos sobrepasar el Máximo), ' Ese valor en este caso es el número total de archivos que contiene el directorio. ProgressBar_1.Maximum = Array_Files.Length ' Por cada archivo del Array, sumamos un valor a la ProgressBar, y realizamos las operaciones de copiado o lo que queramos... For Each File In Array_Files Label_FileName. Text = "Archivo copiado: " & File. Name Label_FileName.Update() ' Como no estoy usando threads, tengo que actualizar el estado del label para darle prioridad y que se muestre correctamente, lo cúal ralentiza bastante (BASTANTE) el proceso. Para estas cosas ya te digo que se deben usar Threads + delegados Threading.Thread.Sleep(20) ' Le hago esperar 20 ms a este hilo símplemente para que veas bien como se actualiza el proceso de la barra de progreso. ProgressBar_1.Value += 1 Label_Restantes.Text = "Faltan " & (ProgressBar_1.Maximum - ProgressBar_1.Value) & " archivos por copiarse" Label_Restantes.Update() ' Otra vez el update necesario para poder mostrar el estado del label, más ralentización para el hilo, de verdad, estudia sobre los threads y cuando sepas algo te ayudaré a entenderlos y usarlos. Next ' Devolvemos los valores originales a la ProgressBar y modificamos los valores de los labels ProgressBar_1.Value = 0 ProgressBar_1.Maximum = 100 Label_FileName.Text = Nothing Label_Restantes.Text = "Todos los archivos copiados." End Sub End Class
|
|
|
9819
|
Programación / .NET (C#, VB.NET, ASP) / Re: OMG! ¿Como corrijo esta visualización del Aero?
|
en: 11 Enero 2013, 03:40 am
|
y por cierto esos tonos negros, me dejan ciego... cansa la vista...
Sé que cansan, a mi no me gusta todo tán oscuro, quería buscar la armonía entre "oscuros/grises/casi blancos" para los users que usan AERO y me encuentro con eso!, no me negarás que los tonos DEFAULT blancos de la segunda imagen cansan MUCHO más que los negros de la primera imagen xD. En fin, me decanto por usar groupboxes de terceros como han comentado, y los botones no me queda otra que dejarlos en flat o buscar algún buen botón de terceros que no use los estilos visuales de Windows. Saludos!
|
|
|
9820
|
Programación / .NET (C#, VB.NET, ASP) / Re: OMG! ¿Como corrijo esta visualización del Aero?
|
en: 11 Enero 2013, 01:15 am
|
@NovLucker Segúramente no lo llegaste a leer, pero dije que ya probé a desactivar los estilos visuales, y se ve mucho peor, si lo desactivo, todos los PNG que uso se ven mal. @Spiritdead Quien me iba a decir a mí que para introducirme en .NET y hacer las cosas bien necesitaría ponerme a reinventar todos los controles existentes por un maldito borde... puf! si eso es para gente muy avanzada. @Seba123Neo Siempre uso los colores "WEB" o le pongo "ARGB" customizados, pero no veo que haya ninguna propiedad para cambiar el color de los bordes de los groupboxes... Sé que todos vosotros desarrollais con AERO... por eso pregunto: ¿No os pasa lo mismo en AERO? Para cambiar el color del borde de los botones tengo que ponerlo en "Flat" y ahi ya puedo tocar las propiedades del FlatStyle, pero es que los groupboces...me matan, maldito Aero. Me he informado bastante y he leido que en los forms WPF el borde es incluso mayor, y es mayor en Windows 7 que si ejecutas la misma APP en WinXP, eso es lo que se comenta... Un saludo!
|
|
|
|
|
|
|