示例#1
0
        private void button_Properties_Click(object sender, EventArgs e)
        {
            using (ElementPropsWin epropWin = new ElementPropsWin())
            {
                using (Font font = new Font(Element.FontName, Element.FontSize, Element.FontStyle))
                {
                    epropWin.Title             = Element.Title;
                    epropWin.DefaultText       = Element.Text;
                    epropWin.ElemArea          = Element.Area;
                    epropWin.Rotation          = Element.Rotation;
                    epropWin.FontName          = font.Name;
                    epropWin.FontSize          = font.Size;
                    epropWin.FontStyle         = font.Style;
                    epropWin.ForecolorFromArgb = Element.Forecolor;
                }

                if (epropWin.ShowDialog() == DialogResult.OK)
                {
                    Element.Title     = epropWin.Title;
                    Element.Text      = epropWin.DefaultText;
                    Element.Area      = epropWin.ElemArea;
                    Element.Rotation  = epropWin.Rotation;
                    Element.FontName  = epropWin.FontName;
                    Element.FontSize  = epropWin.FontSize;
                    Element.FontStyle = epropWin.FontStyle;
                    Element.Forecolor = epropWin.ForecolorFromArgb;

                    if (OnChanged != null)
                    {
                        OnChanged(this, EventArgs.Empty);
                    }
                }
            }
        }
示例#2
0
        private void button_AddNewElement_Click(object sender, EventArgs e)
        {
            BarcodeLabelElement elem = new BarcodeLabelElement();

            using (ElementPropsWin epropWin = new ElementPropsWin())
            {
                using (Font font = new Font(elem.FontName, elem.FontSize, elem.FontStyle))
                {
                    epropWin.Title             = elem.Title;
                    epropWin.DefaultText       = elem.Text;
                    epropWin.ElemArea          = elem.Area;
                    epropWin.Rotation          = elem.Rotation;
                    epropWin.FontName          = font.Name;
                    epropWin.FontSize          = font.Size;
                    epropWin.FontStyle         = font.Style;
                    epropWin.ForecolorFromArgb = elem.Forecolor;
                }

                if (epropWin.ShowDialog() == DialogResult.OK)
                {
                    elem.Title     = epropWin.Title;
                    elem.Text      = epropWin.DefaultText;
                    elem.Area      = epropWin.ElemArea;
                    elem.Rotation  = epropWin.Rotation;
                    elem.FontName  = epropWin.FontName;
                    elem.FontSize  = epropWin.FontSize;
                    elem.FontStyle = epropWin.FontStyle;
                    elem.Forecolor = epropWin.ForecolorFromArgb;

                    Label.Elements.Add(elem);

                    AddElementCtrls();

                    txt_JSON.Text = JsonHelper.FormatJson(_label.ToJSON());

                    if (OnChanged != null)
                    {
                        OnChanged(this, EventArgs.Empty);
                    }
                }
            }
        }