When the program starts, it grabs the complete desktop image, copies it into the picDesktop PictureBox, and displays its form. ' Release the bitmap's and desktop's DCs. Private Function DesktopImage() As Bitmapĭim desktop_win As Int32 = GetDesktopWindow()ĭim desktop_dc As Int32 = GetDC(desktop_win)ĭim desktop_bounds As Rectangle = Screen.GetBounds(New _ĭim desktop_wid As Int32 = desktop_bounds.Widthĭim desktop_hgt As Int32 = desktop_bounds.Heightĭim bm As New Bitmap(desktop_wid, desktop_hgt)ĭim bm_gr As Graphics = Graphics.FromImage(bm)īm_hdc, 0, 0, desktop_wid, desktop_hgt, _ĭesktop_dc, 0, 0, desktop_wid, desktop_hgt, _ It releases the Bitmap's and desktop's device context, and returns the Bitmap. The function then uses StretchBlt to copy the desktop window's image onto the Bitmap. Next the function makes a Bitmap big enough to hold the desktop's image, creates a Graphics object attached to it, and gets the Bitmap's device context. It uses Screen.GetBounds to see how big the desktop is. It uses GetDC to get a device context for that window. The DesktopImage function uses the GetDesktopWindow API function to get the hWnd of the desktop window. NET.ĭesktop, grab pixels, image, background, VB.NET This example shows how to grab part of the desktop image in VB. VB Helper: HowTo: Grab part of the desktop image in VB.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |