Beispiel #1
0
        private void RefreshView()
        {
            if (myPageSettings != null)
            {
                for (int iCount = 0; iCount < cboPage.Items.Count; iCount++)
                {
                    PaperKind kind = (PaperKind)Enum.Parse(typeof(PaperKind), (string)cboPage.Items[iCount]);
                    if (myPageSettings.PaperKind == kind)
                    {
                        cboPage.SelectedIndex = iCount;
                        break;
                    }
                }

                this.txtLeftMargin.Value   = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.LeftMargin));
                this.txtTopMargin.Value    = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.TopMargin));
                this.txtRightMargin.Value  = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.RightMargin));
                this.txtBottomMargin.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.BottomMargin));
                this.rdoLandscape.Checked  = !myPageSettings.Landscape;
                this.rdoLandscape2.Checked = myPageSettings.Landscape;
            }
            if (cboPage.SelectedIndex >= 0)
            {
                setPagerSize((PaperKind)Enum.Parse(typeof(PaperKind), cboPage.Text));
            }
        }
Beispiel #2
0
        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 );
        }
Beispiel #3
0
        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();
            }
        }
Beispiel #4
0
        /// <summary>
        /// 设置Pagesize是否可用
        /// </summary>
        private void setPagerSize(PaperKind kind)
        {
            this.txtWidth.Enabled  = (kind == System.Drawing.Printing.PaperKind.Custom);
            this.txtHeight.Enabled = (kind == System.Drawing.Printing.PaperKind.Custom);
            if (kind == System.Drawing.Printing.PaperKind.Custom)
            {
                decimal width  = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.PaperWidth));
                decimal height = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(myPageSettings.PaperHeight));

                if (width < this.txtWidth.Minimum)
                {
                    this.txtWidth.Value = this.txtWidth.Minimum;
                }
                else
                {
                    this.txtWidth.Value = width;
                }

                if (height < this.txtHeight.Minimum)
                {
                    this.txtHeight.Value = this.txtHeight.Minimum;
                }
                else
                {
                    this.txtHeight.Value = height;
                }
            }
            else
            {
                Size size = XPageSettings.GetStandardPaperSize(kind);
                if (size.IsEmpty == false)
                {
                    this.txtWidth.Value  = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(size.Width));
                    this.txtHeight.Value = Convert.ToDecimal(MeasureConvert.HundredthsInchToMillimeter(size.Height));
                }
            }
        }