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
1 change: 1 addition & 0 deletions Documents/Changelog/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

## 2026-04-20 - Build 2604 (Version 105-LTS - Patch 2) - April 2026

* Resolved [#2103](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2103), Ensure that `KryptonForm` properly supports RTL/LTR
* Resolved [#2914](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2914), White bar is shown in a `KryptonForm` Sizable without buttons and text
* Resolved [#2910](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2910), `KryptonComboBox` override Font property causes form designer error
* Resolved [#2902](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2902), NuGet Version Discrepancy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,16 @@ private int GetTargetDockerIndex(HeaderLocation location)
return -1;
}

private ViewDockStyle GetDockStyle(ButtonSpec spec) => spec.GetEdge(_redirector) == RelativeEdgeAlign.Near ? ViewDockStyle.Left : ViewDockStyle.Right;
private ViewDockStyle GetDockStyle(ButtonSpec spec)
{
var edge = spec.GetEdge(_redirector);

var isRtl = Control is Form form && form.RightToLeft == RightToLeft.Yes && form.RightToLeftLayout;

// In RTL mode with RightToLeftLayout enabled, reverse the dock style
return isRtl ? edge == RelativeEdgeAlign.Near ? ViewDockStyle.Right : ViewDockStyle.Left :
edge == RelativeEdgeAlign.Near ? ViewDockStyle.Left : ViewDockStyle.Right;
}

private VisualOrientation CalculateOrientation(VisualOrientation viewOrientation,
ButtonOrientation buttonOrientation) => buttonOrientation switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,80 @@ public FormPaletteRedirect(PaletteBase palette, KryptonForm kryptonForm)
_kryptonForm = kryptonForm;
}

public override PaletteRelativeAlign GetContentShortTextH(PaletteContentStyle style, PaletteState state) => style switch
public override PaletteRelativeAlign GetContentShortTextH(PaletteContentStyle style, PaletteState state)
{
PaletteContentStyle.HeaderForm
if (style is PaletteContentStyle.HeaderForm
or PaletteContentStyle.HeaderPrimary
or PaletteContentStyle.HeaderDockInactive
or PaletteContentStyle.HeaderDockActive
or PaletteContentStyle.HeaderSecondary
or PaletteContentStyle.HeaderCustom1
or PaletteContentStyle.HeaderCustom2
or PaletteContentStyle.HeaderCustom3 => _kryptonForm._formTitleAlign != PaletteRelativeAlign.Inherit
or PaletteContentStyle.HeaderCustom3)
{
// In RTL mode with RightToLeftLayout enabled, position title on the right (Far)
// The content layout system will position text before image when both are Far,
// so the order is: [Buttons] [Title] [Icon]
if (_kryptonForm.RightToLeft == RightToLeft.Yes && _kryptonForm.RightToLeftLayout)
{
// Title should be Far (right side) so it appears on the right before the icon
return PaletteRelativeAlign.Far;
}

// Use custom title align if set, otherwise use base
return _kryptonForm._formTitleAlign != PaletteRelativeAlign.Inherit
? _kryptonForm._formTitleAlign
: base.GetContentShortTextH(style, state),
_ => base.GetContentShortTextH(style, state)
};
: base.GetContentShortTextH(style, state);
}

return base.GetContentShortTextH(style, state);
}

public override PaletteRelativeAlign GetContentLongTextH(PaletteContentStyle style, PaletteState state)
{
// Handle header styles
if (style is PaletteContentStyle.HeaderForm
or PaletteContentStyle.HeaderPrimary
or PaletteContentStyle.HeaderDockInactive
or PaletteContentStyle.HeaderDockActive
or PaletteContentStyle.HeaderSecondary
or PaletteContentStyle.HeaderCustom1
or PaletteContentStyle.HeaderCustom2
or PaletteContentStyle.HeaderCustom3)
{
// In RTL mode with RightToLeftLayout enabled, position TextExtra on the left (Near)
// so it appears after the control box buttons: [Buttons] [TextExtra] [Title] [Icon]
if (_kryptonForm.RightToLeft == RightToLeft.Yes && _kryptonForm.RightToLeftLayout)
{
// TextExtra should be Near (left side) so it appears after the buttons
return PaletteRelativeAlign.Near;
}
}

return base.GetContentLongTextH(style, state);
}

public override PaletteRelativeAlign GetContentImageH(PaletteContentStyle style, PaletteState state)
{
// In RTL mode with RightToLeftLayout enabled, position icon on the right (Far)
if (_kryptonForm.RightToLeft == RightToLeft.Yes && _kryptonForm.RightToLeftLayout)
{
return style switch
{
PaletteContentStyle.HeaderForm
or PaletteContentStyle.HeaderPrimary
or PaletteContentStyle.HeaderDockInactive
or PaletteContentStyle.HeaderDockActive
or PaletteContentStyle.HeaderSecondary
or PaletteContentStyle.HeaderCustom1
or PaletteContentStyle.HeaderCustom2
or PaletteContentStyle.HeaderCustom3 => PaletteRelativeAlign.Far,
_ => base.GetContentImageH(style, state)
};
}

return base.GetContentImageH(style, state);
}
}

/// <summary>
Expand Down Expand Up @@ -1216,7 +1276,29 @@ public KryptonFormTitleStyle TitleStyle
UpdateTitleStyle(value);
}
}


/// <summary>
/// Gets and sets the RightToLeft property.
/// </summary>
[Browsable(true)]
[DefaultValue(RightToLeft.No)]
[EditorBrowsable(EditorBrowsableState.Always)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public override RightToLeft RightToLeft
{
get => base.RightToLeft;

set
{
if (base.RightToLeft != value)
{
base.RightToLeft = value;

OnRightToLeftChanged(EventArgs.Empty);
}
}
}

/// <summary>
/// Gets or sets a value indicating whether the form has a control box.
/// </summary>
Expand Down Expand Up @@ -1544,6 +1626,24 @@ protected override void OnResizeEnd(EventArgs e)
InvalidateNonClient();
}

/// <inheritdoc />
protected override void OnRightToLeftChanged(EventArgs e)
{
base.OnRightToLeftChanged(e);

// Recreate buttons when RTL changes to update their positions
_buttonManager?.RecreateButtons();
}

/// <inheritdoc />
protected override void OnRightToLeftLayoutChanged(EventArgs e)
{
base.OnRightToLeftLayoutChanged(e);

// Recreate buttons when RTL changes to update their positions
_buttonManager?.RecreateButtons();
}

/// <summary>
/// When border style changes via property, force non-client repaint so grippie updates immediately.
/// </summary>
Expand Down
Loading