Exemple #1
0
        public ArticleButton(Article art)
        {
            ArticleButtonDesign design = null;
            string designdef = DatabaseHandler.GetArticleButtonDesignXml(art);
            if (designdef == "")
                design = ArticleButtonDesign.GetDefaultDesign();
            else
            {                
                design = new ArticleButtonDesign();
                XmlReader reader = XmlReader.Create(new StringReader(designdef));
                design.ReadXml(reader);
            }


            this.BackColor = design.BackColor;
            this.ForeColor = design.ForeColor;
            this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.FlatAppearance.BorderSize = 0;
            this.FlatAppearance.BorderColor = Color.Black;
            this.Size = new Size(120, 30);

            this.Location = CalculateArticleLocation(art.Position);

            if (!art.IsEnabled)
            {
                this.Enabled = false;
                this.Font = new Font(this.Font, FontStyle.Strikeout);
                this.BackColor = Color.FromArgb(234, 234, 234);
            }
            if (!art.IsVisible) this.Visible = false;
            if (!art.DoPrint) this.Font = new Font(this.Font, FontStyle.Italic);

            this.Text = art.Name;
        }
Exemple #2
0
        public string DesignToXml()
        {
            ArticleButtonDesign des = new ArticleButtonDesign() { ForeColor = this.ForeColor, BackColor = this.BackColor };

            using (var sw = new StringWriter())
            {
                using (var xw = XmlWriter.Create(sw))
                {
                    des.WriteXml(xw);
                }
                return sw.ToString();
            }
        }