ayuda con captura de pantalla

(1/2) > >>

_katze_:
tengo el fragmento de este code el cual toma una captura de la pantalla y todo bien lo toma sin problemas, el problema es el siguiente
Código
 Public Sub New()
           'escritorio = rectangle
           B_rectangle = Windows.Forms.Screen.PrimaryScreen.Bounds
           'encapsulamos mapas de bits a partir del B_rectangle.
           B_image = New Drawing.Bitmap(B_rectangle.Width, B_rectangle.Height, Drawing.Imaging.PixelFormat.Format32bppArgb)
           'crea la imagen a partir de b_image
           B_graphics = Drawing.Graphics.FromImage(B_image)
       End Sub
 
 
Public Function GetSnapshot() As IntPtr Implements Icaptura.GetSnapshot
           If B_bitmapData IsNot Nothing Then
               Throw New InvalidOperationException("Hay que liberar la instantánea actual antes de obtener una nueva.")
           End If
           B_graphics.CopyFromScreen(0, 0, 0, 0, B_rectangle.Size)
           B_bitmapData = B_image.LockBits(B_rectangle, Drawing.Imaging.ImageLockMode.ReadOnly, Drawing.Imaging.PixelFormat.Format32bppArgb)
           Return B_bitmapData.Scan0
 
       End Function
 
Código
 
       Public Sub New(ByRef target As Windows.Forms.Control, ByVal width As Integer, ByVal height As Integer, ByVal pixelformat As Drawing.Imaging.PixelFormat)
           o_target = target
           o_graphics = o_target.CreateGraphics
 
           b_rectangle = New Drawing.Rectangle(0, 0, width, height)
           b_format = pixelformat
 
           Dim stride As Integer
           stride = 0
 
           Select Case b_format
               Case Drawing.Imaging.PixelFormat.Format16bppArgb1555, Drawing.Imaging.PixelFormat.Format16bppRgb555, Drawing.Imaging.PixelFormat.Format16bppRgb565
                   stride = (width * 2)
               Case Drawing.Imaging.PixelFormat.Format24bppRgb
                   stride = (width * 3)
               Case Drawing.Imaging.PixelFormat.Format32bppArgb, Drawing.Imaging.PixelFormat.Format32bppPArgb, Drawing.Imaging.PixelFormat.Format32bppRgb
                   stride = (width * 4)
           End Select
 
           b_length = height * stride
 
           buffer = Runtime.InteropServices.Marshal.AllocHGlobal(b_length)
 
           b_image = New Drawing.Bitmap(b_rectangle.Width, b_rectangle.Height, stride, b_format, buffer)
           o_graphics.DrawImage(b_image, o_target.ClientRectangle)
       End Sub
 
 
       Public Sub DrawUpdate(ByVal intIndex As Integer, ByRef aryData() As Byte, ByVal intIndex_Data As Integer, ByVal intLength As Integer) Implements Idibujar.DrawUpdate
           Runtime.InteropServices.Marshal.Copy(aryData, intIndex_Data, CInt(buffer) + intIndex, intLength)
       End Sub
 
 

esta segunda part es fragmento de un code el cual no logro hacer que dibuje donde le designo....
o si hay alguna otra forma me seria de utilidad, y si desean las declaraciones de las variables las subo o algo mas.

[D4N93R]:
Pero qué es lo que quieres hacer?

Porque según veo estás dibujando NADA. :S

_katze_:
la idea es dibujar la captura de pantalla que realizo :S

[D4N93R]:
Pero la estas sacando de otro control verdad? es decir de:  o_graphics = o_target.CreateGraphics

luego:

Código
//buffer en este caso es un pointer a un array de bytes que contengan
//la data de la imagen como tal.
b_length = height * stride
buffer = Runtime.InteropServices.Marshal.AllocHGlobal(b_length)
 
//la pregunta es: Donde está la data? buffer tiene que apuntar a un array con la imagen
b_image = New Drawing.Bitmap(b_rectangle.Width, b_rectangle.Height, stride, b_format, buffer)
 
 
//Acá está bien, pero b_image creo que esta en blanco.
o_graphics.DrawImage(b_image, o_target.ClientRectangle)
 

_katze_:
tenes razon b_image esta vacio,tengo q rellenar el espacioo q queda o algo asi

Navegación

[0] Índice de Mensajes

[#] Página Siguiente