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

 

 


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  Sacar el color del Pixel que se ha pulsado con VB.NET
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Sacar el color del Pixel que se ha pulsado con VB.NET  (Leído 2,922 veces)
z3nth10n


Desconectado Desconectado

Mensajes: 1.583


"Jack of all trades, master of none." - Zenthion


Ver Perfil WWW
Sacar el color del Pixel que se ha pulsado con VB.NET
« en: 17 Julio 2013, 22:19 pm »

Hola buenas, es posible lo que intento hacer o es una locura?

Un saludo. ;)


En línea


Interesados hablad por Discord.
Eleкtro
Ex-Staff
*
Desconectado Desconectado

Mensajes: 9.788



Ver Perfil
Re: Sacar el color del Pixel que se ha pulsado con VB.NET
« Respuesta #1 en: 17 Julio 2013, 23:57 pm »

Hola buenas, es posible lo que intento hacer o es una locura?

Se puede hacer -> [SOURCE] Color.NET Autor: EleKtro H@cker



Código
  1. #Region " Get Pixel Color "
  2.  
  3.    ' [ Get Pixel Color Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.    ' Dim RGB As Color = Get_Pixel_Color(MousePosition.X, MousePosition.Y, ColorType.RGB)
  10.    ' MsgBox(Get_Pixel_Color(100, 100, ColorType.RGB).ToString)
  11.    ' MsgBox(Get_Pixel_Color(100, 100, ColorType.HEX))
  12.    ' MsgBox(Get_Pixel_Color(100, 100, ColorType.HTML))
  13.  
  14.    <System.Runtime.InteropServices.DllImport("user32.dll")> Shared Function GetDC(hwnd As IntPtr) As IntPtr
  15.    End Function
  16.  
  17.    <System.Runtime.InteropServices.DllImport("user32.dll")> Shared Function ReleaseDC(hwnd As IntPtr, hdc As IntPtr) As Int32
  18.    End Function
  19.  
  20.    <System.Runtime.InteropServices.DllImport("gdi32.dll")> Shared Function GetPixel(hdc As IntPtr, nXPos As Integer, nYPos As Integer) As UInteger
  21.    End Function
  22.  
  23.    Public Enum ColorType
  24.        RGB
  25.        HEX
  26.        HTML
  27.    End Enum
  28.  
  29.    Public Function Get_Pixel_Color(ByVal x As Int32, ByVal y As Int32, ByVal ColorType As ColorType)
  30.  
  31.        Dim hdc As IntPtr = GetDC(IntPtr.Zero)
  32.        Dim pixel As UInteger = GetPixel(hdc, x, y)
  33.        ReleaseDC(IntPtr.Zero, hdc)
  34.  
  35.        Dim RGB As Color = Color.FromArgb(CType((pixel And &HFF), Integer), CType((pixel And &HFF00), Integer) >> 8, CType((pixel And &HFF0000), Integer) >> 16)
  36.        Dim R As Int16 = RGB.R, G As Int16 = RGB.G, B As Int16 = RGB.B
  37.        Dim HEX_R As String, HEX_G As String, HEX_B As String
  38.  
  39.        Select Case ColorType
  40.            Case ColorType.RGB : Return RGB
  41.            Case ColorType.HEX
  42.                If Hex(R) = Hex(0) Then HEX_R = "00" Else HEX_R = Hex(R)
  43.                If Hex(G) = Hex(0) Then HEX_G = "00" Else HEX_G = Hex(G)
  44.                If Hex(B) = Hex(0) Then HEX_B = "00" Else HEX_B = Hex(B)
  45.                Return (HEX_R & HEX_G & HEX_B)
  46.            Case ColorType.HTML : Return ColorTranslator.ToHtml(RGB)
  47.            Case Else : Return Nothing
  48.        End Select
  49.  
  50.    End Function
  51.  
  52. #End Region


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Color del Pixel en donde está el Mouse
Programación Visual Basic
Dessa 4 3,978 Último mensaje 30 Marzo 2010, 02:22 am
por LeandroA
Realizar accion al cambiar de color un pixel
Programación Visual Basic
Demereth 2 2,951 Último mensaje 3 Septiembre 2012, 20:36 pm
por Yoghurt
Localizar pixel de cierto color dentro de la pantalla
.NET (C#, VB.NET, ASP)
z3nth10n 3 2,412 Último mensaje 28 Julio 2013, 15:11 pm
por Eleкtro
Color de píxel en pantalla
Ingeniería Inversa
epicteto 3 2,450 Último mensaje 27 Enero 2014, 19:46 pm
por tincopasan
Duda/Consejos vb6 - Autocliker pixel color /Aim
Programación Visual Basic
TornadoXml 3 3,620 Último mensaje 30 Abril 2019, 00:55 am
por Eleкtro
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines