Hi VR,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to create a picture of your
control and save it to disk. If there is any misunderstanding, please feel
free to let me know.
Based on my research, we can use functions in GDI32 to achieve this. Here
is an example:
Private Sub MenuItem2_Select(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MenuItem2.Select
Dim g1 As Graphics
g1 = Me.CreateGraphics()
Dim MyImage As Image
MyImage = New Bitmap(Me.Width, Me.Height, g1)
Dim a As Int32
a = Me.Height
Dim g2 As Graphics
g2 = Graphics.FromImage(MyImage)
Dim dc1 As IntPtr
dc1 = g1.GetHdc()
Dim dc2 As IntPtr
dc2 = g2.GetHdc()
BitBlt(dc2, 0, 0, Me.Width, Me.Height, dc1, -4,
Me.ClientRectangle.Height - Me.Height + 4, 13369376)
g1.ReleaseHdc(dc1)
g2.ReleaseHdc(dc2)
Dim p As Point
p.X = Me.MousePosition.X - Me.Location.X
p.Y = Me.MousePosition.Y - Me.Location.Y
Me.Cursor.Draw(g2, New Rectangle(p, Me.Cursor.Size))
MyImage.Save("c:\saved.jpg", Drawing.Imaging.ImageFormat.Jpeg)
MessageBox.Show("Finished Saving Image")
End Sub
Private 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
HTH.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."