Exemple #1
0
        //────────────────────────────────────────

        private void UsercontrolCheckbox_MouseEnter(object sender, EventArgs e)
        {
            // マウスが領域に入ってきたら、
            // コントロールを可視化。
            UsercontrolCheckbox ucChk = (UsercontrolCheckbox)sender;

            Point p1       = this.PointToClient(System.Windows.Forms.Cursor.Position);
            bool  bRefresh = false;



            // コントロールをまだマウスカーソルで指していない時。
            if (this.memoryButton1.Bounds.Contains(p1) && !this.memoryButton1.BMousePointed)
            {
                this.memoryButton1.ForeBrush = new SolidBrush(Color.Green);
                this.memoryButton1.BackBrush = new SolidBrush(Color.YellowGreen);

                // コントロールを絵で描く。
                bRefresh = true;
            }


            if (bRefresh)
            {
                this.Refresh();
            }
        }
        //────────────────────────────────────────
        public Usercontrol Perform(
            Expression_Node_StringImpl ec_FcName,
            MemoryApplication owner_MemoryApplication
            )
        {
            UsercontrolCheckbox uctChk = new UsercontrolCheckbox();

            // 名前だけ初期設定
            uctChk.ControlCommon.Expression_Name_Control = ec_FcName;
            uctChk.ControlCommon.Owner_MemoryApplication = owner_MemoryApplication;

            return uctChk;
        }
Exemple #3
0
        //────────────────────────────────────────

        private void UsercontrolCheckbox_Paint(object sender, PaintEventArgs e)
        {
            UsercontrolCheckbox ucChk = (UsercontrolCheckbox)sender;

            //枠線の太さは1px。
            //    2px
            //   ┌─┬────┐
            // 2px │ │ 影2 │
            //   │ ├────┤
            //   │影│    │
            //   │1│    │
            //   │ │    │
            //   │ │    │
            //   └─┴────┘
            //


            // 背景色、前景色。
            Pen   shapePen1;
            Brush shapeBursh1;
            Brush fontBrush1;

            if (!ucChk.customcontrolCheckbox1.Enabled)
            {
                // 編集不可能。

                e.Graphics.FillRectangle(Brushes.LightGray, this.memoryButton1.Bounds);

                // 前景色。
                shapePen1   = Pens.Gray;
                shapeBursh1 = Brushes.Black;
                fontBrush1  = Brushes.Gray;
            }
            else
            {
                // 編集可能。

                // 背景色。
                e.Graphics.FillRectangle(ucChk.memoryButton1.BackBrush, this.memoryButton1.Bounds);
                //e.Graphics.FillRectangle(Brushes.White, this.moBtn.Bounds);

                // 前景色。
                shapePen1   = Pens.Black;
                shapeBursh1 = Brushes.Black;
                fontBrush1  = new SolidBrush(this.customcontrolCheckbox1.ForeColor);
            }

            // 枠線
            e.Graphics.DrawRectangle(shapePen1, this.memoryButton1.Bounds);

            // 影1
            e.Graphics.FillRectangle(shapeBursh1, this.memoryButton1.BoundsShadow1OrNull);

            // 影2
            e.Graphics.FillRectangle(shapeBursh1, this.memoryButton1.BoundsShadow2OrNull);

            string sDisplay;

            if (this.customcontrolCheckbox1.Checked)
            {
                sDisplay = "V";
            }
            else
            {
                sDisplay = "";
            }

            // テキスト表示領域は、四角の線から1ドット離すように小さくします。
            e.Graphics.DrawString(
                sDisplay,
                this.customcontrolCheckbox1.Font,
                fontBrush1,
                new Rectangle(
                    this.memoryButton1.Bounds.X + 2 + 1,
                    this.memoryButton1.Bounds.Y + 2 + 3,
                    this.memoryButton1.Bounds.Width - 2,
                    this.memoryButton1.Bounds.Height - 2
                    )
                );
        }