コード例 #1
0
        private void ToEditLabelExOutSide(string CommandName, IControlExProperties ctrl)
        {
            UsCtrlExInfors exInfor = null;

            if (ctrl.GetLayerType() == ScreenShotCutLib.Enums.EnLayerType.Label)
            {
                var lblEx = ctrl as LabelEx;
                exInfor = lblEx?.Tag as UsCtrlExInfors;
            }
            RunCommand?.Invoke(CommandName, exInfor);
        }
コード例 #2
0
        private Image ConvertToImage(IControlExProperties ctrl)
        {
            Image rValue = null;

            if (ctrl.GetLayerType() == ScreenShotCutLib.Enums.EnLayerType.Label)
            {
                var lblEx    = ctrl as LabelEx;
                var oriInfor = lblEx.GetControlExInfors() as UsLabelExInfors;
                //取未被缩放时的大小生成图片,避免取大小值时出现闪烁,先进行隐藏
                lblEx.Visible = false;
                lblEx.Font    = new Font(oriInfor.LblParams.Font.FontFamily, oriInfor.LblParams.Font.Size, oriInfor.LblParams.Font.Style);
                rValue        = new Bitmap(lblEx.Width, lblEx.Height);
                Graphics g = Graphics.FromImage(rValue);
                g.FillRectangle(new SolidBrush(lblEx.BackColor), 0, 0, rValue.Width, rValue.Height);
                g.DrawString(lblEx.Text, lblEx.Font, new SolidBrush(lblEx.ForeColor), new Point(0, 0));
                g.Flush();
            }
            return(rValue);
        }