示例#1
0
        public static void DrawVistaGradient(Graphics gr, Color aColor, Rectangle aRect, FillDirection aDir)
        {
            Rectangle dstrc = aRect;

            if (aDir == FillDirection.Vertical)
            {
                dstrc.Height /= 2;
            }
            else
            {
                dstrc.Width /= 2;
            }
            Rectangle rectangle2 = dstrc;

            if (aDir == FillDirection.Vertical)
            {
                rectangle2.Location = new Point(aRect.X, aRect.Y + (aRect.Height / 2));
            }
            else
            {
                rectangle2.Location = new Point(aRect.X + (aRect.Width / 2), aRect.Y);
            }
            Color         colorA        = GetColorA(aColor);
            Color         colorB        = GetColorB(aColor);
            Color         colorC        = GetColorC(aColor);
            Color         colorD        = GetColorD(aColor);
            GradientColor gradientColor = new GradientColor(colorA, colorB, aDir);

            Fill(gr, dstrc, dstrc, gradientColor);
            GradientColor color6 = new GradientColor(colorC, colorD, aDir);

            Fill(gr, rectangle2, rectangle2, color6);
        }
示例#2
0
 public static void DrawVistaGradient(Graphics gr, Color aColor, Rectangle aRect, FillDirection aDir)
 {
     Rectangle dstrc = aRect;
     if (aDir == FillDirection.Vertical)
     {
         dstrc.Height /= 2;
     }
     else
     {
         dstrc.Width /= 2;
     }
     Rectangle rectangle2 = dstrc;
     if (aDir == FillDirection.Vertical)
     {
         rectangle2.Location = new Point(aRect.X, aRect.Y + (aRect.Height / 2));
     }
     else
     {
         rectangle2.Location = new Point(aRect.X + (aRect.Width / 2), aRect.Y);
     }
     Color colorA = GetColorA(aColor);
     Color colorB = GetColorB(aColor);
     Color colorC = GetColorC(aColor);
     Color colorD = GetColorD(aColor);
     GradientColor gradientColor = new GradientColor(colorA, colorB, aDir);
     Fill(gr, dstrc, dstrc, gradientColor);
     GradientColor color6 = new GradientColor(colorC, colorD, aDir);
     Fill(gr, rectangle2, rectangle2, color6);
 }
示例#3
0
        public static bool Fill(Graphics gr, Rectangle dstrc, Rectangle srcrc, GradientColor gradientColor)
        {
            Color startColor = gradientColor.StartColor;
            Color endColor   = gradientColor.EndColor;

            if (gradientColor.FillDirection == FillDirection.Horizontal)
            {
                if ((dstrc.X != srcrc.X) || (dstrc.Width != srcrc.Width))
                {
                    float num  = ((float)(dstrc.Left - srcrc.X)) / ((float)srcrc.Width);
                    float num2 = ((float)(dstrc.Right - srcrc.X)) / ((float)srcrc.Width);
                    int   num3 = endColor.R - startColor.R;
                    int   num4 = endColor.G - startColor.G;
                    int   num5 = endColor.B - startColor.B;
                    startColor = Color.FromArgb((byte)(gradientColor.StartColor.R + (num3 * num)), (byte)(gradientColor.StartColor.G + (num4 * num)), (byte)(gradientColor.StartColor.B + (num5 * num)));
                    endColor   = Color.FromArgb((byte)(gradientColor.StartColor.R + (num3 * num2)), (byte)(gradientColor.StartColor.G + (num4 * num2)), (byte)(gradientColor.StartColor.B + (num5 * num2)));
                }
            }
            else if ((dstrc.Y != srcrc.Y) || (dstrc.Height != srcrc.Height))
            {
                float num6  = ((float)(dstrc.Top - srcrc.Y)) / ((float)srcrc.Height);
                float num7  = ((float)(dstrc.Bottom - srcrc.Y)) / ((float)srcrc.Height);
                int   num8  = endColor.R - startColor.R;
                int   num9  = endColor.G - startColor.G;
                int   num10 = endColor.B - startColor.B;
                startColor = Color.FromArgb((byte)(gradientColor.StartColor.R + (num8 * num6)), (byte)(gradientColor.StartColor.G + (num9 * num6)), (byte)(gradientColor.StartColor.B + (num10 * num6)));
                endColor   = Color.FromArgb((byte)(gradientColor.StartColor.R + (num8 * num7)), (byte)(gradientColor.StartColor.G + (num9 * num7)), (byte)(gradientColor.StartColor.B + (num10 * num7)));
            }
            if (Environment.OSVersion.Platform != PlatformID.WinCE)
            {
                return(FillManaged(gr, dstrc, startColor, endColor, gradientColor.FillDirection));
            }
            Win32Helper.TRIVERTEX[]     pVertex = new Win32Helper.TRIVERTEX[] { new Win32Helper.TRIVERTEX(dstrc.X, dstrc.Y, startColor), new Win32Helper.TRIVERTEX(dstrc.Right, dstrc.Bottom, endColor) };
            Win32Helper.GRADIENT_RECT[] pMesh   = new Win32Helper.GRADIENT_RECT[] { new Win32Helper.GRADIENT_RECT(0, 1) };
            IntPtr hdc  = gr.GetHdc();
            bool   flag = false;

            try
            {
                flag = Win32Helper.GradientFill(hdc, pVertex, (uint)pVertex.Length, pMesh, (uint)pMesh.Length, (uint)gradientColor.FillDirection);
                gr.ReleaseHdc(hdc);
            }
            catch (Exception)
            {
                gr.ReleaseHdc(hdc);
                flag = FillManaged(gr, dstrc, startColor, endColor, gradientColor.FillDirection);
            }
            return(flag);
        }
示例#4
0
 public static bool Fill(Graphics gr, Rectangle dstrc, Rectangle srcrc, GradientColor gradientColor)
 {
     Color startColor = gradientColor.StartColor;
     Color endColor = gradientColor.EndColor;
     if (gradientColor.FillDirection == FillDirection.Horizontal)
     {
         if ((dstrc.X != srcrc.X) || (dstrc.Width != srcrc.Width))
         {
             float num = ((float) (dstrc.Left - srcrc.X)) / ((float) srcrc.Width);
             float num2 = ((float) (dstrc.Right - srcrc.X)) / ((float) srcrc.Width);
             int num3 = endColor.R - startColor.R;
             int num4 = endColor.G - startColor.G;
             int num5 = endColor.B - startColor.B;
             startColor = Color.FromArgb((byte) (gradientColor.StartColor.R + (num3 * num)), (byte) (gradientColor.StartColor.G + (num4 * num)), (byte) (gradientColor.StartColor.B + (num5 * num)));
             endColor = Color.FromArgb((byte) (gradientColor.StartColor.R + (num3 * num2)), (byte) (gradientColor.StartColor.G + (num4 * num2)), (byte) (gradientColor.StartColor.B + (num5 * num2)));
         }
     }
     else if ((dstrc.Y != srcrc.Y) || (dstrc.Height != srcrc.Height))
     {
         float num6 = ((float) (dstrc.Top - srcrc.Y)) / ((float) srcrc.Height);
         float num7 = ((float) (dstrc.Bottom - srcrc.Y)) / ((float) srcrc.Height);
         int num8 = endColor.R - startColor.R;
         int num9 = endColor.G - startColor.G;
         int num10 = endColor.B - startColor.B;
         startColor = Color.FromArgb((byte) (gradientColor.StartColor.R + (num8 * num6)), (byte) (gradientColor.StartColor.G + (num9 * num6)), (byte) (gradientColor.StartColor.B + (num10 * num6)));
         endColor = Color.FromArgb((byte) (gradientColor.StartColor.R + (num8 * num7)), (byte) (gradientColor.StartColor.G + (num9 * num7)), (byte) (gradientColor.StartColor.B + (num10 * num7)));
     }
     if (Environment.OSVersion.Platform != PlatformID.WinCE)
     {
         return FillManaged(gr, dstrc, startColor, endColor, gradientColor.FillDirection);
     }
     Win32Helper.TRIVERTEX[] pVertex = new Win32Helper.TRIVERTEX[] { new Win32Helper.TRIVERTEX(dstrc.X, dstrc.Y, startColor), new Win32Helper.TRIVERTEX(dstrc.Right, dstrc.Bottom, endColor) };
     Win32Helper.GRADIENT_RECT[] pMesh = new Win32Helper.GRADIENT_RECT[] { new Win32Helper.GRADIENT_RECT(0, 1) };
     IntPtr hdc = gr.GetHdc();
     bool flag = false;
     try
     {
         flag = Win32Helper.GradientFill(hdc, pVertex, (uint) pVertex.Length, pMesh, (uint) pMesh.Length, (uint) gradientColor.FillDirection);
         gr.ReleaseHdc(hdc);
     }
     catch (Exception)
     {
         gr.ReleaseHdc(hdc);
         flag = FillManaged(gr, dstrc, startColor, endColor, gradientColor.FillDirection);
     }
     return flag;
 }
示例#5
0
 public SpinButton()
 {
     this.m_gradientColors.PropertyChanged += new EventHandler(this.OnGradientColorPropertyChanged);
     this.m_gradientColorsPressed = new GradientColor(Color.Black, Color.LightGray);
     this.m_gradientColorsPressed.PropertyChanged += new EventHandler(this.OnGradientColorPropertyChanged);
     this.m_imageDefault = null;
     this.m_imagePressed = null;
     this.m_imageVgaDefault = null;
     this.m_imageVgaPressed = null;
     this.m_timer = new Timer();
     this.m_timer.Enabled = false;
     this.m_timer.Tick += new EventHandler(this.OnTimerTick);
     this.m_repeatDelay = 500;
     this.m_repeatRate = 100;
     this.m_repeatIncreaseRate = 20;
     this.m_repeatCount = 0;
     this.m_increaseRate = 1;
     base.BackColor = SystemColors.Window;
     base.Size = new Size(12, 0x16);
 }
示例#6
0
 protected override void Dispose(bool disposing)
 {
     this.SuspendRedraw();
     if (this.m_TouchScrollingTimer != null)
     {
         this.m_TouchScrollingTimer.Dispose();
     }
     this.m_TouchScrollingTimer = null;
     BackBufferManager.Release();
     this.m_gradientBackColor = null;
     this.m_pages = null;
     if (this.m_ItemCollection != null)
     {
         this.m_ItemCollection.Clear();
     }
     this.m_ItemCollection = null;
     if (this.m_itemList != null)
     {
         this.m_itemList.Clear();
     }
     this.m_itemList = null;
     if (disposing)
     {
         foreach (Control control in this.m_Controls.Values)
         {
             control.Dispose();
         }
         this.m_Controls.Clear();
         if (this.m_vScroll != null)
         {
             this.m_vScroll.Detach();
         }
         this.m_vScroll = null;
     }
     if (m_sPen != null)
     {
         m_sPen.Dispose();
     }
     m_sPen = null;
     if (m_sPixel != null)
     {
         m_sPixel.Dispose();
     }
     m_sPixel = null;
     if (disposing && (this.components != null))
     {
         this.components.Dispose();
     }
     base.Dispose(disposing);
 }
示例#7
0
 public DetailView()
 {
     this.m_ItemCollection.Parent = this;
     this.AutoRefresh = true;
     base.Tag = null;
     Graphics graphics = null;
     try
     {
         graphics = base.CreateGraphics();
         this.m_dpiFactor = new SizeF(graphics.DpiX / 96f, graphics.DpiY / 96f);
         ScaleSettings(graphics.DpiX, graphics.DpiY);
     }
     catch
     {
     }
     finally
     {
         if (graphics != null)
         {
             graphics.Dispose();
         }
         graphics = null;
     }
     this.m_LastMousePosition = new Point(0, 0);
     this.m_iCurrentPage = 0;
     this.m_PagesStyle = RescoPageStyle.Arrows;
     this.m_ArrowStyle = RescoArrowStyle.LeftRight;
     this.m_pagesRightToLeft = false;
     this.m_splitArrows = false;
     this.m_pagesLocation = RescoPagesLocation.Bottom;
     this.m_StartDrawPage = 0;
     this.m_PagesOverWidth = false;
     base.BackColor = Color.White;
     this.m_disabledForeColor = SystemColors.GrayText;
     this.m_LabelWidth = DefaultLabelWidth;
     this.m_SeparatorWidth = HorizontalSpacer;
     this.m_BackColor = new SolidBrush(this.BackColor);
     this.m_gradientBackColor = new GradientColor();
     this.m_gradientBackColor.PropertyChanged += new EventHandler(this.m_gradientBackColor_PropertyChanged);
     this.m_useGradient = false;
     BackBufferManager.AddRef();
     Rectangle rectangle = this.CalculateClientRect();
     this.m_VScrollBarWidth = DefaultScrollBarWidth;
     this.m_vScroll.Bounds = new Rectangle(rectangle.Width - this.m_VScrollBarWidth, 0, this.m_VScrollBarWidth, rectangle.Height);
     this.m_vScroll.Minimum = 0;
     this.m_vScroll.Maximum = 0;
     this.m_iActualMaximumValue = 0;
     this.m_vScroll.SmallChange = 20;
     this.m_vScroll.LargeChange = base.Height;
     this.m_vScroll.Value = 0;
     this.m_vScroll.Visible = false;
     this.m_iPrevValue = 0;
     this.m_vScroll.Attach(this);
     this.m_vScroll.ValueChanged += new EventHandler(this.OnValueChanged);
     this.m_vScroll.Resize += new EventHandler(this.OnScrollResize);
     this.SelectedItem = null;
     this.m_ToolTip = null;
     this.m_LeftArrowClicked = false;
     this.m_RightArrowClicked = false;
     this.m_ItemCollection.Changed += new DetailViewEventHandler(this.OnItemsChanged);
     this.GetControl(typeof(DVComboBox));
     this.m_TouchScrollingTimer = new Timer();
     this.m_TouchScrollingTimer.Enabled = false;
     this.m_TouchScrollingTimer.Interval = 50;
     this.m_TouchScrollingTimer.Tick += new EventHandler(this.OnTouchScrollingTimerTick);
     this.m_bTouchScrolling = false;
     this.m_bEnableTouchScrolling = false;
     this.m_TouchAutoScrollDiffX = 0;
     this.m_TouchAutoScrollDiffY = 0;
     this.m_touchSensitivity = 0x10;
     this.m_touchPage = false;
     this.m_touchScrollDirection = Resco.Controls.DetailView.TouchScrollDirection.Inverse;
     this.m_touchPagesDirection = Resco.Controls.DetailView.TouchScrollDirection.Inverse;
     this.InitializeComponent();
 }