| |
|
|
|
'Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) into Babyklappe on XProfan.com stored:
'Icon gray dye
'an method, circa Icons gray To dye.
'(C) 2004 Frank Abbing.
Declare bild&,Text$,neu&,array&,x&,y&,z&,but&,pseudobitmap&,bitmap&,wert&,x%,y%,z%
Def SelectObject(2) !"GDI32","SelectObject"
Def CreateCompatibleBitmap(3) !"GDI32","CreateCompatibleBitmap"
Def GetSysColor(1) !"USER32","GetSysColor"
SetTrueColor 1
Window 0,0-800,600
Cls GetSysColor(15)
'Originales Icon with Profanmitteln in that Window loading.
text$=Par$(0)
DrawLibIcon Text$,12,40,40
'Originales Icon with Profanmitteln in the Hintergrundsspeicher loading.
x&=32
y&=32
MCLS x&,y&
Startpaint -1
Cls GetSysColor(15)
DrawLibIcon Text$,12,0,0
'Icon gray dye
y%=0
Whileloop 32
x%=0
Whileloop 32
z&=GetPixel(x%,y%)
If z&<>GetSysColor(15)
z%=(GetRValue(z&)+GetGValue(z&)+GetBValue(z&))/3
SetPixel x%,y%,Rgb(z%,z%,z%)
EndIf
Inc x%
EndWhile
Inc y%
EndWhile
'Pseudobitmap create. BM_SETIMAGE functions only with Bitmaps, The keinem HDC zugeordnet are.
pseudobitmap&=CreateCompatibleBitmap(%hdc,x&,y&)
'Pseudobitmap unserem HDC zuordnen
'as Result get we our losgelöste Bitmap back !
bitmap&=SelectObject(%hdc,pseudobitmap&)
EndPaint
'Button create via Control / The Create(Button,...) method not working without further
'Button not yet visible !
but&=@Control("Button","",$40000080,40,100,48,48,%hwnd,1001,%Hinstance)
'Bitmap the Button zuordnen
Sendmessage(but&,$F7,0,bitmap&)'BM_SETIMAGE
'Button visible make
ShowWindow(but&,1)
WaitKey
'- Button destroy, so The Bitmap again spare becomes
'- Bitmap delete
DestroyWindow(but&)
DeleteObject bitmap&
End
|
|
|
| |
|
|