示例#1
0
        private void bColor_Click(object sender, System.EventArgs e)
        {
            ColorDialog cd = new ColorDialog();

            cd.AnyColor = true;
            cd.FullOpen = true;

            cd.CustomColors = ReportDesigner.GetCustomColors();
            cd.Color        =
                DesignerUtility.ColorFromHtml(cbColor.Text, System.Drawing.Color.Black);
            try
            {
                if (cd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                ReportDesigner.SetCustomColors(cd.CustomColors);
                if (sender == this.bColor)
                {
                    cbColor.Text = ColorTranslator.ToHtml(cd.Color);
                }
            }
            finally
            {
                cd.Dispose();
            }
            return;
        }
示例#2
0
        private void bColor_Click(object sender, System.EventArgs e)
        {
            using (ColorDialog cd = new ColorDialog())
            {
                cd.AnyColor     = true;
                cd.FullOpen     = true;
                cd.CustomColors = ReportDesigner.GetCustomColors();

                if (cd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                ReportDesigner.SetCustomColors(cd.CustomColors);
                if (sender == this.bEndColor)
                {
                    cbEndColor.Text = ColorTranslator.ToHtml(cd.Color);
                }
                else if (sender == this.bBackColor)
                {
                    cbBackColor.Text = ColorTranslator.ToHtml(cd.Color);
                }
            }
            return;
        }
        private void SetColor(ComboBox cbColor)
        {
            ColorDialog cd = new ColorDialog();

            cd.AnyColor = true;
            cd.FullOpen = true;

            cd.CustomColors = ReportDesigner.GetCustomColors();
            cd.Color        = DesignerUtility.ColorFromHtml(cbColor.Text, System.Drawing.Color.Empty);

            try
            {
                if (cd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                ReportDesigner.SetCustomColors(cd.CustomColors);
                cbColor.Text = ColorTranslator.ToHtml(cd.Color);
            }
            finally
            {
                cd.Dispose();
            }

            return;
        }