Skip to content

Commit

Permalink
Merge pull request #746 from Krypton-Suite/alpha-688-ResizeLock
Browse files Browse the repository at this point in the history
- Do not allow Top & Bottom anchoring at the same time for height restricted controls
  • Loading branch information
PWagner1 authored Jun 11, 2022
2 parents 66e42f7 + ab61b94 commit e81ed2f
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 42 deletions.
1 change: 1 addition & 0 deletions Documents/Help/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## 2022-11-xx - Build 2211 - November 2022 <!--Possible August or September release?-->
* Implemented [#728](https://github.com/Krypton-Suite/Standard-Toolkit/issues/728), Bring MessageBox `States` inline with latest .Net 6
* Made enumeration `SchemeOfficeColors` public, so they can be used to make external themes
* Resolved [#688](https://github.com/Krypton-Suite/Standard-Toolkit/issues/688), KryptonComboBox / KryptonNumericUpDown / KryptonDomainUpDown Anchor Sizing no as expected when anchored Top & Bottom
* Resolved [#722](https://github.com/Krypton-Suite/Standard-Toolkit/issues/722), KryptonRichTextBox disabled colour cannot be set
* Resolved [#662](https://github.com/Krypton-Suite/Standard-Toolkit/issues/662), Can not "Control / Set Disabled" Background Colour Of Comboboxes, in DropDown mode
* Resolved [#737](https://github.com/Krypton-Suite/Standard-Toolkit/issues/737), `Office 2013 - Dark Grey` for `PaletteMode` in designer causes a crash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,20 @@ public override Size GetPreferredSize(Size proposedSize)
return base.GetPreferredSize(proposedSize);
}

/// <summary>https://github.com/Krypton-Suite/Standard-Toolkit/issues/688</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Windows.Forms.AnchorStyles" /> values. The default is <see langword="Top" /> and <see langword="Left" />.</returns>
[Category(@"CatLayout")]
[DefaultValue(AnchorStyles.Top | AnchorStyles.Left)]
[Description(@"Defines the edges of the container to which a certain control is bound. When a control is anchored to an edge, the distance between the control's closest edge and the specified edge will remain constant")]
[RefreshProperties(RefreshProperties.Repaint)]
public override AnchorStyles Anchor
{
get => base.Anchor;
set => base.Anchor = value.HasFlag(AnchorStyles.Bottom | AnchorStyles.Top)
? value ^ AnchorStyles.Bottom
: value;
}

/// <summary>
/// Gets the rectangle that represents the display area of the control.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,20 @@ public override Size GetPreferredSize(Size proposedSize)
}
}

/// <summary>https://github.com/Krypton-Suite/Standard-Toolkit/issues/688</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Windows.Forms.AnchorStyles" /> values. The default is <see langword="Top" /> and <see langword="Left" />.</returns>
[Category(@"CatLayout")]
[DefaultValue(AnchorStyles.Top | AnchorStyles.Left)]
[Description(@"Defines the edges of the container to which a certain control is bound. When a control is anchored to an edge, the distance between the control's closest edge and the specified edge will remain constant")]
[RefreshProperties(RefreshProperties.Repaint)]
public override AnchorStyles Anchor
{
get => base.Anchor;
set => base.Anchor = value.HasFlag(AnchorStyles.Bottom | AnchorStyles.Top)
? value ^ AnchorStyles.Bottom
: value;
}

/// <summary>
/// Gets the rectangle that represents the display area of the control.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,20 @@ public override Size GetPreferredSize(Size proposedSize)
}
}

/// <summary>https://github.com/Krypton-Suite/Standard-Toolkit/issues/688</summary>
/// <returns>A bitwise combination of the <see cref="T:System.Windows.Forms.AnchorStyles" /> values. The default is <see langword="Top" /> and <see langword="Left" />.</returns>
[Category(@"CatLayout")]
[DefaultValue(AnchorStyles.Top | AnchorStyles.Left)]
[Description(@"Defines the edges of the container to which a certain control is bound. When a control is anchored to an edge, the distance between the control's closest edge and the specified edge will remain constant")]
[RefreshProperties(RefreshProperties.Repaint)]
public override AnchorStyles Anchor
{
get => base.Anchor;
set => base.Anchor = value.HasFlag(AnchorStyles.Bottom | AnchorStyles.Top)
? value ^ AnchorStyles.Bottom
: value;
}

/// <summary>
/// Gets the rectangle that represents the display area of the control.
/// </summary>
Expand Down Expand Up @@ -1784,12 +1798,13 @@ protected override void SetBoundsCore(int x, int y,
// Override the actual height used
height = preferredSize.Height;
}
if (specified.HasFlag(BoundsSpecified.Width))
{
// Override the actual height used
width = preferredSize.Width;
}

// Do not do the following otherwise the designer will not allow width to be set!
// https://github.com/Krypton-Suite/Standard-Toolkit/issues/724
//if (specified.HasFlag(BoundsSpecified.Width))
//{
// // Override the actual Width used
// width = preferredSize.Width;
//}
base.SetBoundsCore(x, y, width, height, specified);
}

Expand Down
88 changes: 52 additions & 36 deletions Source/Krypton Components/TestForm/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e81ed2f

Please sign in to comment.