Conversation
…g a custom theme # PR Description - #3183 ## Summary Fix a rendering artifact (a small square) appearing next to the `KryptonForm` Close (X) button when using a custom XML-based Krypton theme/palette. ## Root Cause When importing a custom palette from XML, palette values that are omitted by the theme XML could remain at placeholder/default C# values instead of being initialized from the palette's `BasePalette`. This could leave caption/button chrome in an invalid/partial state, producing a small stray visual element. ## Changes In `KryptonCustomPaletteBase.ImportFromXmlDocument`, the palette is now populated from `BasePalette` before applying the XML overrides: - Call `PopulateFromBaseOperation(null)` before importing the `Properties` / `Images` elements from the XML. ## Why this works The initial populate step ensures missing metrics/draw settings (including caption/button related values used by the form window buttons) are correctly inherited from the base palette. The subsequent XML import can then override only what the theme explicitly defines. ## Files Modified - `Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCustomPaletteBase.cs` ## Testing - Repro: apply a custom theme (e.g. `Microsoft365Pink`) to a `KryptonForm` and verify the small square near the Close button is gone. - Sanity: verify built-in palettes are unaffected. ## Notes - A full `dotnet build` was not clean in this environment due to pre-existing MSBuild/resource configuration errors unrelated to this palette change.
Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCustomPaletteBase.cs
Outdated
Show resolved
Hide resolved
Source/Krypton Components/TestForm/Bug3183SmallSquareRenderedNextToClose.cs
Outdated
Show resolved
Hide resolved
…e-button-on-kryptonform-when-using-a-custom-theme
|
Hi @PWagner1, The issue is still present.
|
Hi @mcpbcs Thanks for the info, there's only one way to find out and that is to test that theory. |
…e-button-on-kryptonform-when-using-a-custom-theme
…e-button-on-kryptonform-when-using-a-custom-theme


…g a custom theme
PR Description - #3183
Summary
Fix a rendering artifact (a small square) appearing next to the
KryptonFormClose (X) button when using a custom XML-based Krypton theme/palette.Root Cause
When importing a custom palette from XML, palette values that are omitted by the theme XML could remain at placeholder/default C# values instead of being initialized from the palette's
BasePalette. This could leave caption/button chrome in an invalid/partial state, producing a small stray visual element.Changes
In
KryptonCustomPaletteBase.ImportFromXmlDocument, the palette is now populated fromBasePalettebefore applying the XML overrides:PopulateFromBaseOperation(null)before importing theProperties/Imageselements from the XML.Why this works
The initial populate step ensures missing metrics/draw settings (including caption/button related values used by the form window buttons) are correctly inherited from the base palette. The subsequent XML import can then override only what the theme explicitly defines.
Files Modified
Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonCustomPaletteBase.csTesting
Microsoft365Pink) to aKryptonFormand verify the small square near the Close button is gone.Notes
dotnet buildwas not clean in this environment due to pre-existing MSBuild/resource configuration errors unrelated to this palette change.