Пример #1
0
        private void EventPaint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            if (!mouseDown)
            {
                if (SelectedColor.IsTransparent)
                {
                    if (bmp != null)
                    {
                        bmp.Dispose();
                    }
                    bmp = (Bitmap)ImageDrawHelpers.DrawCheckers(clientWidth, clientHeight);
                }

                DrawColors();
            }

            g.DrawImage(bmp, ClientRectangle);

            if (CrosshairVisible)
            {
                DrawCrosshair(g);
            }
        }
Пример #2
0
        public override void PaintValue(PaintValueEventArgs e)
        {
            Graphics g     = e.Graphics;
            Color    color = (Color)e.Value;

            ImageDrawHelpers.DrawColorPickerIcon(g, color, e.Bounds);
        }
Пример #3
0
        public override Image Apply(Image img)
        {
            if (UseGradient)
            {
                return(ImageDrawHelpers.DrawBorder(img, Color, Color2, GradientType, Size, Type));
            }

            return(ImageDrawHelpers.DrawBorder(img, Color, Size, Type));
        }
Пример #4
0
        public NotificationForm(int duration, int fadeDuration, ContentAlignment placement, Size size, NotificationFormConfig config)
        {
            InitializeComponent();
            Icon = ShareXResources.Icon;
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);

            Duration     = duration;
            FadeDuration = fadeDuration;

            opacityDecrement = (float)fadeInterval / FadeDuration;

            ToastConfig = config;
            textFont    = new Font("Arial", 10);

            if (config.Image != null)
            {
                config.Image = ImageResizeHelpers.ResizeImageLimit(config.Image, size);
                config.Image = ImageDrawHelpers.DrawCheckers(config.Image);
                size         = new Size(config.Image.Width + 2, config.Image.Height + 2);
            }
            else if (!string.IsNullOrEmpty(config.Text))
            {
                textRenderSize = Helpers.MeasureText(config.Text, textFont, size.Width - textPadding * 2);
                size           = new Size(textRenderSize.Width + textPadding * 2, textRenderSize.Height + textPadding * 2 + 2);
            }

            Point position = Helpers.GetPosition(placement, new Point(windowOffset, windowOffset), Screen.PrimaryScreen.WorkingArea.Size, size);

            NativeMethods.SetWindowPos(Handle, (IntPtr)SpecialWindowHandles.HWND_TOPMOST, position.X + Screen.PrimaryScreen.WorkingArea.X,
                                       position.Y + Screen.PrimaryScreen.WorkingArea.Y, size.Width, size.Height, SetWindowPosFlags.SWP_NOACTIVATE);

            if (Duration <= 0)
            {
                DurationEnd();
            }
            else
            {
                tDuration.Interval = Duration;
                tDuration.Start();
            }
        }
Пример #5
0
 public override Image Apply(Image img)
 {
     return(ImageDrawHelpers.DrawCheckers(img, Size, Color, Color2));
 }
Пример #6
0
 public override Image Apply(Image img)
 {
     return(ImageDrawHelpers.DrawReflection(img, Percentage, MaxAlpha, MinAlpha, Offset, Skew, SkewSize));
 }