时间: 2021-07-31 作者:daque
private type rectleft as longtop as longright as longbottom as longend typeprivate declare function getdc lib "user32" (byval hwnd as long) as longprivate declare function releasedc lib "user32" (byval hwnd as long, byval hdc as long) as longprivate declare function createpatternbrush lib "gdi32" (byval hbitmap as long) as longprivate declare function patblt lib "gdi32" (byval hdc as long, byval x as long, byval y as long, byval nwidth as long, byval nheight as long, byval dwrop as long) as longprivate declare function deleteobject lib "gdi32" (byval hobject as long) as longprivate declare function createbitmap lib "gdi32" (byval nwidth as long, byval nheight as long, byval nplanes as long, byval nbitcount as long, lpbits as any) as longprivate declare function selectobject lib "gdi32" (byval hdc as long, byval hobject as long) as longprivate declare function invalidaterect lib "user32" (byval hwnd as long, byval lprect as long, byval berase as long) as longprivate bybits(1 to 16) as byteprivate hbitmap as long, hbrush as longprivate hdesktopwnd as long'将图变暗,犹如待关灯普遍private sub command1_click()dim rop as long, res as longdim hdc5 as long, width5 as long, height5 as long'即使只有让picture1有功效将下面叁行unmark代替 hdc5, width5, height5叁个值'hdc5 = picture1.hdc'width5 = picture1.scalewidth'height5 = picture1.scaleheight'下面叁行设定所有萤幕都暗下来hdc5 = getdc(0)width5 = screen.width \ screen.twipsperpixelxheight5 = screen.height \ screen.twipsperpixelyrop = &ha000c9 '与原图做and演算call selectobject(hdc5, hbrush)res = patblt(hdc5, 0, 0, width5, height5, rop)call deleteobject(hbrush)'即使只暗picture1则下面这一条龙要mark起来res = releasedc(0, hdc5)end sub'恢复本来的画面private sub command2_click()dim aa as long'即使只暗picture1则下面这一条龙要unmark起来'picture1.refresh'即使只暗picture1则下面这一条龙要mark起来aa = invalidaterect(0, 0, 1)end subprivate sub form_load()dim arydim i as longary = array(&h55, &h0, &haa, &h0, _&h55, &h0, &haa, &h0, _&h55, &h0, &haa, &h0, _&h55, &h0, &haa, &h0)for i = 1 to 16bybits(i) = ary(i - 1)next ihbitmap = createbitmap(8, 8, 1, 1, bybits(1))hbrush = createpatternbrush(hbitmap)picture1.forecolor = rgb(0, 0, 0)picture1.backcolor = rgb(255, 255, 255)picture1.scalemode = 3end sub