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
        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);
            }
        }
Beispiel #3
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 #4
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 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private bool RefreshPageSettings()
        {
            if (myPageSettings != null)
            {
                myPageSettings.PaperKind = ( PaperKind )Enum.Parse(typeof(PaperKind), cboPage.Text);
                if (myPageSettings.PaperKind == PaperKind.Custom)
                {
                    myPageSettings.PaperWidth  = (int)(MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtWidth.Value)));
                    myPageSettings.PaperHeight = (int)(MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtHeight.Value)));
                }

                myPageSettings.LeftMargin   = (int)MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtLeftMargin.Value));
                myPageSettings.TopMargin    = (int)MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtTopMargin.Value));
                myPageSettings.RightMargin  = (int)MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtRightMargin.Value));
                myPageSettings.BottomMargin = (int)MeasureConvert.MillimeterToHundredthsInch(Convert.ToDouble(this.txtBottomMargin.Value));
                myPageSettings.Landscape    = this.rdoLandscape2.Checked;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
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));
                }
            }
        }