Example #1
0
 public PageButton()
 {
     InitializeComponent();
     mouseAction = MouseActionType.None;
     this.SetStyle(ControlStyles.AllPaintingInWmPaint |
         ControlStyles.DoubleBuffer |
         ControlStyles.UserPaint, true);
 }
Example #2
0
 protected override void OnMouseLeave(EventArgs e)
 {
     if (this.ForeColor != Color.Red) {
         this.mouseAction = MouseActionType.None;
         base.OnMouseLeave(e);
         this.Invalidate();
     }
 }
Example #3
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         this.mouseAction = MouseActionType.BUTTON_DOWN;
         this.Invalidate();
     }
     base.OnMouseDown(e);
 }
 protected override void OnMouseDown(MouseEventArgs mevent)
 {
     if (mevent.Button == MouseButtons.Left)
     {
         this.mouseActionType = MouseActionType.Click;
         this.Invalidate();
     }
     base.OnMouseDown(mevent);
 }
        public GZXButton()
        {
            InitializeComponent();
            mouseActionType = MouseActionType.None;
            this.SetStyle(ControlStyles.AllPaintingInWmPaint |//禁止擦除背景
                ControlStyles.DoubleBuffer |//双缓冲
                ControlStyles.UserPaint, true);

            this.Font = new Font("Aial Black", 12, FontStyle.Bold);
            this.BackColor = Color.DarkTurquoise;
            this.Size = new Size(112, 48);
        }
Example #6
0
        public CusButton()
        {
            InitializeComponent();

            mouseAction = MouseActionType.BUTTON_UP;

            this.SetStyle(ControlStyles.AllPaintingInWmPaint |
                ControlStyles.DoubleBuffer |
                ControlStyles.UserPaint, true);

            //The following defaults are better suited to draw the text outline
            //this.Font = new Font("宋体", 20);
            this.Size = new Size(90, 41);
        }
Example #7
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Color backColor = this.BackColor;

            if (this.ForeColor != Color.Red && mouseAction == MouseActionType.Click) {
                mouseAction = MouseActionType.None;
            }
            if (this.ForeColor == Color.Red) {
                mouseAction = MouseActionType.Click;
            }
            switch (mouseAction) {
                case MouseActionType.None:
                    backColor = Color.Transparent;
                    this.Cursor = Cursors.Default;
                    break;
                case MouseActionType.Hover:
                    backColor = ColorTranslator.FromHtml("#417EB7"); //ColorTranslator.FromHtml("#ADA8AC"); 标签栏的背景色
                    this.Cursor = Cursors.Hand;
                    break;
                case MouseActionType.Click:
                    backColor = Color.Transparent;
                    this.Cursor = Cursors.Default;
                    break;
            }

            Brush backbrush = new SolidBrush(backColor);
            e.Graphics.FillRectangle(backbrush, ClientRectangle);//刷背景色
            Color borderColor = ColorTranslator.FromHtml("#A6A6A6");// #F7F7F7是背景色
            if (mouseAction == MouseActionType.None) //画边框
            {
                ControlPaint.DrawBorder(e.Graphics,
                                    this.ClientRectangle,
                                    borderColor,
                                    1,
                                    ButtonBorderStyle.Solid,
                                    borderColor,
                                    1,
                                    ButtonBorderStyle.Solid,
                                    borderColor,
                                    1,
                                    ButtonBorderStyle.Solid,
                                    borderColor,
                                    1,
                                    ButtonBorderStyle.Solid);
            }
            base.OnPaint(e);
        }
Example #8
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0)) {
            RaycastHit hit;
            if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit)) {
                // If we've clicked on the model, then modify the model
                CurrentMouseActionType = MouseActionType.Edit;
                Client.SendTcp(VoxelCommand.Add(new Voxel(ConvertToWorldAdjPos(hit), _hsvColorPicker.currentColor)));
            } else {
                if (!EventSystem.current.IsPointerOverGameObject())
                {
                    // If we've clicked on nothing (the background), then move the camera
                    CurrentMouseActionType = MouseActionType.CameraMove;
                }
            }
        } else if (Input.GetMouseButtonUp(0)) {
            CurrentMouseActionType = MouseActionType.None;
        }

        if (Input.GetMouseButtonDown(1))
        {
            RaycastHit hit;
            if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit))
            {
                // If we've clicked on the model, then modify the model
                Client.SendTcp(VoxelCommand.Remove(ConvertToWorldHitPos(hit)));
            }
        }

        // TODO: Only zoom when the app has focus
        float scroll = Input.GetAxis(Constants.Input.MouseScrollWheel);
        if (scroll > 0) {
            CameraController.Instance.IncrementCamDistance();
        } else if (scroll < 0) {
            CameraController.Instance.DecrementCamDistance();
        }
    }
Example #9
0
 public MousePoint(int x, int y, MouseActionType actionType, bool actualMousePoint) : this(x, y, actionType)
 {
     ActualMousePoint = actualMousePoint;
 }
 protected override void OnMouseUp(MouseEventArgs mevent)
 {
     this.mouseActionType = MouseActionType.Hover;
     this.Invalidate();
     base.OnMouseUp(mevent);
 }
Example #11
0
 public MouseFunction()
 {
     Action = MouseActionType.LeftClick;
 }
Example #12
0
		protected override void OnMouseLeave(EventArgs e)
		{
			this.mouseAction = MouseActionType.None;
			this.Invalidate();
			base.OnMouseLeave (e);
		}
Example #13
0
		protected override void OnMouseEnter(EventArgs e)
		{
			this.mouseAction = MouseActionType.Hover;
			this.Invalidate();
			base.OnMouseEnter (e);
		}
Example #14
0
		protected override void OnMouseUp(MouseEventArgs e)
		{
			if (this.Bounds.Contains(e.X, e.Y))
				this.mouseAction = MouseActionType.Hover;
			else
				this.mouseAction = MouseActionType.None;
			this.Invalidate();
			base.OnMouseUp (e);
		}
Example #15
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     this.mouseAction = MouseActionType.MOUSE_OVER;
     this.Invalidate();
     base.OnMouseUp(e);
 }
Example #16
0
 public MouseFunction(MouseFunction other)
 {
     Action = other.Action;
 }
Example #17
0
 public override void Deserialize(BinaryReader reader)
 {
     Action = (MouseActionType)reader.ReadUInt32();
 }
Example #18
0
 protected override void OnMouseUp(MouseEventArgs mevent)
 {
     this.mouseActionType = MouseActionType.Hover;
     this.Invalidate();
     base.OnMouseUp(mevent);
 }
Example #19
0
 public MousePoint(int x, int y, MouseActionType actionType) : this(x, y)
 {
     MouseAction = actionType;
 }
 protected override void OnMouseLeave(EventArgs e)
 {
     this.mouseAction = MouseActionType.None;
     this.Invalidate();
     base.OnMouseLeave(e);
 }
 protected override void OnMouseEnter(EventArgs e)
 {
     this.mouseAction = MouseActionType.Hover;
     this.Invalidate();
     base.OnMouseEnter(e);
 }