Пример #1
0
        private void InitValues(XmlNode node)
        {
            cbEndColor.Items.AddRange(StaticLists.ColorList);
            cbBackColor.Items.AddRange(StaticLists.ColorList);
            cbGradient.Items.AddRange(StaticLists.GradientList);

            if (_names != null)
            {
                node = _Draw.FindCreateNextInHierarchy(node, _names);
            }

            XmlNode sNode = _Draw.GetNamedChildNode(node, "Style");

            this.cbBackColor.Text = _Draw.GetElementValue(sNode, "BackgroundColor", "");
            this.cbEndColor.Text  = _Draw.GetElementValue(sNode, "BackgroundGradientEndColor", "");
            this.cbGradient.Text  = _Draw.GetElementValue(sNode, "BackgroundGradientType", "None");
            if (node.Name != "Chart")
            {               // only chart support gradients
                this.cbEndColor.Enabled        = bExprEndColor.Enabled =
                    cbGradient.Enabled         = bGradient.Enabled =
                        this.bEndColor.Enabled = bExprEndColor.Enabled = false;
            }

            cbValueEmbedded.Items.AddRange(_Draw.ReportNames.EmbeddedImageNames);
            string[] flds = _Draw.GetReportItemDataRegionFields(node, true);
            if (flds != null)
            {
                this.cbValueDatabase.Items.AddRange(flds);
            }

            XmlNode iNode = _Draw.GetNamedChildNode(sNode, "BackgroundImage");

            if (iNode != null)
            {
                string source = _Draw.GetElementValue(iNode, "Source", "Embedded");
                string val    = _Draw.GetElementValue(iNode, "Value", "");
                switch (source)
                {
                case "Embedded":
                    this.rbEmbedded.Checked   = true;
                    this.cbValueEmbedded.Text = val;
                    break;

                case "Database":
                    this.rbDatabase.Checked   = true;
                    this.cbValueDatabase.Text = val;
                    this.cbMIMEType.Text      = _Draw.GetElementValue(iNode, "MIMEType", "image/png");
                    break;

                case "External":
                default:
                    this.rbExternal.Checked   = true;
                    this.tbValueExternal.Text = val;
                    break;
                }
                this.cbRepeat.Text = _Draw.GetElementValue(iNode, "BackgroundRepeat", "Repeat");
            }
            else
            {
                this.rbNone.Checked = true;
            }

            rbSource_CheckedChanged(null, null);

            // nothing has changed now
            fEndColor = fBackColor = fGradient = fBackImage = false;
        }
Пример #2
0
        private void InitTextStyles()
        {
            cbColor.Items.AddRange(StaticLists.ColorList);
            cbFormat.Items.AddRange(StaticLists.FormatList);

            XmlNode sNode = _ReportItems[0];

            if (_names != null)
            {
                sNode = _Draw.FindCreateNextInHierarchy(sNode, _names);
            }

            sNode = _Draw.GetCreateNamedChildNode(sNode, "Style");

            string sFontStyle      = "Normal";
            string sFontFamily     = "Arial";
            string sFontWeight     = "Normal";
            string sFontSize       = "10pt";
            string sTextDecoration = "None";
            string sHorzAlign      = "General";
            string sVerticalAlign  = "Top";
            string sColor          = "Black";
            string sFormat         = "";
            string sDirection      = "LTR";
            string sWritingMode    = "lr-tb";

            foreach (XmlNode lNode in sNode)
            {
                if (lNode.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (lNode.Name)
                {
                case "FontStyle":
                    sFontStyle = lNode.InnerText;
                    break;

                case "FontFamily":
                    sFontFamily = lNode.InnerText;
                    break;

                case "FontWeight":
                    sFontWeight = lNode.InnerText;
                    break;

                case "FontSize":
                    sFontSize = lNode.InnerText;
                    break;

                case "TextDecoration":
                    sTextDecoration = lNode.InnerText;
                    break;

                case "TextAlign":
                    sHorzAlign = lNode.InnerText;
                    break;

                case "VerticalAlign":
                    sVerticalAlign = lNode.InnerText;
                    break;

                case "Color":
                    sColor = lNode.InnerText;
                    break;

                case "Format":
                    sFormat = lNode.InnerText;
                    break;

                case "Direction":
                    sDirection = lNode.InnerText;
                    break;

                case "WritingMode":
                    sWritingMode = lNode.InnerText;
                    break;
                }
            }

            // Population Font Family dropdown
            foreach (FontFamily ff in FontFamily.Families)
            {
                cbFontFamily.Items.Add(ff.Name);
            }

            this.cbFontStyle.Text      = sFontStyle;
            this.cbFontFamily.Text     = sFontFamily;
            this.cbFontWeight.Text     = sFontWeight;
            this.cbFontSize.Text       = sFontSize;
            this.cbTextDecoration.Text = sTextDecoration;
            this.cbHorzAlign.Text      = sHorzAlign;
            this.cbVerticalAlign.Text  = sVerticalAlign;
            this.cbColor.Text          = sColor;
            this.cbFormat.Text         = sFormat;
            this.cbDirection.Text      = sDirection;
            this.cbWritingMode.Text    = sWritingMode;

            fHorzAlign = fFormat = fDirection = fWritingMode = fTextDecoration =
                fColor = fVerticalAlign = fFontStyle = fFontWeight = fFontSize = fFontFamily = false;

            return;
        }
        private void InitBorders(XmlNode node)
        {
            cbColorDefault.Items.AddRange(StaticLists.ColorList);
            cbColorLeft.Items.AddRange(StaticLists.ColorList);
            cbColorRight.Items.AddRange(StaticLists.ColorList);
            cbColorTop.Items.AddRange(StaticLists.ColorList);
            cbColorBottom.Items.AddRange(StaticLists.ColorList);

            if (_names != null)
            {
                node = _Draw.FindCreateNextInHierarchy(node, _names);
            }

            XmlNode sNode = _Draw.GetCreateNamedChildNode(node, "Style");

            // Handle BorderStyle
            XmlNode bsNode = _Draw.SetElement(sNode, "BorderStyle", null);

            cbStyleDefault.Text = _Draw.GetElementValue(bsNode, "Default", "None");
            cbStyleLeft.Text    = _Draw.GetElementValue(bsNode, "Left", cbStyleDefault.Text);
            cbStyleRight.Text   = _Draw.GetElementValue(bsNode, "Right", cbStyleDefault.Text);
            cbStyleTop.Text     = _Draw.GetElementValue(bsNode, "Top", cbStyleDefault.Text);
            cbStyleBottom.Text  = _Draw.GetElementValue(bsNode, "Bottom", cbStyleDefault.Text);

            // Handle BorderColor
            XmlNode bcNode = _Draw.SetElement(sNode, "BorderColor", null);

            cbColorDefault.Text = _Draw.GetElementValue(bcNode, "Default", "Black");
            cbColorLeft.Text    = _Draw.GetElementValue(bcNode, "Left", cbColorDefault.Text);
            cbColorRight.Text   = _Draw.GetElementValue(bcNode, "Right", cbColorDefault.Text);
            cbColorTop.Text     = _Draw.GetElementValue(bcNode, "Top", cbColorDefault.Text);
            cbColorBottom.Text  = _Draw.GetElementValue(bcNode, "Bottom", cbColorDefault.Text);

            // Handle BorderWidth
            XmlNode bwNode = _Draw.SetElement(sNode, "BorderWidth", null);

            tbWidthDefault.Text = _Draw.GetElementValue(bwNode, "Default", "1pt");
            tbWidthLeft.Text    = _Draw.GetElementValue(bwNode, "Left", tbWidthDefault.Text);
            tbWidthRight.Text   = _Draw.GetElementValue(bwNode, "Right", tbWidthDefault.Text);
            tbWidthTop.Text     = _Draw.GetElementValue(bwNode, "Top", tbWidthDefault.Text);
            tbWidthBottom.Text  = _Draw.GetElementValue(bwNode, "Bottom", tbWidthDefault.Text);

            if (node.Name == "Line")
            {
                cbColorLeft.Visible                                                                                 =
                    cbColorRight.Visible                                                                            =
                        cbColorTop.Visible                                                                          =
                            cbColorBottom.Visible                                                                   =
                                bColorLeft.Visible                                                                  =
                                    bColorRight.Visible                                                             =
                                        bColorTop.Visible                                                           =
                                            bColorBottom.Visible                                                    =
                                                cbStyleLeft.Visible                                                 =
                                                    cbStyleRight.Visible                                            =
                                                        cbStyleTop.Visible                                          =
                                                            cbStyleBottom.Visible                                   =
                                                                lLeft.Visible                                       =
                                                                    lRight.Visible                                  =
                                                                        lTop.Visible                                =
                                                                            lBottom.Visible                         =
                                                                                tbWidthLeft.Visible                 =
                                                                                    tbWidthRight.Visible            =
                                                                                        tbWidthTop.Visible          =
                                                                                            tbWidthBottom.Visible   =
                                                                                                bCR.Visible         = bCL.Visible = bCT.Visible = bCB.Visible =
                                                                                                    bSR.Visible     = bSL.Visible = bST.Visible = bSB.Visible =
                                                                                                        bWR.Visible = bWL.Visible = bWT.Visible = bWB.Visible =
                                                                                                            false;
            }
            fStyleDefault         = fStyleLeft = fStyleRight = fStyleTop = fStyleBottom =
                fColorDefault     = fColorLeft = fColorRight = fColorTop = fColorBottom =
                    fWidthDefault = fWidthLeft = fWidthRight = fWidthTop = fWidthBottom = false;
        }