All
I am trying to get the screen capture of a MDI children form. Somehow it is just not working.
Does anyone know where i am going where here?
Cheers
Ken
Code:Private Sub btnScreen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScreen.Click Dim frmMain As frmParent = Me.MdiParent For Each ctl As Control In frmMain.MdiChildren If TypeOf ctl Is frmOverview Then Dim frm As frmOverview = ctl Dim MyBMP As New Bitmap(frm.Width, frm.Height) Dim G As Graphics = Graphics.FromImage(MyBMP) 'copies image data at location of form (top left), width of the form, to get entire form contents G.CopyFromScreen(New Point(frm.Location.X, frm.Location.Y), New Point(frm.Location.X, frm.Location.Y), New Size(frm.Width, frm.Height)) G.Dispose() 'saves the image Clipboard.SetImage(MyBMP) MessageBox.Show("Screen capture success!") Exit Sub End If Next





Reply With Quote