(Gast)
n/a Beiträge
|
AW: Korrekte Verwendung von Blend?
29. Jul 2017, 11:48
Antworte mir selbst vielleicht hat jemand ein ähnliches Problem.
Das Problem war UpdateLayeredWindow.
Über UpdateLayeredWindow kann man die transparente Farbe nicht festlegen deshalb blink der Hintergrund beim aktualisieren weiß auf.
Aus der Anwendung
Delphi-Quellcode:
if SKAERO_AnimateWindowCreate(KVPlayerIni) then //Load Value stored in IniFiles
begin
try
SKAERO_AnimateWindow(MainHandle); // start AnimateWindow
finally
KVPlayerIni.Free; // Free Inifile ressource
SKAERO_AnimateWindowDestroy; // Destroy AnimateWindow Class
end;
end;
AnimateWindow zeichnen
Delphi-Quellcode:
procedure TWinAnimator.AnimateForm(WinHandle: HWND);
const
t: array [0 .. 7] of Integer = (AW_HOR_POSITIVE, AW_HOR_NEGATIVE, AW_VER_POSITIVE,
AW_VER_NEGATIVE, AW_HOR_POSITIVE or AW_VER_POSITIVE, AW_HOR_NEGATIVE or AW_VER_POSITIVE,
AW_HOR_POSITIVE or AW_VER_NEGATIVE, AW_HOR_NEGATIVE or AW_VER_NEGATIVE);
var
Value: Integer;
begin
SetForegroundWindow(WinHandle);
SkinEngine.FInvalidateRect(WinHandle, false);
Value := Random(4);
// do not use WS_EX_LAYERD on AW_BLEND or without CompositionEnabled
if (Value > 0) and SkinEngine.IsCompositionEnabled then
begin
GAnimatorManager.AlphaBlend := True; // create WS_EX_LAYERED Style
GAnimatorManager.TransparentColor := True; // using Colorkey
GAnimatorManager.TransparentColorValue := $FF00FF; // set Color
GAnimatorManager.AlphaBlendValue := 255; // set Alpha Value
end;
case Value of
0:
AnimateWindow(WinHandle, TimeMax, AW_BLEND);
1:
AnimateWindow(WinHandle, TimeMax, AW_CENTER);
2:
AnimateWindow(WinHandle, TimeMax, t[Random( High(t) + 1)]);
3:
AnimateWindow(WinHandle, TimeMax, AW_SLIDE or t[Random( High(t) + 1)]);
end;
GAnimatorManager.AlphaBlend := False; // remove WS_EX_LAYERED Style
end;
erstelle den WS_EX_LAYERED Style setze transparente Farbe, Blend oder Colorkey Value
Delphi-Quellcode:
procedure TAnimatorManager.SetLayeredAttribs;
const
cUseAlpha: array [Boolean] of Integer = (0, LWA_ALPHA);
cUseColorKey: array [Boolean] of Integer = (0, LWA_COLORKEY);
var
AStyle: Integer;
begin
AStyle := GetWindowLong( Handle, GWL_EXSTYLE);
if FAlphaBlend then
begin
if (AStyle and WS_EX_LAYERED) = 0 then
SetWindowLong( Handle, GWL_EXSTYLE, AStyle or WS_EX_LAYERED);
SetLayeredWindowAttributes( Handle, ColorToRGB(FTransparentColorValue), FAlphaBlendValue,
cUseAlpha[FAlphaBlend] or cUseColorKey[FTransparentColor]);
end
else
begin
SetWindowLong( Handle, GWL_EXSTYLE, AStyle and not WS_EX_LAYERED);
RedrawWindow( Handle, nil, 0, RDW_ERASE or RDW_INVALIDATE or RDW_FRAME or RDW_ALLCHILDREN);
end;
end;
WM_PRINT in der Anwendung
Delphi-Quellcode:
WM_PRINT:
begin
GetClientRect(WinHandle, rc);
SrcDC := SKAERO_GetProperty(WinHandle, FORM_PaintDC);
BitBlt(wP, 0, 0, rc.Right, rc.Bottom, SrcDC, 0, 0, SRCCOPY);
ReleaseDC(WinHandle, SrcDC);
end;
Funktioniert nun mit allen von mir erstellten Windows
greets
Geändert von EWeiss (29. Jul 2017 um 18:03 Uhr)
|
|
Zitat
|