C2021-004 added table cell shading button support logic

This commit is contained in:
John Jenko 2021-11-18 19:31:02 +00:00
parent 3929623fce
commit 884eda31e2
2 changed files with 48 additions and 3 deletions

View File

@ -4422,6 +4422,7 @@ namespace Volian.Controls.Library
if (MyFlexGrid.Cols[0].Width == -1) MyFlexGrid.Cols[0].Width = MyFlexGrid.Cols.DefaultSize; if (MyFlexGrid.Cols[0].Width == -1) MyFlexGrid.Cols[0].Width = MyFlexGrid.Cols.DefaultSize;
MyFlexGrid.Cols.Fixed = MyFlexGrid.Cols.Count; MyFlexGrid.Cols.Fixed = MyFlexGrid.Cols.Count;
MyFlexGrid.Rows.Fixed = MyFlexGrid.Rows.Count; MyFlexGrid.Rows.Fixed = MyFlexGrid.Rows.Count;
MyFlexGrid.StyleBackColor = MyFlexGrid.DefaultFixedBackgroundColor; // C2021-004 force the fixed background color
ToggleTableDesignButtons(false); ToggleTableDesignButtons(false);
//MyFlexGrid.ListStyles(); //MyFlexGrid.ListStyles();
} }
@ -4430,7 +4431,7 @@ namespace Volian.Controls.Library
// set grid back to "normal" mode // set grid back to "normal" mode
MyFlexGrid.Cols.Fixed = 0; MyFlexGrid.Cols.Fixed = 0;
MyFlexGrid.Rows.Fixed = 0; MyFlexGrid.Rows.Fixed = 0;
MyFlexGrid.StyleBackColor = Color.White; MyFlexGrid.ShowTableCellShading(); // C2021-004 show the table cell colors
ToggleTableDesignButtons(true); ToggleTableDesignButtons(true);
//MyFlexGrid.ListStyles(); //MyFlexGrid.ListStyles();
} }
@ -4643,6 +4644,50 @@ namespace Volian.Controls.Library
ChangeFontSize(SelectionOption.All, newSize); ChangeFontSize(SelectionOption.All, newSize);
} }
} }
#region Table Cell Shading
// C2021-004 Table Cell Shading
private void btnTblDgnCellShading_SelectedColorChanged(object sender, EventArgs e)
{
Color newshading = btnCellShading.SelectedColor;
MyFlexGrid.SetShading(MyFlexGrid.Selection, newshading); // assign the selected color the selected cell(s)
MyEditItem.Invalidate();
MyFlexGrid.Invalidate();
}
// This adds a button named "More Shading Options..." to the DotNetBar defined Color Selector button
private bool _CustomButtonAdded = false;
private void btnCellShading_PopupShowing(object sender, EventArgs e)
{
if (MyItemInfo == null || MyItemInfo.ActiveFormat.PlantFormat.FormatData.ShadingOptionList == null) return; //not shading options defined in format
if (!_CustomButtonAdded)
{
ButtonItem button = new ButtonItem();
button.Text = "More Shading Options...";
button.BeginGroup = true;
foreach (ShadingOption ShadeOpt in MyItemInfo.ActiveFormat.PlantFormat.FormatData.ShadingOptionList)
{
ButtonItem btn = new ButtonItem();
btn.Tag = ShadeOpt;
btn.Text = ShadeOpt.ToString();
btn.Click += new EventHandler(MoreShadingOptionsClick);
button.SubItems.Add(btn);
}
btnCellShading.SubItems.Add(button);
((MenuPanel)((PopupItem)button.Parent).PopupControl).RecalcLayout();
_CustomButtonAdded = true;
}
}
private void MoreShadingOptionsClick(object sender, EventArgs e)
{
ShadingOption sopt = (ShadingOption)((BaseItem)sender).Tag;
/* debug information
//string str = string.Format("Alpha {0}\n Red {1}\nBlue {2}\nGreen{3}", sopt.Alpha, sopt.Red, sopt.Blue, sopt.Green);
//MessageBox.Show(str,"more shading click");
*/
MyFlexGrid.SetShading(MyFlexGrid.Selection, sopt);
MyEditItem.Invalidate();
MyFlexGrid.Invalidate();
}
#endregion
} }
public class StepTabRibbonEventArgs : EventArgs public class StepTabRibbonEventArgs : EventArgs
{ {