示例#1
0
        public void btnOK_Click(object sender, EventArgs e)
        {
            // content:
            if (rdoTextRatioSet.Checked)
            {
                m_Button.TextRatio = sldTextRatio.Value / 100f;
            }
            else
            {
                m_Button.TextRatio = -1;
            }
            m_Button.LabelText = txtText.Text;
            if (m_ImageChanged)
            {
                m_Button.SetImage(m_NewImage);
            }
            ButtonShape.Layouts layout = (ButtonShape.Layouts)pnlLayout.SelectedIndex;
            if (chkSuperimpose.Checked)
            {
                layout = layout | ButtonShape.Layouts.Superimpose;
            }
            m_Button.Layout = layout;

            // Style:
            m_Button.SetStyleObject(m_Style);
            m_LastUsedStyle    = m_Style;
            m_LastUsedDocument = Globals.Root.CurrentDocument;

            // Actions:
            m_Button.DisplayFromAction = chkDisplayFromAction.Checked;
            m_Button.Action            = m_Action;

            this.DialogResult = DialogResult.OK;
        }
示例#2
0
        private void DrawLayoutPanel(object sender, PaintEventArgs e)
        {
            Panel pnl = (Panel)sender;

            ButtonShape.Layouts layout = (ButtonShape.Layouts)Convert.ToInt32(pnl.Tag);
            //If eLayout = pnlLayout.SelectedIndex Then e.Graphics.Clear(Color.Orange)
            if (chkSuperimpose.Checked)
            {
                layout = layout | ButtonShape.Layouts.Superimpose;
            }
            m_LayoutButton.Layout = layout;
            //e.Graphics.PageUnit = GraphicsUnit.Millimeter
            float X = pnl.Width - 1;             // / e.Graphics.DpiX) * INCH  ' pnl size in mm
            float Y = pnl.Height - 1;            // / e.Graphics.DpiY) * INCH

            e.Graphics.ScaleTransform(X / m_LayoutButton.Bounds.Width, Y / m_LayoutButton.Bounds.Height);
            //e.Graphics.ScaleTransform(INCH / e.Graphics.DpiX, INCH / e.Graphics.DpiY)
            m_LayoutButton.Draw(new NetCanvas(e.Graphics), 1, e.Graphics.DpiX / Geometry.INCH, null, StaticView.InvalidationBuffer.Base);
            e.Graphics.ResetTransform();
            e.Graphics.PageUnit = GraphicsUnit.Pixel;
        }