// Authors:
// Jonathan Pobst (monkey@jpobst.com)
//
-#if NET_2_0
+
using System.Drawing;
using System.ComponentModel;
this.control = c;
this.control_align = ContentAlignment.MiddleCenter;
this.control.TabStop = false;
+ this.control.Resize += ControlResizeHandler;
this.Size = DefaultSize;
this.OnSubscribeControlEvents (this.control);
}
if (control == null)
return new Size (23, 23);
- return control.GetPreferredSize (Size.Empty);
+ return control.Size;
}
}
#endregion
if (eh != null)
eh (this, e);
}
+
+ void ControlResizeHandler (object obj, EventArgs args)
+ {
+ OnHostedControlResize (args);
+ }
protected virtual void OnHostedControlResize (EventArgs e)
{
+ // Since the control size has been just adjusted, only update the location
+ if (control != null)
+ control.Location = AlignInRectangle (this.Bounds, control.Size, this.control_align).Location;
}
protected virtual void OnKeyDown (KeyEventArgs e)
#endregion
}
}
-#endif