예제 #1
0
        public override void Control(Form1 f)
        {
            Point mouse = f.GetCusor();
            bool  click = f.GetClick();

            if (mouse.X > this.x && mouse.X < this.x + this.width)
            {
                if (mouse.Y > this.y && mouse.Y < this.y + this.height)
                {
                    if (click)
                    {
                        this.state = 2;
                    }
                    else if (this.state == 2)
                    {
                        this.action();
                        this.state = 1;
                    }
                    else
                    {
                        this.state = 1;
                    }
                }
                else
                {
                    this.state = 0;
                }
            }
            else
            {
                this.state = 0;
            }
            this.Draw(f.GetGraphics());
        }
예제 #2
0
        public override void Control(Form1 f)
        {
            Point mouse = f.GetCusor();
            bool  click = f.GetClick();

            this.state = 0;
            if (mouse.X > this.x && mouse.X < this.x + this.width)
            {
                if (mouse.Y > this.y && mouse.Y < this.y + this.height)
                {
                    if (click)
                    {
                        this.value = (mouse.X - this.x) / this.width;
                    }
                    this.state = 1;
                }
            }
            this.Draw(f.GetGraphics());
        }