WinForms Guna UI: Controls with Top-Right Anchor jump during side menu animation(2025)
public partial class MainForm : Form
{
bool isCollapsed2 = false;
public MainForm()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (isCollapsed2)
{
guna2Panel1.Width += 100;
if (guna2Panel1.Size == guna2Panel1.MaximumSize)
{
timer1.Stop();
}
}
else
{
guna2Panel1.Width -= 100;
if (guna2Panel1.Size == guna2Panel1.MinimumSize)
{
timer1.Stop();
}
}
}
private void moveRight_Click(object sender, EventArgs e)
{
timer1.Start();
isCollapsed2 = !isCollapsed2;
}
private void moveRight_Click(object sender, EventArgs e)
{
timer1.Start();
isCollapsed2 = !isCollapsed2;
}
}
Issue Summary:
I'm working on a WinForms application using the Guna UI 2 library. I have a collapsible left side menu (Panel) that expands/collapses using animation (Timer or Guna2Transition).
The problem:
- Controls anchored to the right (e.g., Anchor = Top | Right) jump or shift position unexpectedly when the menu panel width changes dynamically.
- This only happens during the animation (not when resizing instantly)
What I've tried so far:
Enabled WS_EX_COMPOSITED to reduce flickering → minor improvement, but controls still jump.
Removed Anchor Right → eliminates the jumping but breaks responsive layout.
Tried SuspendLayout() / ResumeLayout() → no significant effect during animation.
Disabled animation completely → no glitch occurs.
Demo Video: Link to video showing the issue 📹 Demo Video https://youtu.be/a4vvf1kkZ8w
What I need help with:
- How can I prevent top-right anchored controls from jumping during animated width changes of the left panel?
- Is there an alternative to WS_EX_COMPOSITED to keep UI smooth and avoid anchor glitches?