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


Tema destacado:


  Mostrar Mensajes
Páginas: 1 ... 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 [910] 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 ... 1253
9091  Programación / .NET (C#, VB.NET, ASP) / Ayuda para traducir una función anónima de C# a VBNET en: 4 Junio 2013, 19:19 pm
Hola

No puedo hallar la manera de traducir esta línea de código por mi mismo, espero que puedan ayudarme.

El problema es en este For, que se usa la función anónima "MyEnumThreadWindowsProc" como un argumento, sin pasarle argumentos a dicha función, y esto no sé traducirlo a VBNET.

Código
  1. foreach (ProcessThread t in p.Threads)
  2. {
  3.  EnumThreadWindows(t.Id, MyEnumThreadWindowsProc, IntPtr.Zero);
  4. }

Los traductores no saben traducirlo corréctamente, y obtengo este reusltado:

Código
  1. For Each t As ProcessThread In p.Threads
  2.  EnumThreadWindows(t.Id, MyEnumThreadWindowsProc, IntPtr.Zero)
  3. Next

Según una persona me ha comentado hace poco, esto podría ser una solución:
Código
  1.   For Each t As ProcessThread In p.Threads
  2.  Dim returnMyEnumThreadWindowsProc As Object
  3.  returnMyEnumThreadWindowsProc = MyEnumThreadWindowsProc ( ... )
  4.  EnumThreadWindows(t.Id, returnMyEnumThreadWindowsProc , IntPtr.Zero)
  5. Next

...Pero aún así sigo con el problema de no saber que parámetros enviarle a "MyEnumThreadWindowsProc " en esa última modificación.



Aquí tienen la class de C#:
Código
  1. using System;
  2. using System.Text;
  3. using System.Runtime.InteropServices;
  4. using System.Diagnostics;
  5.  
  6. namespace TaskbarHide
  7. {
  8.    /// <summary>
  9.    /// Helper class for hiding/showing the taskbar and startmenu on
  10.    /// Windows XP and Vista.
  11.    /// </summary>
  12.    public static class Taskbar
  13.    {
  14.        [DllImport("user32.dll")]
  15.        private static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
  16.        [DllImport("user32.dll", CharSet = CharSet.Auto)]
  17.        private static extern bool EnumThreadWindows(int threadId, EnumThreadProc pfnEnum, IntPtr lParam);
  18.        [DllImport("user32.dll", SetLastError = true)]
  19.        private static extern System.IntPtr FindWindow(string lpClassName, string lpWindowName);
  20.        [DllImport("user32.dll", SetLastError = true)]
  21.        private static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className,  string windowTitle);
  22.        [DllImport("user32.dll")]
  23.        private static extern IntPtr FindWindowEx(IntPtr parentHwnd, IntPtr childAfterHwnd, IntPtr className, string windowText);
  24.        [DllImport("user32.dll")]
  25.        private static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
  26.        [DllImport("user32.dll")]
  27.        private static extern uint GetWindowThreadProcessId(IntPtr hwnd, out int lpdwProcessId);
  28.  
  29.        private const int SW_HIDE = 0;
  30.        private const int SW_SHOW = 5;
  31.  
  32.        private const string VistaStartMenuCaption = "Start";
  33.        private static IntPtr vistaStartMenuWnd = IntPtr.Zero;
  34.        private delegate bool EnumThreadProc(IntPtr hwnd, IntPtr lParam);
  35.  
  36.        /// <summary>
  37.        /// Show the taskbar.
  38.        /// </summary>
  39.        public static void Show()
  40.        {
  41.            SetVisibility(true);
  42.        }
  43.  
  44.        /// <summary>
  45.        /// Hide the taskbar.
  46.        /// </summary>
  47.        public static void Hide()
  48.        {
  49.            SetVisibility(false);
  50.        }
  51.  
  52.        /// <summary>
  53.        /// Sets the visibility of the taskbar.
  54.        /// </summary>
  55.        public static bool Visible
  56.        {
  57.            set { SetVisibility(value); }
  58.        }
  59.  
  60.        /// <summary>
  61.        /// Hide or show the Windows taskbar and startmenu.
  62.        /// </summary>
  63.        /// <param name="show">true to show, false to hide</param>
  64.        private static void SetVisibility(bool show)
  65.        {
  66.            // get taskbar window
  67.            IntPtr taskBarWnd = FindWindow("Shell_TrayWnd", null);
  68.  
  69.            // try it the WinXP way first...
  70.            IntPtr startWnd = FindWindowEx(taskBarWnd, IntPtr.Zero, "Button", "Start");
  71.  
  72.            if (startWnd == IntPtr.Zero)
  73.            {
  74.                // try an alternate way, as mentioned on CodeProject by Earl Waylon Flinn
  75.                startWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, (IntPtr)0xC017, "Start");
  76.            }
  77.  
  78.            if (startWnd == IntPtr.Zero)
  79.            {
  80.                // ok, let's try the Vista easy way...
  81.                startWnd = FindWindow("Button", null);
  82.  
  83.                if (startWnd == IntPtr.Zero)
  84.                {
  85.                    // no chance, we need to to it the hard way...
  86.                    startWnd = GetVistaStartMenuWnd(taskBarWnd);
  87.                }
  88.            }
  89.  
  90.            ShowWindow(taskBarWnd, show ? SW_SHOW : SW_HIDE);
  91.            ShowWindow(startWnd, show ? SW_SHOW : SW_HIDE);
  92.        }
  93.  
  94.        /// <summary>
  95.        /// Returns the window handle of the Vista start menu orb.
  96.        /// </summary>
  97.        /// <param name="taskBarWnd">windo handle of taskbar</param>
  98.        /// <returns>window handle of start menu</returns>
  99.        private static IntPtr GetVistaStartMenuWnd(IntPtr taskBarWnd)
  100.        {
  101.            // get process that owns the taskbar window
  102.            int procId;
  103.            GetWindowThreadProcessId(taskBarWnd, out procId);
  104.  
  105.            Process p = Process.GetProcessById(procId);
  106.            if (p != null)
  107.            {
  108.                // enumerate all threads of that process...
  109.                foreach (ProcessThread t in p.Threads)
  110.                {
  111.                    EnumThreadWindows(t.Id, MyEnumThreadWindowsProc, IntPtr.Zero);
  112.                }
  113.            }
  114.            return vistaStartMenuWnd;
  115.        }
  116.  
  117.        /// <summary>
  118.        /// Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'.
  119.        /// </summary>
  120.        /// <param name="hWnd">window handle</param>
  121.        /// <param name="lParam">parameter</param>
  122.        /// <returns>true to continue enumeration, false to stop it</returns>
  123.        private static bool MyEnumThreadWindowsProc(IntPtr hWnd, IntPtr lParam)
  124.        {
  125.            StringBuilder buffer = new StringBuilder(256);
  126.            if (GetWindowText(hWnd, buffer, buffer.Capacity) > 0)
  127.            {
  128.                Console.WriteLine(buffer);
  129.                if (buffer.ToString() == VistaStartMenuCaption)
  130.                {
  131.                    vistaStartMenuWnd = hWnd;
  132.                    return false;
  133.                }
  134.            }
  135.            return true;
  136.        }
  137.    }
  138. }



Y aquí la class "traducida":

Código
  1. '
  2. ' * Copyright (c) 2008..11 by Simon Baer
  3. ' *
  4. ' *  You may use this code for whatever you want.
  5. '
  6.  
  7.  
  8. Imports System
  9. Imports System.Text
  10. Imports System.Runtime.InteropServices
  11. Imports System.Diagnostics
  12.  
  13. Namespace TaskbarHide
  14.    ''' <summary>
  15.    ''' Helper class for hiding/showing the taskbar and startmenu on
  16.    ''' Windows XP and Vista.
  17.    ''' </summary>
  18.    Public NotInheritable Class Taskbar
  19.        Private Sub New()
  20.        End Sub
  21.        <DllImport("user32.dll")> _
  22.        Private Shared Function GetWindowText(hWnd As IntPtr, text As StringBuilder, count As Integer) As Integer
  23.        End Function
  24.        <DllImport("user32.dll", CharSet := CharSet.Auto)> _
  25.        Private Shared Function EnumThreadWindows(threadId As Integer, pfnEnum As EnumThreadProc, lParam As IntPtr) As Boolean
  26.        End Function
  27.        <DllImport("user32.dll", SetLastError := True)> _
  28.        Private Shared Function FindWindow(lpClassName As String, lpWindowName As String) As System.IntPtr
  29.        End Function
  30.        <DllImport("user32.dll", SetLastError := True)> _
  31.        Private Shared Function FindWindowEx(parentHandle As IntPtr, childAfter As IntPtr, className As String, windowTitle As String) As IntPtr
  32.        End Function
  33.        <DllImport("user32.dll")> _
  34.        Private Shared Function FindWindowEx(parentHwnd As IntPtr, childAfterHwnd As IntPtr, className As IntPtr, windowText As String) As IntPtr
  35.        End Function
  36.        <DllImport("user32.dll")> _
  37.        Private Shared Function ShowWindow(hwnd As IntPtr, nCmdShow As Integer) As Integer
  38.        End Function
  39.        <DllImport("user32.dll")> _
  40.        Private Shared Function GetWindowThreadProcessId(hwnd As IntPtr, lpdwProcessId As Integer) As UInteger
  41.        End Function
  42.  
  43.        Private Const SW_HIDE As Integer = 0
  44.        Private Const SW_SHOW As Integer = 5
  45.  
  46.        Private Const VistaStartMenuCaption As String = "Start"
  47.        Private Shared vistaStartMenuWnd As IntPtr = IntPtr.Zero
  48.        Private Delegate Function EnumThreadProc(hwnd As IntPtr, lParam As IntPtr) As Boolean
  49.  
  50.        ''' <summary>
  51.        ''' Show the taskbar.
  52.        ''' </summary>
  53.        Public Shared Sub Show()
  54.            SetVisibility(True)
  55.        End Sub
  56.  
  57.        ''' <summary>
  58.        ''' Hide the taskbar.
  59.        ''' </summary>
  60.        Public Shared Sub Hide()
  61.            SetVisibility(False)
  62.        End Sub
  63.  
  64.        ''' <summary>
  65.        ''' Sets the visibility of the taskbar.
  66.        ''' </summary>
  67.        Public Shared WriteOnly Property Visible() As Boolean
  68.            Set
  69.                SetVisibility(value)
  70.            End Set
  71.        End Property
  72.  
  73.        ''' <summary>
  74.        ''' Hide or show the Windows taskbar and startmenu.
  75.        ''' </summary>
  76.        ''' <param name="show">true to show, false to hide</param>
  77.        Private Shared Sub SetVisibility(show As Boolean)
  78.            ' get taskbar window
  79.            Dim taskBarWnd As IntPtr = FindWindow("Shell_TrayWnd", Nothing)
  80.  
  81.            ' try it the WinXP way first...
  82.            Dim startWnd As IntPtr = FindWindowEx(taskBarWnd, IntPtr.Zero, "Button", "Start")
  83.  
  84.            If startWnd = IntPtr.Zero Then
  85.                ' try an alternate way, as mentioned on CodeProject by Earl Waylon Flinn
  86.                startWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, DirectCast(&Hc017, IntPtr), "Start")
  87.            End If
  88.  
  89.            If startWnd = IntPtr.Zero Then
  90.                ' ok, let's try the Vista easy way...
  91.                startWnd = FindWindow("Button", Nothing)
  92.  
  93.                If startWnd = IntPtr.Zero Then
  94.                    ' no chance, we need to to it the hard way...
  95.                    startWnd = GetVistaStartMenuWnd(taskBarWnd)
  96.                End If
  97.            End If
  98.  
  99.            ShowWindow(taskBarWnd, If(show, SW_SHOW, SW_HIDE))
  100.            ShowWindow(startWnd, If(show, SW_SHOW, SW_HIDE))
  101.        End Sub
  102.  
  103.        ''' <summary>
  104.        ''' Returns the window handle of the Vista start menu orb.
  105.        ''' </summary>
  106.        ''' <param name="taskBarWnd">windo handle of taskbar</param>
  107.        ''' <returns>window handle of start menu</returns>
  108.        Private Shared Function GetVistaStartMenuWnd(taskBarWnd As IntPtr) As IntPtr
  109.            ' get process that owns the taskbar window
  110.            Dim procId As Integer
  111.            GetWindowThreadProcessId(taskBarWnd, procId)
  112.  
  113.            Dim p As Process = Process.GetProcessById(procId)
  114.            If p IsNot Nothing Then
  115.                ' enumerate all threads of that process...
  116.                For Each t As ProcessThread In p.Threads
  117.                    EnumThreadWindows(t.Id, MyEnumThreadWindowsProc, IntPtr.Zero)
  118.                Next
  119.            End If
  120.            Return vistaStartMenuWnd
  121.        End Function
  122.  
  123.        ''' <summary>
  124.        ''' Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'.
  125.        ''' </summary>
  126.        ''' <param name="hWnd">window handle</param>
  127.        ''' <param name="lParam">parameter</param>
  128.        ''' <returns>true to continue enumeration, false to stop it</returns>
  129.        Private Shared Function MyEnumThreadWindowsProc(hWnd As IntPtr, lParam As IntPtr) As Boolean
  130.            Dim buffer As New StringBuilder(256)
  131.            If GetWindowText(hWnd, buffer, buffer.Capacity) > 0 Then
  132.                Console.WriteLine(buffer)
  133.                If buffer.ToString() = VistaStartMenuCaption Then
  134.                    vistaStartMenuWnd = hWnd
  135.                    Return False
  136.                End If
  137.            End If
  138.            Return True
  139.        End Function
  140.    End Class
  141. End Namespace
  142.  
  143. '=======================================================
  144. 'Service provided by Telerik (www.telerik.com)
  145. 'Conversion powered by NRefactory.
  146. 'Twitter: @telerik, @toddanglin
  147. 'Facebook: facebook.com/telerik
  148. '=======================================================
9092  Programación / .NET (C#, VB.NET, ASP) / Re: Mostrar/Ocultar en: 4 Junio 2013, 19:05 pm
Edito, es codigo de C#

XD tendre que pasarlo a VB.NET

Haz una dll con esa class "taskbar.cs" y luego referencias la dll a tu proyecto y listo.

No intentes traducir el code a VB, no vas a saber ni a poder hacerlo, los traductores online no saben traducirlo,
En el code de C# se llama a una función sin parámetros como si fuese un parámetro en si mismo, y eso en VB no sé como sería el equivalente.

Creo que haré una pregunta sobre como traducir ese maldita código ...sino posteas tu la misma pregunta antes que yo xD
9093  Programación / .NET (C#, VB.NET, ASP) / Re: Mostrar/Ocultar en: 4 Junio 2013, 18:50 pm
Creo que djiste que no era esto, pero si que es:
me imagino que lo que intentabas decir es que tienes la barra de tareas en modo "esconder automáticamente"
y que cuando seleccionas la aplicación en ese momento la barra de tareas se restaura (se vuelve visible)

¿Has probado a modificar la propiedad SHOWINTASKBAR a FALSE como te dije?, si no muestras el icono de la aplicación en el taskbar imagino que el taskbar no tendría motivos para "saltar".

Si eso no es suficiente, entonces como ya te dije hay que usar APIs: http://www.codeproject.com/Articles/25572/Hiding-the-Taskbar-and-Startmenu-start-orb-in-Wind

Código:
Taskbar.Show()
Taskbar.Hide()

Saludos
9094  Programación / .NET (C#, VB.NET, ASP) / Re: Scroll de Imagenes? en: 4 Junio 2013, 14:25 pm
Esto ya está mejor, aunque la parte "alternativa" no está pulida, la parte "progresiva" está sin bugs:



Código
  1. Public Class Form1
  2.  
  3.    Dim Scroll_Position As Int32 = 0
  4.    Dim Button_Down_Is_Pressed As Boolean = False
  5.    Dim Button_Up_Is_Pressed As Boolean = False
  6.    Dim WithEvents Progressive_Scroll_Timer As New Timer
  7.    Dim SmallChange As Int32 = 10
  8.    Dim Largechange As Int32 = 20
  9.    Dim Maximum As Int64 = 0
  10.  
  11.    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  12.        Panel1.AutoScroll = True
  13.        Maximum = Panel1.VerticalScroll.Maximum
  14.        Panel1.AutoScroll = False
  15.        Panel1.VerticalScroll.Maximum = Maximum / 2
  16.        Progressive_Scroll_Timer.Interval = 50
  17.        Panel1.BackColor = Color.FromArgb(150, 0, 0, 0)
  18.  
  19.        For Each PicBox As PictureBox In Panel1.Controls
  20.            AddHandler PicBox.MouseHover, AddressOf Panel_MouseHover
  21.        Next
  22.  
  23.    End Sub
  24.  
  25.    Private Sub Panel_MouseHover(sender As Object, e As EventArgs) Handles Panel1.MouseHover
  26.        sender.select()
  27.        sender.focus()
  28.    End Sub
  29.  
  30.    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Progressive_Scroll_Timer.Tick
  31.        If Button_Down_Is_Pressed Then
  32.            Scroll_Down(SmallChange)
  33.        ElseIf Button_Up_Is_Pressed Then
  34.            Scroll_Up(SmallChange)
  35.        Else
  36.            sender.stop()
  37.        End If
  38.    End Sub
  39.  
  40.    Private Sub Scroll_Up(ByVal Change As Int32)
  41.        Scroll_Position -= Change
  42.        Try
  43.            Panel1.VerticalScroll.Value = Scroll_Position
  44.        Catch
  45.            Scroll_Position = 0
  46.        End Try
  47.    End Sub
  48.  
  49.    Private Sub Scroll_Down(ByVal Change As Int32)
  50.        Scroll_Position += Change
  51.        Try
  52.            Panel1.VerticalScroll.Value = Scroll_Position
  53.        Catch
  54.            Scroll_Position -= Change
  55.        End Try
  56.    End Sub
  57.  
  58.    Private Sub Button_Down_MouseDown(sender As Object, e As MouseEventArgs) Handles Button2.MouseDown
  59.        If e.Button = Windows.Forms.MouseButtons.Left Then
  60.            Button_Down_Is_Pressed = True
  61.            Progressive_Scroll_Timer.Start()
  62.        End If
  63.    End Sub
  64.  
  65.    Private Sub Button_Up_MouseDown(sender As Object, e As MouseEventArgs) Handles Button1.MouseDown
  66.        If e.Button = Windows.Forms.MouseButtons.Left Then
  67.            Button_Up_Is_Pressed = True
  68.            Progressive_Scroll_Timer.Start()
  69.        End If
  70.    End Sub
  71.  
  72.    Private Sub Button_Down_MouseUp(sender As Object, e As MouseEventArgs) Handles Button2.MouseUp
  73.        Button_Down_Is_Pressed = False
  74.    End Sub
  75.  
  76.    Private Sub Button_Up_MouseUp(sender As Object, e As MouseEventArgs) Handles Button1.MouseUp
  77.        Button_Up_Is_Pressed = False
  78.    End Sub
  79.  
  80.    Private Sub Form_MouseWheel(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Panel1.MouseWheel
  81.        Select Case Math.Sign(e.Delta)
  82.            Case Is > 0 : Scroll_Up(Largechange)
  83.            Case Is < 0 : Scroll_Down(Largechange)
  84.        End Select
  85.    End Sub
  86.  
  87.  
  88.  
  89.    ' Versión alternativa:
  90.    Dim PictureBoxes_Height As Int64 = 100 ' La altura de cada picturebox
  91.  
  92.    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  93.        Scroll_Position -= PictureBoxes_Height
  94.        Try
  95.            Panel1.VerticalScroll.Value = Scroll_Position
  96.        Catch
  97.            Panel1.VerticalScroll.Value = 1
  98.            Scroll_Position += PictureBoxes_Height
  99.        End Try
  100.    End Sub
  101.  
  102.    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  103.        Scroll_Position += PictureBoxes_Height
  104.        Try
  105.            Panel1.VerticalScroll.Value = Scroll_Position
  106.        Catch
  107.  
  108.            Scroll_Position -= PictureBoxes_Height
  109.        End Try
  110.    End Sub
  111.    ' Fin de versión alternativa
  112.  
  113. End Class

Código
  1. Public Class DoubleBufferedPanel
  2.    Inherits Panel
  3.  
  4.    Public Sub New()
  5.        DoubleBuffered = True
  6.        ResumeLayout(False)
  7.    End Sub
  8.  
  9.    Protected Overrides ReadOnly Property CreateParams() As CreateParams
  10.        Get
  11.            Dim cp As CreateParams = MyBase.CreateParams
  12.            cp.ExStyle = cp.ExStyle Or &H2000000
  13.            Return cp
  14.        End Get
  15.    End Property
  16.  
  17. End Class
9095  Programación / .NET (C#, VB.NET, ASP) / Re: Crear PictureBox a través de una config .ini? en: 4 Junio 2013, 14:22 pm
ups... me equivoquñe de post al comentar xD (...tienes tantos).

http://foro.elhacker.net/net/scroll_de_imagenes-t391409.0.html;msg1858088#msg1858088

Sorry por el spam.
9096  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 4 Junio 2013, 13:43 pm
Como heredar un control para eliminar al 100% el Flickering en un control Default de un WindowsForm:

(Me he pasado unos 3-5 meses buscando una solución eficaz a esto ...Y aunque esta no es la solución más óptima, funciona y la considero eficaz en el aspecto de que funciona al 100%, pero leer el comentario que he dejado en inglés.)

Código
  1. Public Class Panel_Without_Flickering
  2.  
  3.    Inherits Panel
  4.  
  5.    Public Sub New()
  6.        Me.DoubleBuffered = False
  7.        Me.ResumeLayout(False)
  8.    End Sub
  9.  
  10.    ' Caution:
  11.    ' This turns off any Flicker effect
  12.    ' ...but also reduces the performance (speed) of the control about 30% slower.
  13.    ' This don't affect to the performance of the application, only to the performance of this control.
  14.    Protected Overrides ReadOnly Property CreateParams() As CreateParams
  15.        Get
  16.            Dim cp As CreateParams = MyBase.CreateParams
  17.            cp.ExStyle = cp.ExStyle Or &H2000000
  18.            Return cp
  19.        End Get
  20.    End Property
  21.  
  22. End Class





Un ejemplo hecho por mi de como heredar un control cualquiera, más bien es una especie de plantilla...

Código
  1. Public Class MyControl  ' Name of this control.
  2.  
  3.    Inherits PictureBox ' Name of the inherited control.
  4.  
  5. #Region " New "
  6.  
  7.    Public Sub New()
  8.        Me.DoubleBuffered = True
  9.        Me.SetStyle(ControlStyles.ResizeRedraw, False)
  10.        Me.Name = "MyControl"
  11.        'Me.Text = "Text"
  12.        'Me.Size = New Point(60, 60)
  13.    End Sub
  14.  
  15. #End Region
  16.  
  17. #Region " Properties "
  18.  
  19.    Private _Description As String = String.Empty
  20.  
  21.    ''' <summary>
  22.    ''' Add a description for this control.
  23.    ''' </summary>
  24.    Public Property Description() As String
  25.        Get
  26.            Return _Description
  27.        End Get
  28.        Set(ByVal Value As String)
  29.            Me._Description = Value
  30.        End Set
  31.    End Property
  32.  
  33. #End Region
  34.  
  35. #Region " Event handlers "
  36.  
  37.    ' Private Sub MyControl_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
  38.    '    Me.ForeColor = Color.White
  39.    '    Me.BackColor = Color.CadetBlue
  40.    ' End Sub
  41.  
  42.    ' Protected Overrides Sub OnPaint(ByVal pEvent As PaintEventArgs)
  43.    '    MyBase.OnPaint(pEvent)
  44.    '    If Me.Checked Then
  45.    '       pEvent.Graphics.FillRectangle(New SolidBrush(Color.YellowGreen), New Rectangle(3, 4, 10, 12))
  46.    '    End If
  47.    ' End Sub
  48.  
  49. #End Region
  50.  
  51. #Region " Methods / Functions "
  52.  
  53.    ''' <summary>
  54.    ''' Show the autor of this control.
  55.    ''' </summary>
  56.    Public Sub About()
  57.        MsgBox("Elektro H@cker")
  58.    End Sub
  59.  
  60. #End Region
  61.  
  62. End Class
9097  Programación / .NET (C#, VB.NET, ASP) / Re: Crear PictureBox a través de una config .ini? en: 4 Junio 2013, 08:42 am
Eso es a lo que me refiero y con el code que me distes arriba ya se puede?  :huh:

sip!

Ves haciéndolo y si te surge un problema al leer el valor del ini o al crear los pictureboxes te ayudo de mejor forma

Por cierto, para colocarlos dentro del panel:
Código
  1. panel1.controls.add(MyNewPanel)





PD: ya tienes el dubspet subido en la url que te dije, pero se me jodió la subida 2 veces y el server no tiene "resume" así q he subido solo accesos directos.
9098  Programación / .NET (C#, VB.NET, ASP) / Re: Crear PictureBox a través de una config .ini? en: 3 Junio 2013, 22:31 pm
Pero si cierro la app se va a borrar ese control?

Claro.

No esperes añadir los pictureboxes de forma permanente, eso no puedes hacerlo, es imposible porque en el Source no están declarados, tienes que generar los controles desde el código.

No me parece que séa un problema que al cerrar la app "se eliminen", si al volver a iniciar la app se volverían a generar los controles (crear, nombrar, colocar, redimensionar, lo que quieras) gracias a tu INI.

Saludos
9099  Programación / .NET (C#, VB.NET, ASP) / Re: Crear PictureBox a través de una config .ini? en: 3 Junio 2013, 22:05 pm
Digo, es posible que se creen 300 picture como para hacerlos todos en ejecución?

Si un array de controles de forma dinámica.

A ver no... Las picture box tienen que ser infinitas... Las picturebox se tienen que ir "creando" conforme el usuario vaya instalando Modpacks, (es algo asi como un acceso directo) luego el usuario la selecciona y le da a jugary se ejecuta el juego.  :P

Pues "detecta" el número de modpacks que hay instalados y vas creando en tiempo de ejecución cada picturebox como te expliqué... "For x to NúmeroDeModpacks"

Mírate mi post de snippets de vez en cuando, para algo está:

Código
  1.    Dim chk_() As CheckBox
  2.  
  3.    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  4.  
  5.        Dim Array_Size As Integer = 300 'change this for the number of controls that will appear
  6.        ReDim chk_(Array_Size)
  7.  
  8.        For chk_num = 0 To Array_Size
  9.            Application.DoEvents()
  10.            chk_(chk_num) = New CheckBox
  11.            chk_(chk_num).Text = "Checkbox " + chk_num.ToString
  12.            chk_(chk_num).Top = 20 * chk_num
  13.            Me.Controls.Add(chk_(chk_num))
  14.        Next
  15.  
  16.    End Sub

300 pictureboxes o cuantos quieras

Salu2

9100  Programación / .NET (C#, VB.NET, ASP) / Re: Crear PictureBox a través de una config .ini? en: 3 Junio 2013, 20:47 pm
Puedes definir el número de pictureboxes que serán, guardas ese número en el ini, y lo lees...

Código
  1. For i as int32 = 1 to (valor)
  2.   generar checkboxes
  3. loop

no se si te refieres a hacer eso,
mañana hablamos por skype
Páginas: 1 ... 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 [910] 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 ... 1253
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines