private bool RefreshPageSettings() { if (myPageSettings != null) { XPaperSize Size = this.cboPage.SelectedItem as XPaperSize; if (Size != null) { myPageSettings.PaperSize = Size; } if (Size == null || myPageSettings.PaperSize.Kind == System.Drawing.Printing.PaperKind.Custom) { int vWidth = (int)(MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtWidth.Value))); int vHeight = (int)(MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtHeight.Value))); myPageSettings.PaperSize = new XPaperSize(System.Drawing.Printing.PaperKind.Custom, vWidth, vHeight); } myPageSettings.Margins.Left = (int)MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtLeftMargin.Value)); myPageSettings.Margins.Top = (int)MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtTopMargin.Value)); myPageSettings.Margins.Right = (int)MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtRightMargin.Value)); myPageSettings.Margins.Bottom = (int)MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtBottomMargin.Value)); myPageSettings.Landscape = this.rdoLandscape2.Checked; return(true); } else { return(false); } }
public void dlgPageSetup_Load(object sender, System.EventArgs e) { this.cboPage.Items.Clear(); this.cboPage.Items.AddRange(XPaperSizeCollection.StdInstance.ToArray()); if (myPageSettings != null) { for (int iCount = 0; iCount < cboPage.Items.Count; iCount++) { XPaperSize p = (XPaperSize)cboPage.Items[iCount]; if (p.Kind == myPageSettings.PaperSize.Kind) { cboPage.SelectedIndex = iCount; break; } } this.txtWidth.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.PaperSize.Width)); this.txtHeight.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.PaperSize.Height)); this.txtLeftMargin.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.Margins.Left)); this.txtTopMargin.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.Margins.Top)); this.txtRightMargin.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.Margins.Right)); this.txtBottomMargin.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.Margins.Bottom)); this.rdoLandscape.Checked = !myPageSettings.Landscape; this.rdoLandscape2.Checked = myPageSettings.Landscape; } //this.cboPage.Items.AddRange( mySetting.PaperSizes ); }
private void cboPage_SelectedIndexChanged(object sender, System.EventArgs e) { XPaperSize mySize = this.cboPage.SelectedItem as XPaperSize; if (mySize != null) { this.txtWidth.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(mySize.Width)); this.txtHeight.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(mySize.Height)); //this.txtWidth.ReadOnly = !( mySize.Kind == System.Drawing.Printing.PaperKind.Custom ); //this.txtHeight.ReadOnly = !( mySize.Kind == System.Drawing.Printing.PaperKind.Custom ) ; this.txtWidth.Enabled = (mySize.Kind == System.Drawing.Printing.PaperKind.Custom); this.txtHeight.Enabled = (mySize.Kind == System.Drawing.Printing.PaperKind.Custom); this.picPreview.Invalidate(); } }