8922
Programación / Programación General / Re: Duda sobre lenguajes
en: 4 Junio 2013, 21:42 pm
No sé si me entiendes... no quiero que el lenguaje acepte que cada uno organice el código como le salga de las narices (cosa que Python no hace, sólo daba un ejemplo)
Ahora lo entiendo mejor, creia que solo estaba relacionado con los espacios de los comentarios,
pues VB.NET no permite escribir nada con espacios (ningún keyword), si escribes espacios demás te lo organiza automáticamente, séa lo que séa, menos cadenas de strings cerradas con comillas dobles (obvio) xD.
Pruébalo!
Un saludo.
8923
Programación / Programación General / Re: Duda sobre lenguajes
en: 4 Junio 2013, 21:25 pm
No entiendo la lógica de la pregunta.
Python:
print "Hola" # Perfectamente valido...
Los lenguajes permiten líneas de comentario, ya sea encima del bloque, debajo, o al final de una línea,
De hecho unos buenos comentarios es lo que perfecciona la organización del código en si mismo.
De verdad, yo no lo véo lógica a la pregunta, o a lo mejor es que he entendido mal...
...pero desde luego si yo supiera C# hasta cierto punto, ni loco me cambiaria por un lenguaje de scripting, aunque séa Python, de hecho el que menos sería Python porque es demasiado restrictivo y para escribir códigos cortos a lo "pseudo" o para escribir 4 tonterías para probar una cosa pequeña te puedes tirar varios minutos corrigiendo ya que hay que escribirlo todo sin imperfecciones, al más mínimo detalle, sin poder equivocarse en el margen de ni un solo espacio! ...Python será organizado, pero desde luego no lo considero productivo, a la larga hace perder el tiempo.
Saludos!
8924
Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets)
en: 4 Junio 2013, 20:41 pm
Taskbar Hide-Show
Oculta o desoculta la barra de tareas de Windows.
#Region " Taskbar Hide-Show "
' [ Taskbar Hide-Show]
'
' Examples :
'
' Taskbar.Hide()
' Taskbar.Show()
#End Region
' Taskbar.vb
#Region " Taskbar Class "
''' <summary>
''' Helper class for hiding/showing the taskbar and startmenu on
''' Windows XP and Vista.
''' </summary>
Public Class Taskbar
<System.Runtime .InteropServices .DllImport ( "user32.dll" ) > _
Private Shared Function GetWindowText( hWnd As IntPtr, text As System.Text .StringBuilder , count As Integer ) As Integer
End Function
<System.Runtime .InteropServices .DllImport ( "user32.dll" , CharSet:= System.Runtime .InteropServices .CharSet .Auto ) > _
Private Shared Function EnumThreadWindows( threadId As Integer , pfnEnum As EnumThreadProc, lParam As IntPtr) As Boolean
End Function
<System.Runtime .InteropServices .DllImport ( "user32.dll" , SetLastError:= True ) > _
Private Shared Function FindWindow( lpClassName As String , lpWindowName As String ) As System.IntPtr
End Function
<System.Runtime .InteropServices .DllImport ( "user32.dll" , SetLastError:= True ) > _
Private Shared Function FindWindowEx( parentHandle As IntPtr, childAfter As IntPtr, className As String , windowTitle As String ) As IntPtr
End Function
<System.Runtime .InteropServices .DllImport ( "user32.dll" ) > _
Private Shared Function FindWindowEx( parentHwnd As IntPtr, childAfterHwnd As IntPtr, className As IntPtr, windowText As String ) As IntPtr
End Function
<System.Runtime .InteropServices .DllImport ( "user32.dll" ) > _
Private Shared Function ShowWindow( hwnd As IntPtr, nCmdShow As Integer ) As Integer
End Function
<System.Runtime .InteropServices .DllImport ( "user32.dll" ) > _
Private Shared Function GetWindowThreadProcessId( hwnd As IntPtr, lpdwProcessId As Integer ) As UInteger
End Function
Private Const SW_HIDE As Integer = 0
Private Const SW_SHOW As Integer = 5
Private Const VistaStartMenuCaption As String = "Start"
Private Shared vistaStartMenuWnd As IntPtr = IntPtr.Zero
Private Delegate Function EnumThreadProc( hwnd As IntPtr, lParam As IntPtr) As Boolean
''' <summary>
''' Show the taskbar.
''' </summary>
Public Shared Sub Show( )
SetVisibility( True )
End Sub
''' <summary>
''' Hide the taskbar.
''' </summary>
Public Shared Sub Hide ( )
SetVisibility( False )
End Sub
''' <summary>
''' Sets the visibility of the taskbar.
''' </summary>
Private Shared WriteOnly Property Visible( ) As Boolean
Set ( value As Boolean )
SetVisibility( value)
End Set
End Property
''' <summary>
''' Hide or show the Windows taskbar and startmenu.
''' </summary>
''' <param name="show">true to show, false to hide</param>
Private Shared Sub SetVisibility( show As Boolean )
' get taskbar window
Dim taskBarWnd As IntPtr = FindWindow( "Shell_TrayWnd" , Nothing )
' Try the Windows XP TaskBar:
Dim startWnd As IntPtr = FindWindowEx( taskBarWnd, IntPtr.Zero , "Button" , "Start" )
If startWnd = IntPtr.Zero Then
' Try an alternate way of Windows XP TaskBar:
startWnd = FindWindowEx( IntPtr.Zero , IntPtr.Zero , CType ( & HC017, IntPtr) , "Start" )
End If
If startWnd = IntPtr.Zero Then
' Try the Windows Vista/7 TaskBar:
startWnd = FindWindow( "Button" , Nothing )
If startWnd = IntPtr.Zero Then
' Try an alternate way of Windows Vista/7 TaskBar:
startWnd = GetVistaStartMenuWnd( taskBarWnd)
End If
End If
ShowWindow( taskBarWnd, If ( show, SW_SHOW, SW_HIDE) )
ShowWindow( startWnd, If ( show, SW_SHOW, SW_HIDE) )
End Sub
''' <summary>
''' Returns the window handle of the Vista start menu orb.
''' </summary>
''' <param name="taskBarWnd">windo handle of taskbar</param>
''' <returns>window handle of start menu</returns>
Private Shared Function GetVistaStartMenuWnd( taskBarWnd As IntPtr) As IntPtr
' get process that owns the taskbar window
Dim procId As Integer
GetWindowThreadProcessId( taskBarWnd, procId)
Dim p As Process = Process.GetProcessById ( procId)
If p IsNot Nothing Then
' enumerate all threads of that process...
For Each t As ProcessThread In p.Threads
EnumThreadWindows( t.Id , AddressOf MyEnumThreadWindowsProc, IntPtr.Zero )
Next
End If
Return vistaStartMenuWnd
End Function
''' <summary>
''' Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'.
''' </summary>
''' <param name="hWnd">window handle</param>
''' <param name="lParam">parameter</param>
''' <returns>true to continue enumeration, false to stop it</returns>
Private Shared Function MyEnumThreadWindowsProc( hWnd As IntPtr, lParam As IntPtr) As Boolean
Dim buffer As New System.Text .StringBuilder ( 256 )
If GetWindowText( hWnd, buffer, buffer.Capacity ) > 0 Then
Console.WriteLine ( buffer)
If buffer.ToString ( ) = VistaStartMenuCaption Then
vistaStartMenuWnd = hWnd
Return False
End If
End If
Return True
End Function
End Class
#End Region
8925
Programación / .NET (C#, VB.NET, ASP) / Re: Ayuda para traducir una función anónima de C# a VBNET
en: 4 Junio 2013, 20:13 pm
Bueno, aquí les dejo el código convertido a vbnet, ya lo conseguí:
Imports System
Imports System.Text
Imports System.Runtime .InteropServices
Imports System.Diagnostics
Namespace TaskbarHide
''' <summary>
''' Helper class for hiding/showing the taskbar and startmenu on
''' Windows XP and Vista.
''' </summary>
Public NotInheritable Class Taskbar
Private Sub New ( )
End Sub
<DllImport( "user32.dll" ) > _
Private Shared Function GetWindowText( hWnd As IntPtr, text As StringBuilder, count As Integer ) As Integer
End Function
<DllImport( "user32.dll" , CharSet:= CharSet.Auto ) > _
Private Shared Function EnumThreadWindows( threadId As Integer , pfnEnum As EnumThreadProc, lParam As IntPtr) As Boolean
End Function
<DllImport( "user32.dll" , SetLastError:= True ) > _
Private Shared Function FindWindow( lpClassName As String , lpWindowName As String ) As System.IntPtr
End Function
<DllImport( "user32.dll" , SetLastError:= True ) > _
Private Shared Function FindWindowEx( parentHandle As IntPtr, childAfter As IntPtr, className As String , windowTitle As String ) As IntPtr
End Function
<DllImport( "user32.dll" ) > _
Private Shared Function FindWindowEx( parentHwnd As IntPtr, childAfterHwnd As IntPtr, className As IntPtr, windowText As String ) As IntPtr
End Function
<DllImport( "user32.dll" ) > _
Private Shared Function ShowWindow( hwnd As IntPtr, nCmdShow As Integer ) As Integer
End Function
<DllImport( "user32.dll" ) > _
Private Shared Function GetWindowThreadProcessId( hwnd As IntPtr, lpdwProcessId As Integer ) As UInteger
End Function
Private Const SW_HIDE As Integer = 0
Private Const SW_SHOW As Integer = 5
Private Const VistaStartMenuCaption As String = "Start"
Private Shared vistaStartMenuWnd As IntPtr = IntPtr.Zero
Private Delegate Function EnumThreadProc( hwnd As IntPtr, lParam As IntPtr) As Boolean
''' <summary>
''' Show the taskbar.
''' </summary>
Public Shared Sub Show( )
SetVisibility( True )
End Sub
''' <summary>
''' Hide the taskbar.
''' </summary>
Public Shared Sub Hide ( )
SetVisibility( False )
End Sub
''' <summary>
''' Sets the visibility of the taskbar.
''' </summary>
Public Shared WriteOnly Property Visible( ) As Boolean
Set ( value As Boolean )
SetVisibility( value)
End Set
End Property
''' <summary>
''' Hide or show the Windows taskbar and startmenu.
''' </summary>
''' <param name="show">true to show, false to hide</param>
Private Shared Sub SetVisibility( show As Boolean )
' get taskbar window
Dim taskBarWnd As IntPtr = FindWindow( "Shell_TrayWnd" , Nothing )
' try it the WinXP way first...
Dim startWnd As IntPtr = FindWindowEx( taskBarWnd, IntPtr.Zero , "Button" , "Start" )
If startWnd = IntPtr.Zero Then
' try an alternate way, as mentioned on CodeProject by Earl Waylon Flinn
startWnd = FindWindowEx( IntPtr.Zero , IntPtr.Zero , CType ( & HC017, IntPtr) , "Start" )
End If
If startWnd = IntPtr.Zero Then
' ok, let's try the Vista easy way...
startWnd = FindWindow( "Button" , Nothing )
If startWnd = IntPtr.Zero Then
' no chance, we need to to it the hard way...
startWnd = GetVistaStartMenuWnd( taskBarWnd)
End If
End If
ShowWindow( taskBarWnd, If ( show, SW_SHOW, SW_HIDE) )
ShowWindow( startWnd, If ( show, SW_SHOW, SW_HIDE) )
End Sub
''' <summary>
''' Returns the window handle of the Vista start menu orb.
''' </summary>
''' <param name="taskBarWnd">windo handle of taskbar</param>
''' <returns>window handle of start menu</returns>
Private Shared Function GetVistaStartMenuWnd( taskBarWnd As IntPtr) As IntPtr
' get process that owns the taskbar window
Dim procId As Integer
GetWindowThreadProcessId( taskBarWnd, procId)
Dim p As Process = Process.GetProcessById ( procId)
If p IsNot Nothing Then
' enumerate all threads of that process...
For Each t As ProcessThread In p.Threads
EnumThreadWindows( t.Id , AddressOf MyEnumThreadWindowsProc, IntPtr.Zero )
Next
End If
Return vistaStartMenuWnd
End Function
''' <summary>
''' Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'.
''' </summary>
''' <param name="hWnd">window handle</param>
''' <param name="lParam">parameter</param>
''' <returns>true to continue enumeration, false to stop it</returns>
Private Shared Function MyEnumThreadWindowsProc( hWnd As IntPtr, lParam As IntPtr) As Boolean
Dim buffer As New StringBuilder( 256 )
If GetWindowText( hWnd, buffer, buffer.Capacity ) > 0 Then
Console.WriteLine ( buffer)
If buffer.ToString ( ) = VistaStartMenuCaption Then
vistaStartMenuWnd = hWnd
Return False
End If
End If
Return True
End Function
End Class
End Namespace
8926
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.
foreach ( ProcessThread t in p. Threads )
{
EnumThreadWindows( t. Id , MyEnumThreadWindowsProc, IntPtr. Zero ) ;
}
Los traductores no saben traducirlo corréctamente, y obtengo este reusltado:
For Each t As ProcessThread In p.Threads
EnumThreadWindows( t.Id , MyEnumThreadWindowsProc, IntPtr.Zero )
Next
Según una persona me ha comentado hace poco, esto podría ser una solución:
For Each t As ProcessThread In p.Threads
Dim returnMyEnumThreadWindowsProc As Object
returnMyEnumThreadWindowsProc = MyEnumThreadWindowsProc ( ... )
EnumThreadWindows( t.Id , returnMyEnumThreadWindowsProc , IntPtr.Zero )
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#:
using System ;
using System.Text ;
using System.Runtime.InteropServices ;
using System.Diagnostics ;
namespace TaskbarHide
{
/// <summary>
/// Helper class for hiding/showing the taskbar and startmenu on
/// Windows XP and Vista.
/// </summary>
public static class Taskbar
{
[ DllImport( "user32.dll" ) ]
private static extern int GetWindowText( IntPtr hWnd, StringBuilder text, int count) ;
[ DllImport( "user32.dll" , CharSet = CharSet. Auto ) ]
private static extern bool EnumThreadWindows( int threadId, EnumThreadProc pfnEnum, IntPtr lParam) ;
[ DllImport( "user32.dll" , SetLastError = true ) ]
private static extern System . IntPtr FindWindow( string lpClassName, string lpWindowName) ;
[ DllImport( "user32.dll" , SetLastError = true ) ]
private static extern IntPtr FindWindowEx( IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle) ;
[ DllImport( "user32.dll" ) ]
private static extern IntPtr FindWindowEx( IntPtr parentHwnd, IntPtr childAfterHwnd, IntPtr className, string windowText) ;
[ DllImport( "user32.dll" ) ]
private static extern int ShowWindow( IntPtr hwnd, int nCmdShow) ;
[ DllImport( "user32.dll" ) ]
private static extern uint GetWindowThreadProcessId( IntPtr hwnd, out int lpdwProcessId) ;
private const int SW_HIDE = 0 ;
private const int SW_SHOW = 5 ;
private const string VistaStartMenuCaption = "Start" ;
private static IntPtr vistaStartMenuWnd = IntPtr. Zero ;
private delegate bool EnumThreadProc( IntPtr hwnd, IntPtr lParam) ;
/// <summary>
/// Show the taskbar.
/// </summary>
public static void Show( )
{
SetVisibility( true ) ;
}
/// <summary>
/// Hide the taskbar.
/// </summary>
public static void Hide( )
{
SetVisibility( false ) ;
}
/// <summary>
/// Sets the visibility of the taskbar.
/// </summary>
public static bool Visible
{
set { SetVisibility( value) ; }
}
/// <summary>
/// Hide or show the Windows taskbar and startmenu.
/// </summary>
/// <param name="show">true to show, false to hide</param>
private static void SetVisibility( bool show)
{
// get taskbar window
IntPtr taskBarWnd = FindWindow( "Shell_TrayWnd" , null ) ;
// try it the WinXP way first...
IntPtr startWnd = FindWindowEx( taskBarWnd, IntPtr. Zero , "Button" , "Start" ) ;
if ( startWnd == IntPtr. Zero )
{
// try an alternate way, as mentioned on CodeProject by Earl Waylon Flinn
startWnd = FindWindowEx( IntPtr. Zero , IntPtr. Zero , ( IntPtr) 0xC017, "Start" ) ;
}
if ( startWnd == IntPtr. Zero )
{
// ok, let's try the Vista easy way...
startWnd = FindWindow( "Button" , null ) ;
if ( startWnd == IntPtr. Zero )
{
// no chance, we need to to it the hard way...
startWnd = GetVistaStartMenuWnd( taskBarWnd) ;
}
}
ShowWindow( taskBarWnd, show ? SW_SHOW : SW_HIDE) ;
ShowWindow( startWnd, show ? SW_SHOW : SW_HIDE) ;
}
/// <summary>
/// Returns the window handle of the Vista start menu orb.
/// </summary>
/// <param name="taskBarWnd">windo handle of taskbar</param>
/// <returns>window handle of start menu</returns>
private static IntPtr GetVistaStartMenuWnd( IntPtr taskBarWnd)
{
// get process that owns the taskbar window
int procId;
GetWindowThreadProcessId( taskBarWnd, out procId) ;
Process p = Process. GetProcessById ( procId) ;
if ( p != null )
{
// enumerate all threads of that process...
foreach ( ProcessThread t in p. Threads )
{
EnumThreadWindows( t. Id , MyEnumThreadWindowsProc, IntPtr. Zero ) ;
}
}
return vistaStartMenuWnd;
}
/// <summary>
/// Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'.
/// </summary>
/// <param name="hWnd">window handle</param>
/// <param name="lParam">parameter</param>
/// <returns>true to continue enumeration, false to stop it</returns>
private static bool MyEnumThreadWindowsProc( IntPtr hWnd, IntPtr lParam)
{
StringBuilder buffer
= new StringBuilder
( 256 ) ; if ( GetWindowText( hWnd, buffer, buffer. Capacity ) > 0 )
{
Console. WriteLine ( buffer) ;
if ( buffer. ToString ( ) == VistaStartMenuCaption)
{
vistaStartMenuWnd = hWnd;
return false ;
}
}
return true ;
}
}
}
Y aquí la class "traducida":
'
' * Copyright (c) 2008..11 by Simon Baer
' *
' * You may use this code for whatever you want.
'
Imports System
Imports System.Text
Imports System.Runtime .InteropServices
Imports System.Diagnostics
Namespace TaskbarHide
''' <summary>
''' Helper class for hiding/showing the taskbar and startmenu on
''' Windows XP and Vista.
''' </summary>
Public NotInheritable Class Taskbar
Private Sub New ( )
End Sub
<DllImport( "user32.dll" ) > _
Private Shared Function GetWindowText( hWnd As IntPtr, text As StringBuilder, count As Integer ) As Integer
End Function
<DllImport( "user32.dll" , CharSet := CharSet.Auto ) > _
Private Shared Function EnumThreadWindows( threadId As Integer , pfnEnum As EnumThreadProc, lParam As IntPtr) As Boolean
End Function
<DllImport( "user32.dll" , SetLastError := True ) > _
Private Shared Function FindWindow( lpClassName As String , lpWindowName As String ) As System.IntPtr
End Function
<DllImport( "user32.dll" , SetLastError := True ) > _
Private Shared Function FindWindowEx( parentHandle As IntPtr, childAfter As IntPtr, className As String , windowTitle As String ) As IntPtr
End Function
<DllImport( "user32.dll" ) > _
Private Shared Function FindWindowEx( parentHwnd As IntPtr, childAfterHwnd As IntPtr, className As IntPtr, windowText As String ) As IntPtr
End Function
<DllImport( "user32.dll" ) > _
Private Shared Function ShowWindow( hwnd As IntPtr, nCmdShow As Integer ) As Integer
End Function
<DllImport( "user32.dll" ) > _
Private Shared Function GetWindowThreadProcessId( hwnd As IntPtr, lpdwProcessId As Integer ) As UInteger
End Function
Private Const SW_HIDE As Integer = 0
Private Const SW_SHOW As Integer = 5
Private Const VistaStartMenuCaption As String = "Start"
Private Shared vistaStartMenuWnd As IntPtr = IntPtr.Zero
Private Delegate Function EnumThreadProc( hwnd As IntPtr, lParam As IntPtr) As Boolean
''' <summary>
''' Show the taskbar.
''' </summary>
Public Shared Sub Show( )
SetVisibility( True )
End Sub
''' <summary>
''' Hide the taskbar.
''' </summary>
Public Shared Sub Hide ( )
SetVisibility( False )
End Sub
''' <summary>
''' Sets the visibility of the taskbar.
''' </summary>
Public Shared WriteOnly Property Visible( ) As Boolean
Set
SetVisibility( value)
End Set
End Property
''' <summary>
''' Hide or show the Windows taskbar and startmenu.
''' </summary>
''' <param name="show">true to show, false to hide</param>
Private Shared Sub SetVisibility( show As Boolean )
' get taskbar window
Dim taskBarWnd As IntPtr = FindWindow( "Shell_TrayWnd" , Nothing )
' try it the WinXP way first...
Dim startWnd As IntPtr = FindWindowEx( taskBarWnd, IntPtr.Zero , "Button" , "Start" )
If startWnd = IntPtr.Zero Then
' try an alternate way, as mentioned on CodeProject by Earl Waylon Flinn
startWnd = FindWindowEx( IntPtr.Zero , IntPtr.Zero , DirectCast( & Hc017, IntPtr) , "Start" )
End If
If startWnd = IntPtr.Zero Then
' ok, let's try the Vista easy way...
startWnd = FindWindow( "Button" , Nothing )
If startWnd = IntPtr.Zero Then
' no chance, we need to to it the hard way...
startWnd = GetVistaStartMenuWnd( taskBarWnd)
End If
End If
ShowWindow( taskBarWnd, If ( show, SW_SHOW, SW_HIDE) )
ShowWindow( startWnd, If ( show, SW_SHOW, SW_HIDE) )
End Sub
''' <summary>
''' Returns the window handle of the Vista start menu orb.
''' </summary>
''' <param name="taskBarWnd">windo handle of taskbar</param>
''' <returns>window handle of start menu</returns>
Private Shared Function GetVistaStartMenuWnd( taskBarWnd As IntPtr) As IntPtr
' get process that owns the taskbar window
Dim procId As Integer
GetWindowThreadProcessId( taskBarWnd, procId)
Dim p As Process = Process.GetProcessById ( procId)
If p IsNot Nothing Then
' enumerate all threads of that process...
For Each t As ProcessThread In p.Threads
EnumThreadWindows( t.Id , MyEnumThreadWindowsProc, IntPtr.Zero )
Next
End If
Return vistaStartMenuWnd
End Function
''' <summary>
''' Callback method that is called from 'EnumThreadWindows' in 'GetVistaStartMenuWnd'.
''' </summary>
''' <param name="hWnd">window handle</param>
''' <param name="lParam">parameter</param>
''' <returns>true to continue enumeration, false to stop it</returns>
Private Shared Function MyEnumThreadWindowsProc( hWnd As IntPtr, lParam As IntPtr) As Boolean
Dim buffer As New StringBuilder( 256 )
If GetWindowText( hWnd, buffer, buffer.Capacity ) > 0 Then
Console.WriteLine ( buffer)
If buffer.ToString ( ) = VistaStartMenuCaption Then
vistaStartMenuWnd = hWnd
Return False
End If
End If
Return True
End Function
End Class
End Namespace
'=======================================================
'Service provided by Telerik (www.telerik.com)
'Conversion powered by NRefactory.
'Twitter: @telerik, @toddanglin
'Facebook: facebook.com/telerik
'=======================================================
8927
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
8928
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 Taskbar.Show() Taskbar.Hide() Saludos
8929
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:
VIDEO Public Class Form1
Dim Scroll_Position As Int32 = 0
Dim Button_Down_Is_Pressed As Boolean = False
Dim Button_Up_Is_Pressed As Boolean = False
Dim WithEvents Progressive_Scroll_Timer As New Timer
Dim SmallChange As Int32 = 10
Dim Largechange As Int32 = 20
Dim Maximum As Int64 = 0
Private Sub Form1_Load( sender As Object , e As EventArgs) Handles MyBase .Load
Panel1.AutoScroll = True
Maximum = Panel1.VerticalScroll .Maximum
Panel1.AutoScroll = False
Panel1.VerticalScroll .Maximum = Maximum / 2
Progressive_Scroll_Timer.Interval = 50
Panel1.BackColor = Color.FromArgb ( 150 , 0 , 0 , 0 )
For Each PicBox As PictureBox In Panel1.Controls
AddHandler PicBox.MouseHover , AddressOf Panel_MouseHover
Next
End Sub
Private Sub Panel_MouseHover( sender As Object , e As EventArgs) Handles Panel1.MouseHover
sender.select ( )
sender.focus ( )
End Sub
Private Sub Timer1_Tick( sender As Object , e As EventArgs) Handles Progressive_Scroll_Timer.Tick
If Button_Down_Is_Pressed Then
Scroll_Down( SmallChange)
ElseIf Button_Up_Is_Pressed Then
Scroll_Up( SmallChange)
Else
sender.stop ( )
End If
End Sub
Private Sub Scroll_Up( ByVal Change As Int32)
Scroll_Position -= Change
Try
Panel1.VerticalScroll .Value = Scroll_Position
Catch
Scroll_Position = 0
End Try
End Sub
Private Sub Scroll_Down( ByVal Change As Int32)
Scroll_Position += Change
Try
Panel1.VerticalScroll .Value = Scroll_Position
Catch
Scroll_Position -= Change
End Try
End Sub
Private Sub Button_Down_MouseDown( sender As Object , e As MouseEventArgs) Handles Button2.MouseDown
If e.Button = Windows.Forms .MouseButtons .Left Then
Button_Down_Is_Pressed = True
Progressive_Scroll_Timer.Start ( )
End If
End Sub
Private Sub Button_Up_MouseDown( sender As Object , e As MouseEventArgs) Handles Button1.MouseDown
If e.Button = Windows.Forms .MouseButtons .Left Then
Button_Up_Is_Pressed = True
Progressive_Scroll_Timer.Start ( )
End If
End Sub
Private Sub Button_Down_MouseUp( sender As Object , e As MouseEventArgs) Handles Button2.MouseUp
Button_Down_Is_Pressed = False
End Sub
Private Sub Button_Up_MouseUp( sender As Object , e As MouseEventArgs) Handles Button1.MouseUp
Button_Up_Is_Pressed = False
End Sub
Private Sub Form_MouseWheel( ByVal sender As Object , ByVal e As MouseEventArgs) Handles Panel1.MouseWheel
Select Case Math.Sign ( e.Delta )
Case Is > 0 : Scroll_Up( Largechange)
Case Is < 0 : Scroll_Down( Largechange)
End Select
End Sub
' Versión alternativa:
Dim PictureBoxes_Height As Int64 = 100 ' La altura de cada picturebox
Private Sub Button3_Click( sender As Object , e As EventArgs) Handles Button3.Click
Scroll_Position -= PictureBoxes_Height
Try
Panel1.VerticalScroll .Value = Scroll_Position
Catch
Panel1.VerticalScroll .Value = 1
Scroll_Position += PictureBoxes_Height
End Try
End Sub
Private Sub Button4_Click( sender As Object , e As EventArgs) Handles Button4.Click
Scroll_Position += PictureBoxes_Height
Try
Panel1.VerticalScroll .Value = Scroll_Position
Catch
Scroll_Position -= PictureBoxes_Height
End Try
End Sub
' Fin de versión alternativa
End Class
Public Class DoubleBufferedPanel
Inherits Panel
Public Sub New ( )
DoubleBuffered = True
ResumeLayout( False )
End Sub
Protected Overrides ReadOnly Property CreateParams( ) As CreateParams
Get
Dim cp As CreateParams = MyBase .CreateParams
cp.ExStyle = cp.ExStyle Or & H2000000
Return cp
End Get
End Property
End Class