WEB开发网
开发学院WEB开发综合 如何将整个画面暗下来,如同关机前一般 阅读

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

 2006-02-27 11:52:42 来源:WEB开发网   
核心提示:PRivateTypeRECTLeftAsLongTopAsLongRightAsLongBottomAsLongEndTypePrivateDeclareFunctionGetDCLib"user32"(ByValhwndAsLong)AsLongPrivateDeclareFunctionRel
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->

Tags:如何 整个 画面

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接