We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 952f1d1 commit 07e91e6Copy full SHA for 07e91e6
Sources/SwiftWin32/Views and Controls/Label.swift
@@ -79,9 +79,10 @@ public class Label: Control {
79
80
public override var frame: Rect {
81
didSet {
82
- let size = self.frame.size
+ let frame = self.frame.scaled(for: GetDpiForWindow(self.hWnd),
83
+ style: Label.style)
84
_ = SetWindowPos(self.hWnd_, nil,
- 0, 0, CInt(size.width), CInt(size.height),
85
+ 0, 0, CInt(frame.size.width), CInt(frame.size.height),
86
UINT(SWP_NOZORDER | SWP_FRAMECHANGED))
87
}
88
@@ -91,7 +92,8 @@ public class Label: Control {
91
92
_ = SetWindowSubclass(hWnd, SwiftLabelProc, UINT_PTR(1),
93
unsafeBitCast(self as AnyObject, to: DWORD_PTR.self))
94
95
+ let size = self.frame.scaled(for: GetDpiForWindow(self.hWnd),
96
+ style: Label.style).size
97
self.hWnd_ = CreateWindowExW(0, WC_STATIC.wide, nil, DWORD(WS_CHILD),
98
0, 0, CInt(size.width), CInt(size.height),
99
self.hWnd, nil, GetModuleHandleW(nil), nil)!
0 commit comments