欢迎光临
我们一直在努力

如何将整个画面暗下来,如同关机前一般_visualbasic教程

建站超值云服务器,限时71元/月

PrivateTypeRECT
LeftAsLong
TopAsLong
RightAsLong
BottomAsLong
EndType

PrivateDeclareFunctionGetDCLib”user32″(ByValhwndAsLong)AsLong
PrivateDeclareFunctionReleaseDCLib”user32″(ByValhwndAsLong,ByValhdcAsLong)AsLong
PrivateDeclareFunctionCreatePatternBrushLib”gdi32″(ByValhBitmapAsLong)AsLong
PrivateDeclareFunctionPatBltLib”gdi32″(ByValhdcAsLong,ByValxAsLong,ByValyAsLong,ByValnWidthAsLong,ByValnHeightAsLong,ByValdwRopAsLong)AsLong
PrivateDeclareFunctionDeleteObjectLib”gdi32″(ByValhObjectAsLong)AsLong
PrivateDeclareFunctionCreateBitmapLib”gdi32″(ByValnWidthAsLong,ByValnHeightAsLong,ByValnPlanesAsLong,ByValnBitCountAsLong,lpBitsAsAny)AsLong
PrivateDeclareFunctionSelectObjectLib”gdi32″(ByValhdcAsLong,ByValhObjectAsLong)AsLong
PrivateDeclareFunctionInvalidateRectLib”user32″(ByValhwndAsLong,ByVallpRectAsLong,ByValbEraseAsLong)AsLong

Privatebybits(1To16)AsByte
PrivatehBitmapAsLong,hBrushAsLong
PrivatehDesktopWndAsLong
注释:将图变暗,如同待关机一般
PrivateSubCommand1_Click()
DimropAsLong,resAsLong
Dimhdc5AsLong,width5AsLong,height5AsLong
注释:如果只要让Picture1有效果将底下三行unMark取代hdc5,width5,height5三个值
注释:hdc5=Picture1.hdc
注释:width5=Picture1.ScaleWidth
注释:height5=Picture1.ScaleHeight

注释:底下三行设定整个萤幕都暗下来
hdc5=GetDC(0)
width5=Screen.Width\Screen.TwipsPerPixelX
height5=Screen.Height\Screen.TwipsPerPixelY

rop=&HA000C9注释:与原图做and运算
CallSelectObject(hdc5,hBrush)
res=PatBlt(hdc5,0,0,width5,height5,rop)
CallDeleteObject(hBrush)
注释:如果只暗picture1则底下这一行要mark起来
res=ReleaseDC(0,hdc5)
EndSub
注释:回复原本的画面
PrivateSubCommand2_Click()
DimaaAsLong
注释:如果只暗picture1则底下这一行要unMark起来
注释:Picture1.Refresh

注释:如果只暗picture1则底下这一行要mark起来
aa=InvalidateRect(0,0,1)
EndSub

PrivateSubForm_Load()
Dimary
DimiAsLong
ary=Array(&H55,&H0,&HAA,&H0,_
&H55,&H0,&HAA,&H0,_
&H55,&H0,&HAA,&H0,_
&H55,&H0,&HAA,&H0)
Fori=1To16
bybits(i)=ary(i-1)
Nexti
hBitmap=CreateBitmap(8,8,1,1,bybits(1))
hBrush=CreatePatternBrush(hBitmap)
Picture1.ForeColor=RGB(0,0,0)
Picture1.BackColor=RGB(255,255,255)
Picture1.ScaleMode=3
EndSub->

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 如何将整个画面暗下来,如同关机前一般_visualbasic教程
分享到: 更多 (0)