Exemplo n.º 1
0
        //────────────────────────────────────────

        private void UsercontrolButton_MouseEnter(object sender, EventArgs e)
        {
            // マウスが領域に入ってきたら、
            // テキストボックスを可視化。
            UsercontrolButton ucBtn = (UsercontrolButton)sender;

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



            // ボタンをまだマウスカーソルで指していない時。
            if (this.memoryBtn1.Bounds.Contains(p1) && !this.memoryBtn1.BMousePointed)
            {
                //ystem.Console.WriteLine("UcNumにマウスエンター e.GetType().Name=[" + e.GetType().Name + "] マウス位置=[" + System.Windows.Forms.Cursor.Position.X + "," + System.Windows.Forms.Cursor.Position.Y + "] this.upbtnBounds=[" + this.moUpbtn.Bounds.X + "," + this.moUpbtn.Bounds.Y + "," + this.moUpbtn.Bounds.Width + "," + this.moUpbtn.Bounds.Height + "] p1=[" + p1.X + "," + p1.Y + "] ●含む");
                this.memoryBtn1.ForeBrush = new SolidBrush(Color.Green);
                this.memoryBtn1.BackBrush = new SolidBrush(Color.YellowGreen);

                // ボタンを絵で描く。
                bRefresh = true;
            }
            //else
            //{
            //    ystem.Console.WriteLine("ボタンを今マウスカーソルで指している時は、描画スキップ。this.moBtn.Bounds.Contains(p1)=(" + this.moBtn.Bounds.Contains(p1) + ") !this.moBtn.MousePointed=(" + !this.moBtn.MousePointed + ")");
            //}
            //ボタンを今マウスカーソルで指している時は、描画スキップ。


            if (bRefresh)
            {
                this.Refresh();
            }
        }
Exemplo n.º 2
0
        //────────────────────────────────────────
        public Usercontrol Perform(
            Expression_Node_StringImpl ec_FcName,
            MemoryApplication owner_MemoryApplication
            )
        {
            UsercontrolButton uctBtn = new UsercontrolButton();

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

            return uctBtn;
        }
Exemplo n.º 3
0
        //────────────────────────────────────────

        private void UsercontrolButton_Paint(object sender, PaintEventArgs e)
        {
            UsercontrolButton ucBtn = (UsercontrolButton)sender;

            //
            //  ┌────┐
            //  │    │
            //  │    ├─┐
            //  │    │影│
            //  │    │1│
            //  └─┬──┤ │
            //    │影2│ │
            //    └──┴─┘
            //
            // 自分の内側に線を引く。右と下に影を付ける。
            //


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

            if (!ucBtn.customcontrolButton1.Enabled)
            {
                // 編集不可能。

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

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

                // 背景色。
                e.Graphics.FillRectangle(ucBtn.memoryBtn1.BackBrush, this.memoryBtn1.Bounds);

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

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

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

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

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