-
Notifications
You must be signed in to change notification settings - Fork 998
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #12358 [HDPI] The "document" text in the “Generating Previews” di…
…alog is truncated at >200% DPI (#12363)
- Loading branch information
Showing
3 changed files
with
68 additions
and
28 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
src/System.Windows.Forms/src/System/Windows/Forms/Controls/Labels/FocusableLabel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Drawing; | ||
|
||
namespace System.Windows.Forms; | ||
|
||
internal class FocusableLabel : Label | ||
{ | ||
public bool UnderlineWhenFocused { get; set; } = true; | ||
|
||
public FocusableLabel() | ||
{ | ||
SetStyle(ControlStyles.Selectable, true); | ||
TabStop = true; | ||
} | ||
|
||
protected override CreateParams CreateParams | ||
{ | ||
get | ||
{ | ||
CreateParams createParams = base.CreateParams; | ||
createParams.ClassName = null; | ||
return createParams; | ||
} | ||
} | ||
|
||
protected override void OnClick(EventArgs e) | ||
{ | ||
base.OnClick(e); | ||
|
||
if (UnderlineWhenFocused) | ||
{ | ||
Focus(); | ||
} | ||
} | ||
|
||
protected override void OnGotFocus(EventArgs e) | ||
{ | ||
if (UnderlineWhenFocused) | ||
{ | ||
Font = new Font(Font, FontStyle.Underline); | ||
} | ||
|
||
base.OnGotFocus(e); | ||
} | ||
|
||
protected override void OnLostFocus(EventArgs e) | ||
{ | ||
if (UnderlineWhenFocused) | ||
{ | ||
Font = new Font(Font, FontStyle.Regular); | ||
} | ||
|
||
base.OnLostFocus(e); | ||
} | ||
|
||
internal override bool SupportsUiaProviders => false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters