private void C_PropertyGrid_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e) { TreeNode selectedNode = this.C_StyleTree.SelectedNode; if (selectedNode.Text == "Rows Style" && selectedNode.Parent != null) { BasicStyle alternateStyle = (this.C_StyleTree.SelectedNode.Nodes[0].Tag) as BasicStyle; SetStyleValue(alternateStyle, e); } //TreeNode childNode = null; if (selectedNode.Parent == null) { foreach (TreeNode childNode in selectedNode.Nodes) { BasicStyle rowsStyle = childNode.Tag as BasicStyle; SetStyleValue(rowsStyle, e); if (childNode.Nodes.Count > 1) { SetStyleValue(childNode.Nodes[0].Tag as BasicStyle, e); } } } }
public BasicStyleCache(BasicStyle style) { if (style == null) { return; } Thickness = style.Thickness; HalfThickness = Thickness / 2.0; if (style.Fill != null) { FillBrush = ToBrush(style.Fill); FillBrush.Freeze(); } if (style.Stroke != null) { StrokeBrush = ToBrush(style.Stroke); StrokeBrush.Freeze(); StrokePen = new Pen(StrokeBrush, Thickness); StrokePen.Freeze(); } }
/// <summary> /// Fill in the UI style elements using the default KSP skin elements /// </summary> /// <param name="style"></param> private void processComponents(BasicStyle style) { if (style == null) { return; } UISkinDef skin = UISkinManager.defaultSkin; if (skin == null) { return; } switch (style.ElementType) { case BasicStyle.ElementTypes.Window: style.setImage(panelSprite, Image.Type.Sliced); break; case BasicStyle.ElementTypes.Box: style.setImage(windowSprite, Image.Type.Sliced); break; case BasicStyle.ElementTypes.Button: style.setButton(skin.button.normal.background, skin.button.highlight.background, skin.button.active.background, skin.button.disabled.background); break; case BasicStyle.ElementTypes.Toggle: style.setToggle(buttonSprite, null, null); break; case BasicStyle.ElementTypes.Slider: style.setSlider(skin.horizontalSlider.normal.background, skin.horizontalSliderThumb.normal.background, skin.horizontalSliderThumb.highlight.background, skin.horizontalSliderThumb.active.background, skin.horizontalSliderThumb.disabled.background); break; case BasicStyle.ElementTypes.Header: style.setImage(titleSprite, Image.Type.Sliced); break; case BasicStyle.ElementTypes.Footer: style.setImage(footerSprite, Image.Type.Sliced); break; case BasicStyle.ElementTypes.Content: style.setImage(componentSprite, Image.Type.Sliced); break; case BasicStyle.ElementTypes.ContentFooter: style.setImage(contentFooterSprite, Image.Type.Sliced); break; case BasicStyle.ElementTypes.ContentToggle: style.setToggle(componentSprite, selectedSprite, unselectedSprite); break; default: break; } }
//ctor public ExControlView(ExControl i_Control) { this.ExControl = i_Control; this.MainStyle = new BasicStyle(); this.ThreeD = false; this.Repeat = false; }
private BasicStyleCache FromCache(BasicStyle style) { BasicStyleCache value; if (_cache.TryGetValue(style, out value)) { return(value); } value = new BasicStyleCache(style); _cache.Add(style, value); return(value); }
public StyleBuilderForm() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // this._RowsStyle = new BasicStyle(); this._ColumnsStyle = new BasicStyle(); }
private void SetStyleValue(BasicStyle style, System.Windows.Forms.PropertyValueChangedEventArgs e) { Type type = typeof(BasicStyle); PropertyInfo property = type.GetProperty(e.ChangedItem.Label); if (property == null) { return; } property.SetValue(style, e.ChangedItem.Value, null); }
private void InitializeStyles() { _cache = new Dictionary <BasicStyle, BasicStyleCache>(); // Spiro styles. _geometryStyle = new BasicStyle( new Argb(255, 0, 0, 0), new Argb(128, 128, 128, 128), 2.0); _hitGeometryStyle = new BasicStyle( new Argb(255, 255, 0, 0), new Argb(128, 128, 0, 0), 2.0); _pointStyle = new BasicStyle( new Argb(192, 0, 0, 255), new Argb(192, 0, 0, 255), 2.0); _hitPointStyle = new BasicStyle( new Argb(192, 255, 0, 0), new Argb(192, 255, 0, 0), 2.0); // Guide styles. _guideStyle = new BasicStyle( new Argb(255, 0, 255, 255), new Argb(255, 0, 255, 255), 1.0); _snapGuideStyle = new BasicStyle( new Argb(255, 255, 255, 0), new Argb(255, 255, 255, 0), 1.0); _snapPointStyle = new BasicStyle( new Argb(255, 255, 255, 0), new Argb(255, 255, 255, 0), 1.0); _newLineStyle = new BasicStyle( new Argb(255, 255, 255, 0), new Argb(255, 255, 255, 0), 1.0); _lineStyle = new BasicStyle( new Argb(255, 0, 255, 255), new Argb(255, 0, 255, 255), 1.0); }
private void C_BtnRevert_Click(object sender, System.EventArgs e) { TreeNode node = this.C_StyleTree.SelectedNode; if (node == null) { return; } BasicStyle style = node.Tag as BasicStyle; if (style == null) { return; } style.Revert(); this.C_PropertyGrid.Refresh(); }
public BasicStyleCache(BasicStyle style) { if (style == null) return; Thickness = style.Thickness; HalfThickness = Thickness / 2.0; if (style.Fill != null) { FillBrush = ToBrush(style.Fill); } if (style.Stroke != null) { StrokeBrush = ToBrush(style.Stroke); StrokePen = new Pen(StrokeBrush, Thickness); } }
/// <summary> /// Fill in the UI style elements using the default KSP skin elements /// </summary> /// <param name="style"></param> private void processComponents(BasicStyle style) { if (style == null) { return; } UISkinDef skin = UISkinManager.defaultSkin; if (skin == null) { return; } switch (style.ElementType) { case BasicStyle.ElementTypes.Window: style.setImage(skin.window.normal.background, Image.Type.Sliced); break; case BasicStyle.ElementTypes.Box: style.setImage(skin.box.normal.background, Image.Type.Sliced); break; case BasicStyle.ElementTypes.Button: style.setButton(skin.button.normal.background, skin.button.highlight.background, skin.button.active.background, skin.button.disabled.background); break; case BasicStyle.ElementTypes.Toggle: style.setToggle(skin.button.normal.background, skin.button.highlight.background, skin.button.active.background, skin.button.disabled.background); break; case BasicStyle.ElementTypes.Slider: style.setSlider(skin.horizontalSlider.normal.background, skin.horizontalSliderThumb.normal.background, skin.horizontalSliderThumb.highlight.background, skin.horizontalSliderThumb.active.background, skin.horizontalSliderThumb.disabled.background); break; default: break; } }
public ExControlView(SerializationInfo info, StreamingContext context) { // TODO: Add ExControlView.GetObjectData implementation this.MainStyle = info.GetValue("MainStyle", typeof(BasicStyle)) as BasicStyle; try { this.PrintingTable = info.GetValue("PrintingTable", typeof(WebbTable)) as WebbTable; } catch { this.PrintingTable = new WebbTable(); //scott@12022008 } try { this.OneValueScFilter = info.GetValue("OneValueScFilter", typeof(SectionFilter)) as SectionFilter; } catch { } try { this.ThreeD = info.GetBoolean("ThreeD"); } catch { this.ThreeD = false; } try { this.Repeat = info.GetBoolean("Repeat"); } catch { this.Repeat = false; } }
private void InitializeStyles() { _cache = new Dictionary<BasicStyle, BasicStyleCache>(); // Spiro styles. _geometryStyle = new BasicStyle( new Argb(255, 0, 0, 0), new Argb(128, 128, 128, 128), 2.0); _hitGeometryStyle = new BasicStyle( new Argb(255, 255, 0, 0), new Argb(128, 128, 0, 0), 2.0); _pointStyle = new BasicStyle( new Argb(192, 0, 0, 255), new Argb(192, 0, 0, 255), 2.0); _hitPointStyle = new BasicStyle( new Argb(192, 255, 0, 0), new Argb(192, 255, 0, 0), 2.0); // Guide styles. _guideStyle = new BasicStyle( new Argb(255, 0, 255, 255), new Argb(255, 0, 255, 255), 1.0); _snapGuideStyle = new BasicStyle( new Argb(255, 255, 255, 0), new Argb(255, 255, 255, 0), 1.0); _snapPointStyle = new BasicStyle( new Argb(255, 255, 255, 0), new Argb(255, 255, 255, 0), 1.0); _newLineStyle = new BasicStyle( new Argb(255, 255, 255, 0), new Argb(255, 255, 255, 0), 1.0); _lineStyle = new BasicStyle( new Argb(255, 0, 255, 255), new Argb(255, 0, 255, 255), 1.0); }
/// <summary> /// Add text with te given basic style /// </summary> /// <param name="text"></param> /// <param name="style"></param> /// <returns></returns> public int AddTextWithBasicStyle(string text, BasicStyle style) { return(AddText(text, style.GetProperties())); }
/// <summary> /// Replace the <paramref name="searchText"/> with the <paramref name="replaceText"/> adding the style given in <paramref name="style"/> /// </summary> /// <param name="searchText"></param> /// <param name="replaceText"></param> /// <param name="matchCase"></param> /// <param name="style"></param> /// <returns></returns> public int ReplaceTextWithBasicStyle(string searchText, string replaceText, bool matchCase, BasicStyle style) { return(ReplaceTextWithStyle(searchText, replaceText, matchCase, style.GetProperties())); }
private BasicStyleCache FromCache(BasicStyle style) { BasicStyleCache value; if (_cache.TryGetValue(style, out value)) { return value; } value = new BasicStyleCache(style); _cache.Add(style, value); return value; }
public static MotorControl.ControlMode LookupCM(BasicStyle basicStyle) { return((MotorControl.ControlMode)(basicStyle)); }
public static Styles.AdvancedStyle Promote(BasicStyle basicStyle) { return((Styles.AdvancedStyle)basicStyle); }
public ColumnStyle(SerializationInfo info, StreamingContext context) { try { this.fieldName = info.GetString("FieldName"); } catch { fieldName = string.Empty; } try { this.style = info.GetValue("Style", typeof(BasicStyle)) as BasicStyle; } catch { style = new BasicStyle(); } try { this.columnWidth = info.GetInt32("ColumnWidth"); } catch { columnWidth = BasicStyle.ConstValue.CellWidth; } try { this.title = info.GetString("title"); } catch { this.title = fieldName; } try { this.titleFormat = (StringFormatFlags)info.GetValue("titleFormat", typeof(StringFormatFlags)); } catch { titleFormat = 0; } try { colorNeedChange = info.GetBoolean("colorNeedChange"); } catch { if (this.Style.BackgroundColor != Color.Transparent) { colorNeedChange = true; } else { colorNeedChange = false; } } try { description = info.GetString("description"); } catch { description = string.Empty; } }
TableVM prepareSampleViewmodel() { var model = new TableVM() { TestTable = new Table( new Table.PageModel("First Table", 4, true)) { Responsive = true, UseVerticalTable = true } }; var headerStyle = new HeaderStyle(); var rowStyle = new BasicStyle(Color.Red, textBold: true, htmlClasses: "text-danger"); var rnd = new Random(); model.TestTable .AddRow(new Row(RowEnum.Header) .AddCell(new Cell(values: new StringValue("Rows"), style: headerStyle)) .UpdateTextPosition(TextPositionEnum.Left) .AddCell(new Cell(values: new StringValue("Col1"), style: headerStyle)) .AddCell(new Cell(values: new StringValue("Col2"), style: headerStyle)) .AddCell(new Cell(values: new StringValue("Col3"), style: headerStyle)) .AddCell(new Cell(values: new StringValue("Col4"), style: headerStyle)) .AddRow(new Row() .AddCell(new Cell(values: new StringValue("Row1"), style: rowStyle)) .UpdateTextPosition(TextPositionEnum.Left) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100))))) .AddRow(new Row() .AddCell(new Cell(values: new StringValue("Row2"), style: rowStyle)) .UpdateTextPosition(TextPositionEnum.Left) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Int))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Single))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Double))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Triple)))) .AddRow(new Row() .AddCell(new Cell(values: new StringValue("Row3"), style: rowStyle)) .UpdateTextPosition(TextPositionEnum.Left) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100))))) .AddRow(new Row() .AddCell(new Cell(values: new StringValue("Row4"), style: rowStyle)) .UpdateTextPosition(TextPositionEnum.Left) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Int))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Single))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Double))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Triple)))) .AddRow(new Row() .AddCell(new Cell(values: new StringValue("Row5"), style: rowStyle)) .UpdateTextPosition(TextPositionEnum.Left) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100))))) .AddRow(new Row() .AddCell(new Cell(values: new StringValue("Row6"), style: rowStyle)) .UpdateTextPosition(TextPositionEnum.Left) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Int))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Single))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Double))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Triple)))) .AddRow(new Row() .AddCell(new Cell(values: new StringValue("Row7"), style: rowStyle)) .UpdateTextPosition(TextPositionEnum.Left) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100)))) .AddCell(new Cell(values: new IntValue(rnd.Next(-100, 100))))) .AddRow(new Row() .AddCell(new Cell(values: new StringValue("Row8"), style: rowStyle)) .UpdateTextPosition(TextPositionEnum.Left) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Int))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Single))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Double))) .AddCell(new Cell(values: new DoubleValue(rnd.NextDouble() * 100, ValueEnum.Triple))))); return(model); }
public HorizonGroupView(SerializationInfo info, StreamingContext context) : base(info, context) { try { _RootGroupInfo = (Webb.Reports.ExControls.Data.GroupInfo)info.GetValue("_RootGroupInfo", typeof(Webb.Reports.ExControls.Data.GroupInfo)); } catch { } try { _Fitler = (Webb.Data.DBFilter)info.GetValue("_Fitler", typeof(Webb.Data.DBFilter)); } catch { } try { _ShowRowIndicators = info.GetBoolean("_ShowRowIndicators"); } catch { _ShowRowIndicators = false; } try { _HaveHeader = info.GetBoolean("_HaveHeader"); } catch { _HaveHeader = true; } try { _ColumnsWidth = (Webb.Collections.Int32Collection)info.GetValue("_ColumnsWidth", typeof(Webb.Collections.Int32Collection)); } catch { } try { _RowsHight = (Webb.Collections.Int32Collection)info.GetValue("_RowsHight", typeof(Webb.Collections.Int32Collection)); } catch { } try { _Total = info.GetBoolean("_Total"); } catch { _Total = true; } try { _HorizonTopCount = info.GetInt32("_HorizonTopCount"); } catch { _HorizonTopCount = 0; } try { _TotalOthers = info.GetBoolean("_TotalOthers"); } catch { _TotalOthers = false; } try { _TotalOthersName = info.GetString("_TotalOthersName"); } catch { _TotalOthersName = "Others"; } try { _TotalStyle = (Webb.Reports.ExControls.BasicStyle)info.GetValue("_TotalStyle", typeof(Webb.Reports.ExControls.BasicStyle)); } catch { _TotalStyle = new BasicStyle(); } try { _HeaderRows = (Webb.Collections.Int32Collection)info.GetValue("_HeaderRows", typeof(Webb.Collections.Int32Collection)); } catch { _HeaderRows = new Int32Collection(); } try { TableHeaders = (Webb.Reports.ExControls.Data.HeadersData)info.GetValue("TableHeaders", typeof(Webb.Reports.ExControls.Data.HeadersData)); } catch { TableHeaders = null; } try { _TotalPosition = (Webb.Data.TotalType)info.GetValue("_TotalPosition", typeof(Webb.Data.TotalType)); } catch { if (_RootGroupInfo != null && _RootGroupInfo.AddTotal) { _TotalPosition = TotalType.AllBefore; _RootGroupInfo.AddTotal = false; } else { _TotalPosition = TotalType.None; } if (RootGroupInfo != null) { if (RootGroupInfo.SubGroupInfos.Count > 0 && RootGroupInfo.Summaries != null) { RootGroupInfo.SubGroupInfos[0].Summaries = RootGroupInfo.Summaries.CopyStructure(); } RootGroupInfo.Summaries = new GroupSummaryCollection(); if (this.Total) { GroupSummary groupSummary = new GroupSummary(); groupSummary.ColorNeedChange = true; groupSummary.Style.SetStyle(this.TotalStyle); groupSummary.ShowZeros = true; RootGroupInfo.Summaries.Add(groupSummary); } } } try { _TotalOthersPosition = (Webb.Data.TotalType)info.GetValue("_TotalOthersPosition", typeof(Webb.Data.TotalType)); } catch { if (this._TotalOthers) { _TotalOthersPosition = TotalType.AllAfter; } else { _TotalOthersPosition = TotalType.None; } } try { _SummaryForTotalGroup = (Webb.Reports.ExControls.Data.GroupSummary)info.GetValue("_SummaryForTotalGroup", typeof(Webb.Reports.ExControls.Data.GroupSummary)); } catch { _SummaryForTotalGroup = new GroupSummary(); } try { _SummaryForOthers = (Webb.Reports.ExControls.Data.GroupSummary)info.GetValue("_SummaryForOthers", typeof(Webb.Reports.ExControls.Data.GroupSummary)); } catch { _SummaryForOthers = new GroupSummary(); } }