Пример #1
0
        private ScaledImage CreatePictureBox(System.Drawing.Color color)
        {
            var pictureBox = new ScaledImage(GetColorBitmap());

            pictureBox.Show();
            pictureBox.ButtonPressEvent  += PictureBox_ButtonPressEvent;
            pictureBox.MotionNotifyEvent += PictureBox_MotionNotifyEvent;

            this.color = color;

            return(pictureBox);
        }
Пример #2
0
        private void ChangeColor(ScaledImage image, int x, int y)
        {
            int colorSizeX  = ThemeBase.CustomColors.GetLength(0);
            int colorSizeY  = ThemeBase.CustomColors.GetLength(1);
            int imageWidth  = image.Allocation.Width;
            int imageHeight = image.Allocation.Height;

            int i = Math.Min(colorSizeX - 1, Math.Max(0, (int)(x / (float)imageWidth * colorSizeX)));
            int j = Math.Min(colorSizeY - 1, Math.Max(0, (int)(y / (float)imageHeight * colorSizeY)));

            foreach (var prop in properties)
            {
                if (prop.type == PropertyType.ColoredString)
                {
                    prop.control.ModifyBase(StateType.Normal, ToGdkColor(ThemeBase.CustomColors[i, j]));
                }
            }

            color = ThemeBase.CustomColors[i, j];
        }