private void 信息框ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var l = new InfoSetting()
            {
                W         = 100,
                H         = 100,
                X         = (int)(canvas.ScaleWidth * 0.5 - 50),
                Y         = (int)(canvas.ScaleHeight * 0.5 - 50),
                TargetCol = "在此处填写Excel中对应的列名"
            };
            var c = new Element(l)
            {
                OnCtlSelected = (ctl, mutiSelect) => {
                    if (ctl != null)
                    {
                        selectedCtl.Add(ctl);
                        ctl.Selected = true;
                    }
                }
            };

            canvas.List.Add(c);
            l.OnSettingModify = (setting) => {
                c.RefreshAnySetting();
                c.MoveConfirm();
                canvasNeedRefresh = true;
            };

            list.New(l);
            canvasNeedRefresh = true;
        }
        private void  制信息框ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (var item in selectedCtl)
            {
                var l = new InfoSetting()
                {
                    AutoNewLine = item.Setting.AutoNewLine,
                    FontName    = item.Setting.FontName,
                    FontSize    = item.Setting.FontSize,
                    TagName     = item.Setting.TagName,
                    ForeColor   = item.Setting.ForeColor,
                    H           = item.Setting.H,
                    W           = item.Setting.W,
                    X           = item.Setting.X,
                    Y           = item.Setting.Y,
                    TargetCol   = item.Setting.TargetCol,
                    TextAlign   = item.Setting.TextAlign
                };
                var c = new Element(l)
                {
                    OnCtlSelected = (ctl, mutiSelect) => {
                        if (ctl != null)
                        {
                            selectedCtl.Add(ctl);
                            ctl.Selected = true;
                        }
                    },
                };
                c.MoveConfirm();
                canvas.List.Add(c);
                l.OnSettingModify = (setting) => {
                    c.RefreshAnySetting();
                    canvasNeedRefresh = true;
                };
                list.New(l, false);

                var info = new InfoShower()
                {
                    Title      = "复制对象",
                    Info       = item.Text,
                    TitleColor = Color.FromArgb(255, 50, 200, 50),
                    ExistTime  = 5000,
                };
                InfoShower.ShowOnce(info);
            }
            canvasNeedRefresh = true;
        }
Ejemplo n.º 3
0
 public InfoControl(InfoSetting setting)
 {
     this.setting            = setting;
     setting.OnSettingModify = () =>
     {
         this.Invoke((EventHandler) delegate {
             RefreshLayout();
             Text = setting.TagName == "" ? setting.TargetCol : setting.TagName;
             Font = new System.Drawing.Font(setting.FontName, setting.FontSize);
             this.Invalidate();
         });
     };
     setting.OnOutputModle = (x) =>
     {
         OnOutputModle = x;
         this.Invalidate();
     };
     setting.AbortSetting = () =>
     {
         this.Dispose();
     };
     RefreshLayout();
 }
Ejemplo n.º 4
0
 public void New(InfoSetting l, bool modify = true)
 {
     l.SettingModify(modify);
     List.Add(l);
 }
        public InfoInput(InfoSetting setting, Action SubmitCallBack)
        {
            this.callBack = SubmitCallBack;
            InitializeComponent();

            this.setting                = setting;
            this.IpPosX.Text            = setting.X.ToString();
            this.IpPosY.Text            = setting.Y.ToString();
            this.IpPosW.Text            = setting.W.ToString();
            this.IpPosH.Text            = setting.H.ToString();
            this.IpBindingCol.Text      = setting.TargetCol;
            this.IpTagName.Text         = setting.TagName;
            this.CmdAutoNewLine.Checked = setting.AutoNewLine;
            foreach (var ctl in GrpAlign.Controls)
            {
                if (ctl is Button cmd)
                {
                    if (cmd.Name.Substring(8) == setting.TextAlign)
                    {
                        cmd.Enabled = false;
                        break;
                    }
                }
            }
            fontSet.Font          = new Font(setting.FontName, setting.FontSize);
            fontSet.Color         = setting.ForeColor;
            CtlShowTextRenderDemo = new Label()
            {
                Parent    = this,
                Left      = 0,
                Top       = (int)(this.Height * 0.55),
                Width     = this.Width,
                Height    = (int)(this.Height * 0.45),
                Text      = "文字ABC123",
                ForeColor = fontSet.Color,
                Font      = fontSet.Font,
                Visible   = true
            };
            CtlShowTextRenderDemo.MouseClick += CmdFontSet;
            foreach (var ctl in GrpAlign.Controls)
            {
                if (ctl is Button cmd)
                {
                    if (cmd.Name.Contains("CmdAlign"))
                    {
                        cmd.Click += (x, xx) =>
                        {
                            ResetCmdAlign();
                            setting.TextAlign = cmd.Name.Substring(8);
                            cmd.Enabled       = false;
                        };
                    }
                }
            }
            this.Deactivate += (xx, xxx) => { if (!OnSelectSetting)
                                              {
                                                  this.Close();
                                              }
            };
            rectDescription = new Rectangle((int)(Width * 0.02), (int)(Height * 0.45), (int)(Width * 0.96), (int)(Height * 0.28));
        }