Пример #1
0
        /// <summary>
        /// Draws a filled, reversible rectangle on the screen.
        /// </summary>
        /// <param name="graphics">The Graphics object to draw on.</param>
        /// <param name="bounds">The Rectangle that represents the dimensions of the rectangle to fill, in screen coordinates.</param>
        /// <param name="backColor">The Color of the background behind the fill.</param>
        public static void FillReversibleRectangle(Graphics graphics, Rectangle bounds, Color backColor)
        {
            int    color1      = StiColorUtils.GetColorRop(backColor, 10813541, 5898313);
            int    color2      = StiColorUtils.GetColorRop(backColor, 6, 6);
            IntPtr ptrGraphics = graphics.GetHdc();
            IntPtr ptrBrush    = Win32.CreateSolidBrush(ColorTranslator.ToWin32(backColor));
            int    oldColor    = Win32.SetROP2(ptrGraphics, color2);
            IntPtr ptrOldBrush = Win32.SelectObject(ptrGraphics, ptrBrush);

            Win32.PatBlt(ptrGraphics, bounds.X, bounds.Y, bounds.Width, bounds.Height, color1);
            Win32.SetROP2(ptrGraphics, oldColor);
            Win32.SelectObject(ptrGraphics, ptrOldBrush);
            Win32.DeleteObject(ptrBrush);
            graphics.ReleaseHdc(ptrGraphics);
        }
Пример #2
0
        public static StiBrush Light(StiBrush baseBrush, byte value)
        {
            if (baseBrush is StiSolidBrush)
            {
                return(new StiSolidBrush(StiColorUtils.Light(((StiSolidBrush)baseBrush).Color, value)));
            }
            else if (baseBrush is StiGradientBrush)
            {
                StiGradientBrush gradientBrush = baseBrush as StiGradientBrush;
                return(new StiGradientBrush(
                           StiColorUtils.Light(gradientBrush.StartColor, value),
                           StiColorUtils.Light(gradientBrush.EndColor, value),
                           gradientBrush.Angle));
            }
            else if (baseBrush is StiHatchBrush)
            {
                StiHatchBrush hatchBrush = baseBrush as StiHatchBrush;
                return(new StiHatchBrush(
                           hatchBrush.Style,
                           StiColorUtils.Light(hatchBrush.ForeColor, value),
                           StiColorUtils.Light(hatchBrush.BackColor, value)));
            }
            else if (baseBrush is StiGlareBrush)
            {
                StiGlareBrush glareBrush = baseBrush as StiGlareBrush;
                return(new StiGlareBrush(
                           StiColorUtils.Light(glareBrush.StartColor, value),
                           StiColorUtils.Light(glareBrush.EndColor, value),
                           glareBrush.Angle));
            }
            else if (baseBrush is StiGlassBrush)
            {
                StiGlassBrush glassBrush = baseBrush as StiGlassBrush;
                return(new StiGlassBrush(
                           StiColorUtils.Light(glassBrush.Color, value),
                           glassBrush.DrawHatch,
                           glassBrush.Blend));
            }

            return(baseBrush);
        }
Пример #3
0
        public static void InitColors()
        {
            activeCaptionEnd   = System.Drawing.SystemColors.ActiveCaption;
            inactiveCaptionEnd = System.Drawing.SystemColors.InactiveCaption;

            focus        = CalcColor(System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Window, 70);
            selected     = CalcColor(System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Window, 30);
            selectedText = CalcColor(System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Window, 220);
            content      = CalcColor(System.Drawing.SystemColors.Window, System.Drawing.SystemColors.Control, 200);
            contentDark  = StiColorUtils.Dark(StiColors.Content, 10);
            controlStart = StiColorUtils.Light(System.Drawing.SystemColors.Control, 30);
            controlEnd   = StiColorUtils.Dark(System.Drawing.SystemColors.Control, 10);
            controlText  = System.Drawing.SystemColors.ControlText;

            controlStartLight = StiColorUtils.Light(ControlStart, 20);
            controlEndLight   = StiColorUtils.Light(ControlEnd, 20);
            controlStartDark  = StiColorUtils.Dark(ControlStart, 20);
            controlEndDark    = StiColorUtils.Dark(ControlEnd, 20);

            activeCaptionStart   = StiColorUtils.GetSysColor(Win32.ColorType.COLOR_GRADIENTACTIVECAPTION);
            inactiveCaptionStart = StiColorUtils.GetSysColor(Win32.ColorType.COLOR_GRADIENTINACTIVECAPTION);
        }
 /// <summary>
 /// Creates an ActiveCaptionLight from the specified Rectangle and Angle.
 /// </summary>
 /// <param name="rectangle">Rectangle that defines the starting and ending points of the gradient.</param>
 /// <param name="angle">The angle, measured in degrees clockwise from the x-axis, of the gradient orientation line.</param>
 /// <returns>This method creates The LinearGradientBrush object.</returns>
 public static Brush GetActiveCaptionLightBrush(Rectangle rectangle, float angle)
 {
     return(new LinearGradientBrush(rectangle,
                                    StiColorUtils.Light(StiColors.ActiveCaptionStart, 20),
                                    StiColorUtils.Light(StiColors.ActiveCaptionEnd, 20), angle));
 }
 public Color GetBottomColorLight()
 {
     return(StiColorUtils.Light(GetBottomColor(), 2));
 }
 public Color GetTopColorLight()
 {
     return(StiColorUtils.Light(StiColorUtils.Light(this.Color, (byte)((float)64 * this.Blend)), 5));
 }