Selaa lähdekoodia

FIX: Explorer preview - initialize with correct window size

Alexander Koblov 4 vuotta sitten
vanhempi
commit
011e920302
1 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  1. 5 3
      plugins/wlx/preview/src/preview.lpr

+ 5 - 3
plugins/wlx/preview/src/preview.lpr

@@ -125,8 +125,11 @@ begin
   end;
   Windows.RegisterClassW(WindowClassW);
 
-  Result:= CreateWindowW(PREVIEW_HANDLER, 'PreviewHandler', WS_CHILD or WS_VISIBLE, 0, 0, 640,
-                         480, ParentWin, 0, WindowClassW.hInstance, nil);
+  if not GetClientRect(ParentWin, ARect) then
+    ARect:= TRect.Create(0, 0, 640, 480);
+
+  Result:= CreateWindowW(PREVIEW_HANDLER, 'PreviewHandler', WS_CHILD or WS_VISIBLE, ARect.Left, ARect.Top,
+                         ARect.Right, ARect.Bottom, ParentWin, 0, WindowClassW.hInstance, nil);
 
   if (Result <> wlxInvalidHandle) then
   begin
@@ -134,7 +137,6 @@ begin
     AData.Handler:= AHandler;
     SetPropW(ParentWin, ProcessIdWide, GetProcessID);
     SetWindowLongPtr(Result, GWLP_USERDATA, AHandle);
-    ARect:= TRect.Create(0, 0, 640, 480);
     AHandler.SetWindow(Result, ARect);
     AData.Handler.DoPreview();
     Inc(Count);