Q
Qwert
Hello,
kind of a specific question, but here it goes:
The following code works:
Dim objGraphicsSource As Graphics = PictureBox1.CreateGraphics
Dim bmpSource As New Bitmap(PictureBox1.Width, PictureBox1.Height,
objGraphicsSource)
Dim objGraphicsBmp As Graphics = Graphics.FromImage(bmpSource)
Dim hdcSource As IntPtr = objGraphicsSource.GetHdc
Dim hdcDest As IntPtr = objGraphicsBmp.GetHdc
BitBlt(hdcDest, 0, 0, 50, pbxSource.Height, hdcSource, 0, 0, 13369376)
PictureBox2.Image = bmpSource.Clone()
but when I use as a source an Image object with a bmp loaded from file, it
doesn't work anymore.
WORKS:
Dim objGraphicsSource As Graphics = PictureBox1.CreateGraphics
WORKS NOT:
Dim objGraphicsSource As Graphics = Graphics.FromImage(BmpSource)
Why does this only work with Graphics object based on a PictureBox control
and not with a Graphics object based on a Image object with a bmp loaded
from file?
Thank you.
Declare Auto Function BitBlt Lib "GDI32.DLL" ( _
ByVal hdcDest As IntPtr, _
ByVal nXDest As Integer, _
ByVal nYDest As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hdcSrc As IntPtr, _
ByVal nXSrc As Integer, _
ByVal nYSrc As Integer, _
ByVal dwRop As Int32) As Boolean
kind of a specific question, but here it goes:
The following code works:
Dim objGraphicsSource As Graphics = PictureBox1.CreateGraphics
Dim bmpSource As New Bitmap(PictureBox1.Width, PictureBox1.Height,
objGraphicsSource)
Dim objGraphicsBmp As Graphics = Graphics.FromImage(bmpSource)
Dim hdcSource As IntPtr = objGraphicsSource.GetHdc
Dim hdcDest As IntPtr = objGraphicsBmp.GetHdc
BitBlt(hdcDest, 0, 0, 50, pbxSource.Height, hdcSource, 0, 0, 13369376)
PictureBox2.Image = bmpSource.Clone()
but when I use as a source an Image object with a bmp loaded from file, it
doesn't work anymore.
WORKS:
Dim objGraphicsSource As Graphics = PictureBox1.CreateGraphics
WORKS NOT:
Dim objGraphicsSource As Graphics = Graphics.FromImage(BmpSource)
Why does this only work with Graphics object based on a PictureBox control
and not with a Graphics object based on a Image object with a bmp loaded
from file?
Thank you.
Declare Auto Function BitBlt Lib "GDI32.DLL" ( _
ByVal hdcDest As IntPtr, _
ByVal nXDest As Integer, _
ByVal nYDest As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hdcSrc As IntPtr, _
ByVal nXSrc As Integer, _
ByVal nYSrc As Integer, _
ByVal dwRop As Int32) As Boolean