vb.net - DrawtoBitmap not showing contents of Panel -
my first post here here goes,
i have program need color of pixel in panel, panel contains ie browser shown in code below (i cant use webbrowser doesn't load webpages same ie/firefox (usually java))
dim thebrowser = new shdocvw.internetexplorer asd = thebrowser.hwnd fgh = me.panel2.handle setparent(asd, fgh) sendmessage(asd, wm_syscommand, sc_maximize, 0)
this bit works fine, user can change entire forms opacity pixel color found if use drawtobitmap on form ignores opacity, can use pixel color, drawtobitmap leaving contents of panel blank (i've used picturebox test image)
dim mybitmap new bitmap(me.width, me.height) me.drawtobitmap(mybitmap, me.clientrectangle) picturebox1.backgroundimage = mybitmap
the form , buttons etc shown fine on picturebox panel blank (ive tried convert panel bitmap comes out blank). linking ie panel incorrectly or drawtopanel not working right? (i tried using printscreen expected includes opacity). heres sendmessage , setparent completness.
<dllimport("user32.dll")> _ private shared function sendmessage(byval hwnd intptr, byval msg integer, byval wparam integer, byval lparam integer) integer end function <dllimport("user32.dll")> _ public shared function setparent(byval hwndchild intptr, byval hwndnewparent intptr) intptr end function
any appreciated, ryan
solved it, don't need drawtobitmap now, tried bit ago had getwindowdc set intptr.zero uses entire screen not form , included background colors of windows.
dim hdc intptr = getwindowdc(form2.handle) dim pixel uinteger = getpixel(hdc, x - form2.top, y - form2.left) dim color color releasedc(form2.handle, hdc) color = color.fromargb(int(pixel , &hff), _ int(pixel , &hff00) >> 8, _ int(pixel , &hff0000) >> 16)
now doesnt care if form opacity set 0 still finds color on form.
Comments
Post a Comment