Exemplo n.º 1
0
        void cbxPages_SelectedIndexChanged(object sender, EventArgs e)
        {
            PrintPage page = CacheHelper.Instance.Pages[this.cbxPages.SelectedIndex];

            if (this.cbxPages.SelectedIndex != this.cbxPages.Items.Count - 1)
            {
                this.tbWidth.Text  = page.WidthString;
                this.tbHeight.Text = page.HeightString;

                this.tbHeight.Enabled = this.tbWidth.Enabled = false;
            }
            else
            {
                this.tbHeight.Enabled = this.tbWidth.Enabled = true;
                this.tbWidth.Text     = string.Empty;
                this.tbHeight.Text    = string.Empty;
            }
        }
Exemplo n.º 2
0
        private void InitValues()
        {
            XmlNode rNode = _Draw.GetReportNode();

            tbWidth.Text = _Draw.GetElementValue(rNode, "Width", "");

            tbReportAuthor.Text      = _Draw.GetElementValue(rNode, "Author", "");
            tbReportDescription.Text = _Draw.GetElementValue(rNode, "Description", "");

            tbPageWidth.Text  = _Draw.GetElementValue(rNode, "PageWidth", "8.5in");
            tbPageHeight.Text = _Draw.GetElementValue(rNode, "PageHeight", "11in");

            tbMarginLeft.Text   = _Draw.GetElementValue(rNode, "LeftMargin", "");
            tbMarginRight.Text  = _Draw.GetElementValue(rNode, "RightMargin", "");
            tbMarginBottom.Text = _Draw.GetElementValue(rNode, "BottomMargin", "");
            tbMarginTop.Text    = _Draw.GetElementValue(rNode, "TopMargin", "");

            // Page header settings
            XmlNode phNode = _Draw.GetCreateNamedChildNode(rNode, "PageHeader");

            this.chkPHFirst.Checked = _Draw.GetElementValue(phNode, "PrintOnFirstPage", "true").ToLower() == "true"? true: false;
            this.chkPHLast.Checked  = _Draw.GetElementValue(phNode, "PrintOnLastPage", "true").ToLower() == "true"? true: false;
            // Page footer settings
            XmlNode pfNode = _Draw.GetCreateNamedChildNode(rNode, "PageFooter");

            this.chkPFFirst.Checked = _Draw.GetElementValue(pfNode, "PrintOnFirstPage", "true").ToLower() == "true"? true: false;
            this.chkPFLast.Checked  = _Draw.GetElementValue(pfNode, "PrintOnLastPage", "true").ToLower() == "true"? true: false;

            string sW = _Draw.GetElementValue(rNode, "PageWidth", "8.5in");
            string sH = _Draw.GetElementValue(rNode, "PageHeight", "11in");

            int index = -1;
            int XY    = -1;

            for (int i = 0; i < CacheHelper.Instance.Pages.Length; i++)
            {
                PrintPage page = CacheHelper.Instance.Pages[i];

                if ((sW == page.WidthString) & (sH == page.HeightString))
                {
                    index = i;
                    XY    = 0;
                    break;
                }

                if ((sH == page.WidthString) & (sW == page.HeightString))
                {
                    index = i;
                    XY    = 1;
                    break;
                }
            }

            if (index > -1)
            {
                this.cbxPages.SelectedIndex = index;

                if (XY > -1)
                {
                    this.cbxXY.SelectedIndex = XY;
                    this.cbxXY.Enabled       = true;
                }
            }
            else
            {
                this.tbPageWidth.Text  = sW;
                this.tbPageHeight.Text = sH;

                this.cbxPages.SelectedIndex = CacheHelper.Instance.Pages.Length - 1;
                this.cbxXY.Enabled          = false;
            }
        }