Den ich im Moment mit einem transparenten Dialog erstelle. Nur ein Rahmen, den ich aber nicht transparent hin bekomme (soll ohne OFrame.dll sein), wäre mein Wunsch. Kennt von euch einer eine Möglichkeit?
Code
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Def @Clienttoscreen(2) !"USER32","ClientToScreen"
Def @G2lx(0) @Long(C2sstrc#,0)
Def @G2ly(0) @Long(C2sstrc#,4)
Proc G2l
Parameters Hdl&
Clear C2sstrc#
@Clienttoscreen(%Hwnd,C2sstrc#)
x%=@G2lx()
y%=@G2ly()
Clear C2sstrc#
@Clienttoscreen(Hdl&,C2sstrc#)
x%=@G2lx()-x%
y%=@G2ly()-y%
Endproc
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def %LWA_ALPHA $2
def %GWL_EXSTYLE -20
def %WS_EX_LAYERED $80000
def %WS_EX_TRANSPARENT $20
def SetWindowLong(3) !"USER32","SetWindowLongA"
def GetWindowLong(2) !"USER32","GetWindowLongA"
def SetLayeredWindowAttributes(4) !"USER32","SetLayeredWindowAttributes"
Proc SetTransparent
Declare Old&
Parameters Hwnd&, Perc%
Old& = GetWindowLong(Hwnd&,%GWL_EXSTYLE)
SetWindowLong(Hwnd&, %GWL_EXSTYLE, (Old& | %WS_EX_LAYERED));
SetLayeredWindowAttributes(Hwnd&, 0, (255 * Perc%) / 100, %LWA_ALPHA);
EndProc
SetTrueColor 1
window 0,0 - 600,600
UsePen 0,0,rgb(0,0,0)
WhileLoop 10,600,20
Line 10,&Loop - 600,&loop
wend
Line 0,0 - 600,550
Line 0,550 - 600,0
declare x%,y%,bmp1&
Declare C2sstrc#
Dim C2sstrc#,8
CHILD
Dispose C2sstrc#
DeleteObject bmp1&
end
proc CHILD
Windowstyle 82
var hwnd&=Create("DIALOG",%hwnd,"",100,100,220,320)
setstyle hwnd&,Getstyle(hwnd&) - $C00000
SetTransparent hwnd&, 45
@Create("Tooltip",%hwnd,hwnd&,"Verschieben mit gehaltener Maustaste links "+\
"in der unteren rechten Fläche.\nBild erstellen mit Mausklick rechts.")
userMessages 16,513,514,516//wm_close,wm_lButtonDown,wm_rButtonDown
while 1
WaitInput
case %key=27:break
case %uMessage=16: break
case %uMessage=513 : hWnd.movebyMouse()//wm_lButtonDown
If %uMessage=516
MCls 220, 320
CopyBmpToMem x%,y% - 220,320 > 0,0
bmp1&=@Create("hPic",0,"&MEMBMP")
SavePic "C:\\Test.jpg", bmp1&,100 ' anpassen !!!
@MessageBox ("Bild gespeichert.","Hinweis",64)
EndIf
wend
userMessages 0
DestroyWindow(hwnd&)
SetFocus(%hwnd)
endProc
proc hWnd.moveByMouse
declare mpos#
dim mpos#,8
external("user32","GetCursorPos",mpos#)
while iskey(1)
external("user32","GetCursorPos",mpos#)
setWindowPos hWnd&=(long(mpos#,0)-220),(long(mpos#,4)-320) - 220,320,0
wend
dispose mpos#
G2l hWnd&
endProc
Alles anzeigen
Gruß Thomas