Ejemplo n.º 1
0
        public void BeginEditLabel(UsLabelExInfors usLabelExInfors)
        {
            UlblExInfors = usLabelExInfors;
            this.tabTools.SelectTab("tpText");
            #region set value to the pannel

            txtInput.Text = UlblExInfors.LblParams.Messages;
            var slitm = cbbFontList.Items.OfType <FontListModel>().ToList()
                        .FindIndex(x => x.name.Equals(UlblExInfors.LblParams.Font.Name));
            cbbFontList.SelectedIndex = slitm;
            txtFontSize.Text          = UlblExInfors.LblParams.Font.Size.ToString();

            cbkBold.Checked      = UlblExInfors.LblParams.Font.Bold;
            cbkItalic.Checked    = UlblExInfors.LblParams.Font.Italic;
            cbkStrkeOut.Checked  = UlblExInfors.LblParams.Font.Strikeout;
            cbkUnderLine.Checked = UlblExInfors.LblParams.Font.Underline;

            btnPickColor.BackColor = UlblExInfors.LblParams.ForeColor;
            cbkBgColor.Checked     = !(UlblExInfors.LblParams.BackColor == Color.Transparent);
            btnBgColor.BackColor   = cbkBgColor.Checked ? UlblExInfors.LblParams.BackColor : btnBgColor.BackColor;

            #endregion
            ToShow();
            btnDemo.PerformClick();
        }
Ejemplo n.º 2
0
        private void btnAddToShow_Click(object sender, EventArgs e)
        {
            LblModelParams lmp = new LblModelParams();

            float fsize;
            var   font = cbbFontList.SelectedValue as FontFamily;

            if (font != null && !string.IsNullOrEmpty(txtInput.Text.Trim()))
            {
                lmp.Messages = txtInput.Text;
                if (!float.TryParse(txtFontSize.Text, out fsize))
                {
                    fsize = lblShowSample.Font.Size;
                }
                lmp.Font      = new Font(font, fsize, GetFontStype());
                lmp.ForeColor = btnPickColor.BackColor;
                lmp.BackColor = cbkBgColor.Checked ? btnBgColor.BackColor : Color.Transparent;
                if (WritePainter != null)
                {
                    UsLabelExInfors uli;
                    if (UlblExInfors != null)
                    {
                        uli = new UsLabelExInfors {
                            ControlName = UlblExInfors.ControlName,
                            ControlText = UlblExInfors.ControlText,
                        };
                    }
                    else
                    {
                        uli = new UsLabelExInfors();
                    }
                    uli.LayerType = ScreenShotCutLib.Enums.EnLayerType.Label;
                    UlblExInfors  = null;
                    uli.LblParams = lmp;
                    ToHidden();
                    //*******************************************------------------*/
                    WritePainter?.Invoke(uli, (string.IsNullOrEmpty(uli.ControlName?.Trim()) ? CallBack : default(CallBackFunc)));
                }
            }
            else
            {
                #region Error Messages
                string message = "";
                if (font == null)
                {
                    message += "The Selected Font does not exist.";
                }
                if (string.IsNullOrEmpty(txtInput.Text.Trim()))
                {
                    message += "No Information to show.";
                }
                if (string.IsNullOrEmpty(message))
                {
                    message = "Errors!";
                }
                MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Question);
                #endregion
            }
        }
Ejemplo n.º 3
0
        public void AddMessagesLable(UsLabelExInfors lblExInfor)
        {
            var    lmParams = lblExInfor.LblParams;
            string ctrlKey  = lblExInfor.ControlName?.Trim();

            if (string.IsNullOrEmpty(ctrlKey) || !Controls.ContainsKey(ctrlKey))
            {
                var     guid          = Guid.NewGuid();
                LabelEx lblExMessages = new LabelEx();
                lblExMessages.Name             = guid.ToString();
                lblExMessages.AutoSize         = true;
                lblExMessages.UseMnemonic      = false;
                lblExMessages.Text             = lmParams.Messages;
                lblExMessages.Parent           = this;
                lblExMessages.Location         = lmParams.Location;
                lblExMessages.Font             = new Font(lmParams.Font.FontFamily, lmParams.Font.Size * PicsScale, lmParams.Font.Style); //lmParams.Font;
                lblExMessages.ForeColor        = lmParams.ForeColor;
                lblExMessages.BackColor        = lmParams.BackColor;
                lblExInfor.ControlName         = lblExMessages.Name;
                lblExMessages.Tag              = lblExInfor;
                lblExMessages.ContextMenuStrip = lblMenu;// mnChildSelectionAction;

                lblExMessages.MouseDown += new MouseEventHandler(Conotrl_MouseDown);
                lblExMessages.MouseMove += new MouseEventHandler(Conotrl_MouseMove);
                lblExMessages.MouseUp   += new MouseEventHandler(Conotrl_MouseUp);

                this.Controls.Add(lblExMessages);
                this.Controls.SetChildIndex(lblExMessages, 0);
            }
            else
            {
                var lblExMessages = Controls[ctrlKey] as LabelEx;
                if (lblExMessages != null)
                {
                    lblExMessages.Text      = lmParams.Messages;
                    lblExMessages.Font      = new Font(lmParams.Font.FontFamily, lmParams.Font.Size * PicsScale, lmParams.Font.Style);
                    lblExMessages.ForeColor = lmParams.ForeColor;
                    lblExMessages.BackColor = lmParams.BackColor;
                    lblExMessages.Tag       = lblExInfor;
                }
            }
        }
Ejemplo n.º 4
0
 private void EditLabelMessage(UsLabelExInfors usLabelExInfors)
 {
     tpnl.BeginEditLabel(usLabelExInfors);
 }