text_format_flags |= TextFormatFlags.WordBreak;
}
+ if (Parent != null)
+ Parent.PerformLayout (this, "AutoEllipsis");
this.Invalidate ();
}
}
set {
if (flat_style != value) {
flat_style = value;
+
+ if (Parent != null)
+ Parent.PerformLayout (this, "FlatStyle");
Invalidate();
}
}
set {
if (use_compatible_text_rendering != value) {
use_compatible_text_rendering = value;
+ if (Parent != null)
+ Parent.PerformLayout (this, "UseCompatibleTextRendering");
Invalidate ();
}
}
+2008-09-03 Ivan N. Zlatev <contact@i-nz.net>
+
+ * ButtonBase.cs CheckBox.cs, Control.cs, FlowLayoutPanel.cs,
+ FlowLayoutSettings.cs, GroupBox.cs, Label.cs, ListBox.cs,
+ PropertyGrid.cs, RadioButton.cs, TableLayoutPanel.cs,
+ TableLayoutSettings.cs, ToolStrip.cs, ToolStripDropDownButton.cs,
+ ToolStripDropDownMenu.cs, ToolStripItem.cs, ToolStripSplitButton.cs,
+ ToolStripStatusLabel.cs: Add missing PerformLayout calls to various
+ properties.
+ [Fixes bug #418684]
+
2008-09-03 Neville Gao <nevillegao@gmail.com>
* StatusBar.cs: Control enabled to support accessibility.
if (value != appearance) {
appearance = value;
OnAppearanceChanged (EventArgs.Empty);
+
+ if (Parent != null)
+ Parent.PerformLayout (this, "Appearance");
Invalidate();
}
}
set {
if (value != check_alignment) {
check_alignment = value;
-
+ if (Parent != null)
+ Parent.PerformLayout (this, "CheckAlign");
Invalidate();
}
}
auto_size = value;
// If we're turning this off, reset our size
- if (!value)
+ if (!value) {
Size = explicit_bounds.Size;
-
+ } else {
+ if (Parent != null)
+ Parent.PerformLayout (this, "AutoSize");
+ }
+
OnAutoSizeChanged (EventArgs.Empty);
}
}
set {
if (this.margin != value) {
this.margin = value;
+ if (Parent != null)
+ Parent.PerformLayout (this, "Margin");
OnMarginChanged (EventArgs.Empty);
}
}
internal FlowLayoutSettings LayoutSettings {
get {
if (this.settings == null)
- this.settings = new FlowLayoutSettings ();
+ this.settings = new FlowLayoutSettings (this);
return this.settings;
}
public void SetFlowBreak (Control control, bool value)
{
LayoutSettings.SetFlowBreak (control, value);
- this.PerformLayout (control, "FlowBreak");
}
#endregion
private bool wrap_contents;
private LayoutEngine layout_engine;
private Dictionary<object, bool> flow_breaks;
+ private Control owner;
- internal FlowLayoutSettings ()
+ internal FlowLayoutSettings () : this (null)
+ {
+ }
+
+ internal FlowLayoutSettings (Control owner)
{
flow_breaks = new Dictionary<object, bool> ();
wrap_contents = true;
flow_direction = FlowDirection.LeftToRight;
+ this.owner = owner;
}
#region Public Properties
[DefaultValue (FlowDirection.LeftToRight)]
public FlowDirection FlowDirection {
get { return this.flow_direction; }
- set { this.flow_direction = value; }
+ set {
+ if (this.flow_direction != value) {
+ this.flow_direction = value;
+ if (owner != null)
+ owner.PerformLayout (owner, "FlowDirection");
+ }
+ }
}
public override LayoutEngine LayoutEngine {
[DefaultValue (true)]
public bool WrapContents {
get { return this.wrap_contents; }
- set { this.wrap_contents = value; }
+ set {
+ if (this.wrap_contents != value) {
+ this.wrap_contents = value;
+ if (owner != null)
+ owner.PerformLayout (owner, "WrapContents");
+ }
+ }
}
#endregion
public void SetFlowBreak (Object child, bool value)
{
flow_breaks[child] = value;
+ if (owner != null)
+ owner.PerformLayout ((Control)child, "FlowBreak");
}
#endregion
}
}
set {
- use_compatible_text_rendering = value;
+ if (use_compatible_text_rendering != value) {
+ use_compatible_text_rendering = value;
+ if (Parent != null)
+ Parent.PerformLayout (this, "UseCompatibleTextRendering");
+ Invalidate ();
+ }
}
}
#endif
else
string_format.Trimming = StringTrimming.Character;
+ if (Parent != null)
+ Parent.PerformLayout (this, "AutoEllipsis");
this.Invalidate ();
}
}
return;
flat_style = value;
+ if (Parent != null)
+ Parent.PerformLayout (this, "FlatStyle");
Invalidate ();
}
}
else
item_heights = null;
+ if (Parent != null)
+ Parent.PerformLayout (this, "DrawMode");
base.Refresh ();
}
}
[DefaultValue (false)]
public bool UseCompatibleTextRendering {
get { return use_compatible_text_rendering; }
- set { use_compatible_text_rendering = value; }
+ set {
+ if (use_compatible_text_rendering != value) {
+ use_compatible_text_rendering = value;
+ if (Parent != null)
+ Parent.PerformLayout (this, "UseCompatibleTextRendering");
+ Invalidate ();
+ }
+ }
}
#endif
EventHandler eh = (EventHandler)(Events [AppearanceChangedEvent]);
if (eh != null)
eh (this, EventArgs.Empty);
+ if (Parent != null)
+ Parent.PerformLayout (this, "Appearance");
Invalidate();
}
}
[DefaultValue (0)]
public int ColumnCount {
get { return settings.ColumnCount; }
- set {
- if (settings.ColumnCount != value) {
- settings.ColumnCount = value;
- this.PerformLayout (this, "ColumnCount");
- }
- }
+ set { settings.ColumnCount = value; }
}
[Browsable (false)]
[DefaultValue (TableLayoutPanelGrowStyle.AddRows)]
public TableLayoutPanelGrowStyle GrowStyle {
get { return settings.GrowStyle; }
- set {
- if (settings.GrowStyle != value) {
- settings.GrowStyle = value;
- PerformLayout (this, "GrowStyle");
- }
- }
+ set { settings.GrowStyle = value; }
}
public override System.Windows.Forms.Layout.LayoutEngine LayoutEngine {
[DefaultValue (0)]
public int RowCount {
get { return settings.RowCount; }
- set {
- if (settings.RowCount != value) {
- settings.RowCount = value;
- this.PerformLayout (this, "RowCount");
- }
- }
+ set { settings.RowCount = value; }
}
[Browsable (false)]
public void SetCellPosition (Control control, TableLayoutPanelCellPosition position)
{
settings.SetCellPosition (control, position);
- this.PerformLayout ();
}
public void SetColumn (Control control, int column)
{
settings.SetColumn (control, column);
- this.PerformLayout ();
}
public void SetColumnSpan (Control control, int value)
{
settings.SetColumnSpan (control, value);
- this.PerformLayout ();
}
public void SetRow (Control control, int row)
{
settings.SetRow (control, row);
- this.PerformLayout ();
}
public void SetRowSpan (Control control, int value)
{
settings.SetRowSpan (control, value);
- this.PerformLayout ();
}
#endregion
internal override Size GetPreferredSizeCore (Size proposedSize)
{
- // If the tablelayoutpanel is autosize, we have to make sure it is big enough
+ // If the tablelayoutowner is autosize, we have to make sure it is big enough
// to hold every non-autosize control
actual_positions = (LayoutEngine as TableLayout).CalculateControlPositions (this, Math.Max (ColumnCount, 1), Math.Max (RowCount, 1));
int actual_cols = actual_positions.GetLength (0);
int actual_rows = actual_positions.GetLength (1);
- // Figure out how wide the panel needs to be
+ // Figure out how wide the owner needs to be
int[] column_widths = new int[actual_cols];
float total_column_percentage = 0f;
}
// Because percentage based rows divy up the remaining space,
- // we have to make the panel big enough so that all the rows
+ // we have to make the owner big enough so that all the rows
// get bigger, even if we only need one to be bigger.
int non_percent_total_width = 0;
int percent_total_width = 0;
}
- // Figure out how tall the panel needs to be
+ // Figure out how tall the owner needs to be
int[] row_heights = new int[actual_rows];
float total_row_percentage = 0f;
}
// Because percentage based rows divy up the remaining space,
- // we have to make the panel big enough so that all the rows
+ // we have to make the owner big enough so that all the rows
// get bigger, even if we only need one to be bigger.
int non_percent_total_height = 0;
int percent_total_height = 0;
if (value < 0)
throw new ArgumentOutOfRangeException();
- column_count = value;
+ if (column_count != value) {
+ column_count = value;
+ panel.PerformLayout (panel, "ColumnCount");
+ }
}
}
if (!Enum.IsDefined (typeof(TableLayoutPanelGrowStyle), value))
throw new ArgumentException();
- grow_style = value;
+ if (grow_style != value) {
+ grow_style = value;
+ panel.PerformLayout (panel, "GrowStyle");
+ }
}
}
set {
if (value < 0)
throw new ArgumentOutOfRangeException ();
- row_count = value;
+
+ if (row_count != value) {
+ row_count = value;
+ panel.PerformLayout (panel, "RowCount");
+ }
}
}
columns[control] = cellPosition.Column;
rows[control] = cellPosition.Row;
+ panel.PerformLayout ();
}
public void SetColumn (Object control, int column)
throw new ArgumentException ();
columns[control] = column;
+ panel.PerformLayout ();
}
public void SetColumnSpan (Object control, int value)
throw new ArgumentException ();
column_spans[control] = value;
+ panel.PerformLayout ();
}
public void SetRow (Object control, int row)
throw new ArgumentException ();
rows[control] = row;
+ panel.PerformLayout ();
}
public void SetRowSpan (Object control, int value)
throw new ArgumentException ();
row_spans[control] = value;
+ panel.PerformLayout ();
}
#endregion
if (!Enum.IsDefined (typeof (ToolStripGripStyle), value))
throw new InvalidEnumArgumentException (string.Format ("Enum argument value '{0}' is not valid for ToolStripGripStyle", value));
this.grip_style = value;
- this.PerformLayout ();
+ this.PerformLayout (this, "GripStyle");
}
}
}
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public LayoutSettings LayoutSettings {
get { return this.layout_settings; }
- set { this.layout_settings = value; }
+ set {
+ if (this.layout_settings != value) {
+ this.layout_settings = value;
+ PerformLayout (this, "LayoutSettings");
+ }
+ }
}
[AmbientValue (ToolStripLayoutStyle.StackWithOverflow)]
this.layout_settings = this.CreateLayoutSettings (value);
- this.PerformLayout ();
+ this.PerformLayout (this, "LayoutStyle");
this.OnLayoutStyleChanged (EventArgs.Empty);
}
}
if (this.renderer != value) {
this.renderer = value;
this.render_mode = ToolStripRenderMode.Custom;
- this.PerformLayout ();
+ this.PerformLayout (this, "Renderer");
this.OnRendererChanged (EventArgs.Empty);
}
}
{
switch (layoutStyle) {
case ToolStripLayoutStyle.Flow:
- return new FlowLayoutSettings ();
+ return new FlowLayoutSettings (this);
case ToolStripLayoutStyle.Table:
//return new TableLayoutSettings ();
case ToolStripLayoutStyle.StackWithOverflow:
[DefaultValue (true)]
public bool ShowDropDownArrow {
get { return this.show_drop_down_arrow; }
- set { this.show_drop_down_arrow = value; }
+ set {
+ if (this.show_drop_down_arrow != value) {
+ this.show_drop_down_arrow = value;
+ CalculateAutoSize ();
+ }
+ }
}
#endregion
[DefaultValue (false)]
public bool ShowCheckMargin {
get { return this.show_check_margin; }
- set { this.show_check_margin = value; }
+ set {
+ if (this.show_check_margin != value) {
+ this.show_check_margin = value;
+ PerformLayout (this, "ShowCheckMargin");
+ }
+ }
}
[DefaultValue (true)]
public bool ShowImageMargin {
get { return this.show_image_margin; }
- set { this.show_image_margin = value; }
+ set {
+ if (this.show_image_margin != value) {
+ this.show_image_margin = value;
+ PerformLayout (this, "ShowImageMargin");
+ }
+ }
}
#endregion
if (!Enum.IsDefined (typeof (ToolStripItemAlignment), value))
throw new InvalidEnumArgumentException (string.Format ("Enum argument value '{0}' is not valid for ToolStripItemAlignment", value));
- this.alignment = value;
+ if (this.alignment != value) {
+ this.alignment = value;
+ this.CalculateAutoSize ();
+ }
}
}
this.display_style = value;
this.CalculateAutoSize ();
OnDisplayStyleChanged (EventArgs.Empty);
- if (this.Parent != null)
- this.Parent.PerformLayout ();
}
}
}
if (!Enum.IsDefined (typeof (ContentAlignment), value))
throw new InvalidEnumArgumentException (string.Format ("Enum argument value '{0}' is not valid for ContentAlignment", value));
- this.image_align = value;
- this.Invalidate ();
+ if (image_align != value) {
+ this.image_align = value;
+ this.CalculateAutoSize ();
+ }
}
}
public ToolStripItemImageScaling ImageScaling {
get { return this.image_scaling; }
set {
- this.image_scaling = value;
- this.CalculateAutoSize ();
- this.Invalidate ();
+ if (image_scaling != value) {
+ this.image_scaling = value;
+ this.CalculateAutoSize ();
+ }
}
}
set {
if (!Enum.IsDefined (typeof (ContentAlignment), value))
throw new InvalidEnumArgumentException (string.Format ("Enum argument value '{0}' is not valid for ContentAlignment", value));
- this.text_align = value;
- this.Invalidate ();
+
+ if (this.text_align != value) {
+ this.text_align = value;
+ this.CalculateAutoSize ();
+ }
}
}
set {
if (value < 0)
throw new ArgumentOutOfRangeException ();
-
- this.drop_down_button_width = value;
+ if (this.drop_down_button_width != value) {
+ this.drop_down_button_width = value;
+ CalculateAutoSize ();
+ }
}
}
[DefaultValue (false)]
public bool Spring {
get { return this.spring; }
- set { this.spring = value; }
+ set {
+ if (this.spring != value) {
+ this.spring = value;
+ CalculateAutoSize ();
+ }
+ }
}
#endregion