public void WriteXml(Stream stream) { using (XmlTextWriter xmlTextWriter = new XmlTextWriter(stream, Encoding.UTF8)) { xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartElement("table"); if (this.CellSpacing != 0) { xmlTextWriter.WriteAttributeString("cellspacing", this.CellSpacing.ToString()); } if (this.CellPadding != 0) { xmlTextWriter.WriteAttributeString("cellpadding", this.CellPadding.ToString()); } if (this.CellPadding != 1) { xmlTextWriter.WriteAttributeString("border", this.Border.ToString()); } foreach (RowDefinition row in (Collection <RowDefinition>) this.rows) { xmlTextWriter.WriteStartElement("tr"); if (row.BackColor != Color.Empty) { xmlTextWriter.WriteAttributeString("bgcolor", "#" + ColorProvider.ColorToHex(row.BackColor)); } bool flag = false; foreach (CellDefinition cell in (Collection <CellDefinition>)row.Cells) { xmlTextWriter.WriteStartElement("td"); if (cell.ColSpan != 1) { xmlTextWriter.WriteAttributeString("colspan", cell.ColSpan.ToString()); } if (cell.RowSpan != 1) { xmlTextWriter.WriteAttributeString("rowspan", cell.RowSpan.ToString()); } if (cell.Border != -1) { xmlTextWriter.WriteAttributeString("border", cell.Border.ToString()); } xmlTextWriter.WriteAttributeString("width", cell.Width.ToString()); if (!flag && row.Height != 20) { flag = true; xmlTextWriter.WriteAttributeString("height", row.Height.ToString()); } if (cell.BackColor != Color.Empty) { xmlTextWriter.WriteAttributeString("bgcolor", "#" + ColorProvider.ColorToHex(cell.BackColor)); } xmlTextWriter.WriteString(cell.UniqueName); xmlTextWriter.WriteEndElement(); } xmlTextWriter.WriteEndElement(); } xmlTextWriter.WriteEndElement(); } }
private void colorDialog_ColorChanged(object sender, ColorChangedEventArgs args) { if (this.selectedHslColor.IsEmpty) { this.labelOldColor.BackColor = args.SelectedHslColor.RgbValue; } if (sender != this.professionalColorsControl) { this.professionalColorsControl.SetColorSilently(args.SelectedHslColor); } this.supressTextBoxColorChange = true; this.textBoxColor.Text = ColorProvider.ColorToHex(args.SelectedColor); this.supressTextBoxColorChange = false; this.SetSelectedColor(args.SelectedColor); if (this.ColorChanged == null) { return; } this.ColorChanged((object)this, args); }