private void paperSizeCombo_SelectedIndexChanged(object sender, EventArgs e) { PaperSize size = WbContext.get_paper_sizes()[paperSizeCombo.SelectedIndex]; paperSizeLabel.Text = size.description; if (size.margins_set) { topMarginText.Text = size.margin_top.ToString(); bottomMarginText.Text = size.margin_bottom.ToString(); leftMarginText.Text = size.margin_left.ToString(); rightMarginText.Text = size.margin_right.ToString(); } else { topMarginText.Text = TopMargin.ToString(); bottomMarginText.Text = BottomMargin.ToString(); leftMarginText.Text = LeftMargin.ToString(); rightMarginText.Text = RightMargin.ToString(); } }
/// <summary> /// 序列化xml /// </summary> /// <param name="p_writer"></param> public void WriteXml(XmlWriter p_writer) { p_writer.WriteStartElement("Page"); // 不保存纸张名称 //string val = Data.Str("papername"); //if (val != "IsoA4") // p_writer.WriteAttributeString("papername", val); if (Height != _defaultHeight) { p_writer.WriteAttributeString("height", Height.ToString()); } if (Width != _defaultWidth) { p_writer.WriteAttributeString("width", Width.ToString()); } if (LeftMargin != _defaultMargin) { p_writer.WriteAttributeString("leftmargin", LeftMargin.ToString()); } if (TopMargin != _defaultMargin) { p_writer.WriteAttributeString("topmargin", TopMargin.ToString()); } if (RightMargin != _defaultMargin) { p_writer.WriteAttributeString("rightmargin", RightMargin.ToString()); } if (BottomMargin != _defaultMargin) { p_writer.WriteAttributeString("bottommargin", BottomMargin.ToString()); } if (Landscape) { p_writer.WriteAttributeString("landscape", "True"); } p_writer.WriteEndElement(); }