Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<WtgPackageVersionPrefix>0.1.0</WtgPackageVersionPrefix>
<PackageVersion Condition="'$(PackageVersion)' == ''">$(WtgPackageVersionPrefix)-dev</PackageVersion>
<PackageDescription>WiseTech Global forked version of System.Windows.Forms that includes controls that were deprecated in .NET Core 3.1 and .NET 5, like DataGrid, Menu, ToolBar and StatusBar.</PackageDescription>
<PackageReleaseNotes>Rollback custom binding context support in BindingContext/RelatedCurrencyManager, PR link: https://github.com/WiseTechGlobal/winforms/pull/20</PackageReleaseNotes>
<PackageReleaseNotes>Remove IsScalingRequirementMet from DefaultLayout.cs, PR link: https://github.com/WiseTechGlobal/winforms/pull/37</PackageReleaseNotes>
<Authors>WiseTech Global</Authors>
<Copyright>© WiseTech Global Limited. All rights reserved.</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,24 +762,12 @@ private static void UpdateAnchorInfo(IArrangedElement element)
AnchorStyles anchor = GetAnchor(element);
if (IsAnchored(anchor, AnchorStyles.Right))
{
if (ScaleHelper.IsScalingRequirementMet && (anchorInfo.Right - parentWidth > 0) && (oldAnchorInfo.Right < 0))
{
// Parent was resized to fit its parent, or screen, we need to reuse old anchors info to prevent losing control beyond right edge.
anchorInfo.Right = oldAnchorInfo.Right;
if (!IsAnchored(anchor, AnchorStyles.Left))
{
// Control might have been resized, update Left anchors.
anchorInfo.Left = oldAnchorInfo.Right - cachedBounds.Width;
}
}
else
{
anchorInfo.Right -= parentWidth;
// This differs from the official WinForms implementation because we encountered an issue with DPI handling. See WI01100144.
anchorInfo.Right -= parentWidth;

if (!IsAnchored(anchor, AnchorStyles.Left))
{
anchorInfo.Left -= parentWidth;
}
if (!IsAnchored(anchor, AnchorStyles.Left))
{
anchorInfo.Left -= parentWidth;
}
}
else if (!IsAnchored(anchor, AnchorStyles.Left))
Expand All @@ -790,26 +778,12 @@ private static void UpdateAnchorInfo(IArrangedElement element)

if (IsAnchored(anchor, AnchorStyles.Bottom))
{
if (ScaleHelper.IsScalingRequirementMet && (anchorInfo.Bottom - parentHeight > 0) && (oldAnchorInfo.Bottom < 0))
{
// The parent was resized to fit its parent or the screen, we need to reuse the old anchors info
// to prevent positioning the control beyond the bottom edge.
anchorInfo.Bottom = oldAnchorInfo.Bottom;
// This differs from the official WinForms implementation because we encountered an issue with DPI handling. See WI01100144.
anchorInfo.Bottom -= parentHeight;

if (!IsAnchored(anchor, AnchorStyles.Top))
{
// The control might have been resized, update the Top anchor.
anchorInfo.Top = oldAnchorInfo.Bottom - cachedBounds.Height;
}
}
else
if (!IsAnchored(anchor, AnchorStyles.Top))
{
anchorInfo.Bottom -= parentHeight;

if (!IsAnchored(anchor, AnchorStyles.Top))
{
anchorInfo.Top -= parentHeight;
}
anchorInfo.Top -= parentHeight;
}
}
else if (!IsAnchored(anchor, AnchorStyles.Top))
Expand Down Expand Up @@ -1048,19 +1022,19 @@ private static void ApplyCachedBounds(IArrangedElement container)
while (dictionary.Count > 0)
{
#endif
foreach (DictionaryEntry entry in dictionary)
{
IArrangedElement element = (IArrangedElement)entry.Key;
foreach (DictionaryEntry entry in dictionary)
{
IArrangedElement element = (IArrangedElement)entry.Key;

Debug.Assert(element.Container == container, "We have non-children in our containers cached bounds store.");
Debug.Assert(element.Container == container, "We have non-children in our containers cached bounds store.");
#if DEBUG
// We are about to set the bounds to the cached value. We clear the cached value
// before SetBounds because some controls fiddle with the bounds on SetBounds
// and will callback InitLayout with a different bounds and BoundsSpecified.
dictionary.Remove(entry.Key);
#endif
Rectangle bounds = (Rectangle)entry.Value!;
element.SetBounds(bounds, BoundsSpecified.None);
Rectangle bounds = (Rectangle)entry.Value!;
element.SetBounds(bounds, BoundsSpecified.None);
#if DEBUG
break;
}
Expand Down
Loading