Skip to content

Commit

Permalink
Merge pull request #740 from Krypton-Suite/alpha-308AntiAliasPanel
Browse files Browse the repository at this point in the history
- Make sure that the `RectangleF` is used for panel paths
  • Loading branch information
Smurf-IV authored Jun 10, 2022
2 parents 27d9f26 + 8197812 commit e2789fe
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 27 deletions.
1 change: 1 addition & 0 deletions Documents/Help/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

## 2022-11-xx - Build 2211 - November 2022 <!--Possible August or September release?-->
* Made enumeration `SchemeOfficeColors` public, so they can be used to make external themes
* Resolved [#308](https://github.com/Krypton-Suite/Standard-Toolkit/issues/308), Panel AntiAlias Border Problem
* Resolved [#734](https://github.com/Krypton-Suite/Standard-Toolkit/issues/734), Disabled Text in NumericUpDown Not visible
* Resolved [#715](https://github.com/Krypton-Suite/Standard-Toolkit/issues/715), v65.22.4.94 - PaletteSparkleBlueBase.GetContentPadding: Specified argument was out of the range of valid values. Parameter name: style
* Implemented the `PlacementModeConverter` for `PlacementMode` enum type
Expand Down
10 changes: 10 additions & 0 deletions Source/Krypton Components/Krypton.Toolkit/General/GraphicsHint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ public GraphicsHint(Graphics graphics, PaletteGraphicsHint hint)
case PaletteGraphicsHint.AntiAlias:
_graphics.SmoothingMode = SmoothingMode.AntiAlias;
break;
case PaletteGraphicsHint.HighSpeed:
_graphics.SmoothingMode = SmoothingMode.HighSpeed;
break;
case PaletteGraphicsHint.HighQuality:
_graphics.SmoothingMode = SmoothingMode.HighQuality;
break;
case PaletteGraphicsHint.Inherit:
// Change nothing!
break;

default:
// Should never happen!
Debug.Assert(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5041,7 +5041,13 @@ public enum PaletteGraphicsHint
/// <summary>
/// Specifies anti aliasing for graphics rendering.
/// </summary>
AntiAlias
AntiAlias,

/// <summary>Specifies no antialiasing.</summary>
HighSpeed,
/// <summary>Specifies antialiased rendering.</summary>
HighQuality

}
#endregion

Expand Down
23 changes: 11 additions & 12 deletions Source/Krypton Components/Krypton.Toolkit/View Base/ViewBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public abstract class ViewBase : GlobalId,
private bool _visible;
private bool _fixed;
private ViewBase _enableDependantView;
private Rectangle _clientRect;
private RectangleF _clientRectF;
private PaletteState _fixedState;
private PaletteState _elementState;
Expand All @@ -51,7 +50,7 @@ protected ViewBase()
_visible = true;
_fixed = false;
_enableDependant = false;
_clientRect = Rectangle.Empty;
_clientRectF = RectangleF.Empty;

// Default the initial state
_elementState = PaletteState.Normal;
Expand Down Expand Up @@ -159,8 +158,8 @@ public virtual bool Visible
public virtual Rectangle ClientRectangle
{
[DebuggerStepThrough]
get => _clientRect;
set => _clientRect = value;
get => Rectangle.Round(_clientRectF);
set => _clientRectF = value;
}

public virtual RectangleF ClientRectangleF
Expand All @@ -176,8 +175,8 @@ public virtual RectangleF ClientRectangleF
public virtual Point ClientLocation
{
[DebuggerStepThrough]
get => _clientRect.Location;
set => _clientRect.Location = value;
get => ClientRectangle.Location;
set => _clientRectF.Location = value;
}

/// <summary>
Expand All @@ -186,8 +185,8 @@ public virtual Point ClientLocation
public virtual Size ClientSize
{
[DebuggerStepThrough]
get => _clientRect.Size;
set => _clientRect.Size = value;
get => ClientRectangle.Size;
set => _clientRectF.Size = value;
}

/// <summary>
Expand All @@ -196,8 +195,8 @@ public virtual Size ClientSize
public virtual int ClientWidth
{
[DebuggerStepThrough]
get => _clientRect.Width;
set => _clientRect.Width = value;
get => ClientRectangle.Width;
set => _clientRectF.Width = value;
}

/// <summary>
Expand All @@ -206,8 +205,8 @@ public virtual int ClientWidth
public virtual int ClientHeight
{
[DebuggerStepThrough]
get => _clientRect.Height;
set => _clientRect.Height = value;
get => ClientRectangle.Height;
set => _clientRectF.Height = value;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,11 @@ public override void RenderBefore(RenderContext context)
{
// Render the background
using GraphicsPath panelPath = new();
var rectF = ClientRectangleF;
// Now workaround https://github.com/Krypton-Suite/Standard-Toolkit/issues/308
rectF.Offset(-0.25f, -0.25f);
// The path encloses the entire panel area
panelPath.AddRectangle(ClientRectangle);
panelPath.AddRectangle(rectF);

// Perform actual panel drawing
_memento = context.Renderer.RenderStandardBack.DrawBack(context, ClientRectangle, panelPath, _paletteBack, VisualOrientation, State, _memento);
Expand Down
16 changes: 3 additions & 13 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 e2789fe

Please sign in to comment.