Esempio n. 1
0
        public void Set_color_filters()
        {
            float[][] NormalColorMatrixElements =
            {
                new float[] { 1, 0, 0, 0, 0 },
                new float[] { 0, 1, 0, 0, 0 },
                new float[] { 0, 0, 1, 0, 0 },
                new float[] { 0, 0, 0, 1, 0 },
                new float[] { 0, 0, 0, 0, 1 }
            };

            float[][] BlueColorMatrixElements =
            {
                new float[] {     1,     0, 0, 0, 0 },
                new float[] {     0,     1, 0, 0, 0 },
                new float[] {     0,     0, 2, 0, 0 },
                new float[] {     0,     0, 0, 1, 0 },
                new float[] { -0.2f, -0.2f, 0, 0, 1 }
            };

            NormalImage.SetColorMatrix(new System.Drawing.Imaging.ColorMatrix(NormalColorMatrixElements), System.Drawing.Imaging.ColorMatrixFlag.Default, System.Drawing.Imaging.ColorAdjustType.Bitmap);
            BlueImage.SetColorMatrix(new System.Drawing.Imaging.ColorMatrix(BlueColorMatrixElements), System.Drawing.Imaging.ColorMatrixFlag.Default, System.Drawing.Imaging.ColorAdjustType.Bitmap);
        }
Esempio n. 2
0
        private void CheckMouseUpdate()
        {
            inputController.Begin(); //Begin get inputController

            this.Clicked = false;

            //LEFT CLICK
            if (inputController.IsLeftClick())
            {
                if (isHovered)
                {
                    Debug.WriteLine(String.Format("{0},{1}", inputController.MousePosition.X, inputController.MousePosition.Y));

                    if (this.CanSelect)
                    {
                        this.isSelected = true;
                    }

                    this.Clicked = true;
                    this.DoButtonEvent();
                    this.DoButtonEventWithSender(this);
                }
                else
                {
                    if (this.CanSelect)
                    {
                        this.isSelected = false;
                    }
                }
            }

            //RIGHT CLICK
            if (inputController.IsRightLick())
            {
                if (isHovered)
                {
                    this.isRightClick = true;
                    this.OnRightClick();
                }
                else
                {
                    this.isRightClick = false;
                }
            }

            if (this.Sprite.Bound.Contains(inputController.MousePosition) && !isHovered)
            {
                if (hoverImage != null)
                {
                    HoverImage.CopyAnimation(Sprite);
                    this.Sprite = HoverImage;
                }
                isHovered = true;
            }

            if (!this.Sprite.Bound.Contains(inputController.MousePosition) && isHovered)
            {
                isHovered = false;
                if (normalImage != null)
                {
                    NormalImage.CopyAnimation(Sprite);
                    this.Sprite = NormalImage;
                }
            }

            if (isSelected && this.CanSelect)
            {
                if (selectedImage != null)
                {
                    SelectedImage.CopyAnimation(Sprite);
                    this.Sprite = SelectedImage;
                }
                else if (normalImage != null)
                {
                    NormalImage.CopyAnimation(Sprite);
                    this.Sprite = NormalImage;
                }
            }

            inputController.End(); //End get inputController
        }