コード例 #1
0
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     using(var brush = new SolidBrush(ColorTable.Grip))
     {
         var x = e.GripBounds.X + 1;
         var y = e.GripBounds.Y + 2;
         switch(e.GripDisplayStyle)
         {
             case ToolStripGripDisplayStyle.Horizontal:
                 x += 4;
                 while(x < e.GripBounds.Right - 4)
                 {
                     e.Graphics.FillRectangle(brush, new Rectangle(x, y, 2, 2));
                     x += 4;
                 }
                 break;
             case ToolStripGripDisplayStyle.Vertical:
                 y += 4;
                 while(y < e.GripBounds.Bottom - 4)
                 {
                     e.Graphics.FillRectangle(brush, new Rectangle(x, y, 2, 2));
                     y += 4;
                 }
                 break;
         }
     }
 }
コード例 #2
0
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (renderer is ToolStripProfessionalRenderer)
     {
         if (e.GripStyle == ToolStripGripStyle.Hidden)
         {
             return;
         }
         Color fore = GetThemeColor("ToolStrip.3dLightColor");
         using (Brush lightBrush = new SolidBrush(fore == Color.Empty ? this.colorTable.GripLight : fore))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left, e.GripBounds.Top + 6, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(lightBrush, r);
                 r.Offset(0, 4);
             }
         }
         Color back = GetThemeColor("ToolStrip.3dDarkColor");
         using (Brush darkBrush = new SolidBrush(back == Color.Empty ? this.colorTable.GripDark : back))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left - 1, e.GripBounds.Top + 5, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(darkBrush, r);
                 r.Offset(0, 4);
             }
         }
     }
     //else if (Win32.IsRunningOnWindows())
     else if (Type.GetType("Mono.Runtime") == null)
     {
         if (e.GripStyle == ToolStripGripStyle.Hidden)
         {
             return;
         }
         using (Brush lightBrush = new SolidBrush(this.colorTable.GripLight))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left, e.GripBounds.Top + 8, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(lightBrush, r);
                 r.Offset(0, 4);
             }
         }
         using (Brush darkBrush = new SolidBrush(this.colorTable.GripDark))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left - 1, e.GripBounds.Top + 7, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(darkBrush, r);
                 r.Offset(0, 4);
             }
         }
     }
     else
     {
         renderer.DrawGrip(e);
     }
 }
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (this.DottedGrip)
     {
         Graphics  graphics   = e.Graphics;
         Rectangle gripBounds = e.GripBounds;
         ToolStrip toolStrip  = e.ToolStrip;
         int       num        = (toolStrip.Orientation == Orientation.Horizontal) ? gripBounds.Height : gripBounds.Width;
         int       num2       = (toolStrip.Orientation == Orientation.Horizontal) ? gripBounds.Width : gripBounds.Height;
         int       num3       = (num - 8) / 4;
         if (num3 > 0)
         {
             Rectangle[] rects = new Rectangle[num3];
             int         y     = 4;
             int         x     = num2 / 2;
             for (int i = 0; i < num3; i++)
             {
                 rects[i] = (toolStrip.Orientation == Orientation.Horizontal) ? new Rectangle(x, y, 2, 2) : new Rectangle(y, x, 2, 2);
                 y       += 4;
             }
             graphics.FillRectangles(SystemBrushes.ControlLight, rects);
         }
     }
     else
     {
         base.OnRenderGrip(e);
     }
 }
コード例 #4
0
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (renderer is ToolStripProfessionalRenderer)
     {
         if (e.GripStyle == ToolStripGripStyle.Hidden) return;
         using (Brush lightBrush = new SolidBrush(this.colorTable.GripLight))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left, e.GripBounds.Top + 6, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(lightBrush, r);
                 r.Offset(0, 4);
             }
         }
         using (Brush darkBrush = new SolidBrush(this.colorTable.GripDark))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left - 1, e.GripBounds.Top + 5, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(darkBrush, r);
                 r.Offset(0, 4);
             }
         }
     }
     else renderer.DrawGrip(e);
 }
コード例 #5
0
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (renderer is ToolStripProfessionalRenderer)
     {
         if (e.GripStyle == ToolStripGripStyle.Hidden)
         {
             return;
         }
         using (Brush lightBrush = new SolidBrush(this.colorTable.GripLight))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left, e.GripBounds.Top + 6, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(lightBrush, r);
                 r.Offset(0, 4);
             }
         }
         using (Brush darkBrush = new SolidBrush(this.colorTable.GripDark))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left - 1, e.GripBounds.Top + 5, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(darkBrush, r);
                 r.Offset(0, 4);
             }
         }
     }
     else
     {
         renderer.DrawGrip(e);
     }
 }
コード例 #6
0
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (renderer is ToolStripProfessionalRenderer)
     {
         if (e.GripStyle == ToolStripGripStyle.Hidden)
         {
             return;
         }
         Color fore = PluginBase.MainForm.GetThemeColor("ToolStrip.3dLightColor");
         using (Brush lightBrush = new SolidBrush(fore == Color.Empty ? this.colorTable.GripLight : fore))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left, e.GripBounds.Top + 6, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(lightBrush, r);
                 r.Offset(0, 4);
             }
         }
         Color back = PluginBase.MainForm.GetThemeColor("ToolStrip.3dDarkColor");
         using (Brush darkBrush = new SolidBrush(back == Color.Empty ? this.colorTable.GripDark: back))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left - 1, e.GripBounds.Top + 5, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(darkBrush, r);
                 r.Offset(0, 4);
             }
         }
     }
     else
     {
         renderer.DrawGrip(e);
     }
 }
コード例 #7
0
 protected virtual void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (this.RendererOverride != null)
     {
         this.RendererOverride.OnRenderGrip(e);
     }
 }
コード例 #8
0
		protected override void OnRenderGrip(ToolStripGripRenderEventArgs e) {

			if (DottedGrip) {
				Graphics g = e.Graphics;
				Rectangle bounds = e.GripBounds;
				ToolStrip toolStrip = e.ToolStrip;

				int height = (toolStrip.Orientation == Orientation.Horizontal) ? bounds.Height : bounds.Width;
				int width = (toolStrip.Orientation == Orientation.Horizontal) ? bounds.Width : bounds.Height;

				int numRectangles = (height - (GRIP_PADDING * 2)) / 4;

				if (numRectangles > 0) {
					Rectangle[] shadowRects = new Rectangle[numRectangles];
					int startY = GRIP_PADDING;
					int startX = (width / 2);

					for (int i = 0; i < numRectangles; i++) {
						shadowRects[i] = (toolStrip.Orientation == Orientation.Horizontal) ?
											new Rectangle(startX, startY, 2, 2) :
											new Rectangle(startY, startX, 2, 2);

						startY += 4;
					}

					g.FillRectangles(SystemBrushes.ControlLight, shadowRects);



				}
			}
			else {
				base.OnRenderGrip(e);
			}
		}
コード例 #9
0
 /// <include file='doc\ToolStripRenderer.uex' path='docs/doc[@for="ToolStripRenderer.OnRenderGrip"]/*' />
 /// <devdoc>
 /// Draw the grip.  ToolStrip users should override this if they want to draw differently.
 /// </devdoc>
 protected virtual void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (RendererOverride != null)
     {
         RendererOverride.OnRenderGrip(e);
         return;
     }
 }
コード例 #10
0
 protected override void OnRenderGrip(System.Windows.Forms.ToolStripGripRenderEventArgs e)
 {
     if (currentRenderer != null)
     {
         currentRenderer.DrawGrip(e);
         return;
     }
     base.OnRenderGrip(e);
 }
コード例 #11
0
        protected virtual void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            ToolStripGripRenderEventHandler eh = (ToolStripGripRenderEventHandler)Events [RenderGripEvent];

            if (eh != null)
            {
                eh(this, e);
            }
        }
コード例 #12
0
        /// <include file='doc\ToolStripRenderer.uex' path='docs/doc[@for="ToolStripRenderer.DrawGrip"]/*' />
        /// <devdoc>
        /// Draw the background color
        /// </devdoc>
        public void DrawGrip(ToolStripGripRenderEventArgs e)
        {
            OnRenderGrip(e);
            ToolStripGripRenderEventHandler eh = Events[EventRenderGrip] as ToolStripGripRenderEventHandler;

            if (eh != null)
            {
                eh(this, e);
            }
        }
コード例 #13
0
        public void DrawGrip(ToolStripGripRenderEventArgs e)
        {
            this.OnRenderGrip(e);
            ToolStripGripRenderEventHandler handler = this.Events[EventRenderGrip] as ToolStripGripRenderEventHandler;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #14
0
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (_currentRenderer != null)
     {
         _currentRenderer.DrawGrip(e);
     }
     else
     {
         base.OnRenderGrip(e);
     }
 }
コード例 #15
0
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            Graphics  g            = e.Graphics;
            Rectangle bounds       = new Rectangle(Point.Empty, e.GripBounds.Size);
            bool      verticalGrip = e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical;

            if (ToolStripManager.VisualStylesEnabled && VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.Gripper.Normal))
            {
                VisualStyleRenderer vsRenderer = VisualStyleRenderer;

                if (verticalGrip)
                {
                    vsRenderer.SetParameters(VisualStyleElement.Rebar.Gripper.Normal);

                    bounds.Height = ((bounds.Height - 2 /*number of pixels for border*/) / 4) * 4; // make sure height is an even interval of 4.
                    bounds.Y      = Math.Max(0, (e.GripBounds.Height - bounds.Height - 2 /*number of pixels for border*/) / 2);
                }
                else
                {
                    vsRenderer.SetParameters(VisualStyleElement.Rebar.GripperVertical.Normal);
                }

                vsRenderer.DrawBackground(g, bounds);
            }
            else
            {
                // do some fixup so that we don't paint from end to end.
                Color backColor = e.ToolStrip.BackColor;
                FillBackground(g, bounds, backColor);

                if (verticalGrip)
                {
                    if (bounds.Height >= 4)
                    {
                        bounds.Inflate(0, -2);     // scoot down 2PX and start drawing
                    }

                    bounds.Width = 3;
                }
                else
                {
                    if (bounds.Width >= 4)
                    {
                        bounds.Inflate(-2, 0);        // scoot over 2PX and start drawing
                    }

                    bounds.Height = 3;
                }

                RenderSmall3DBorderInternal(g, bounds, ToolBarState.Hot, (e.ToolStrip.RightToLeft == RightToLeft.Yes));
            }
        }
コード例 #16
0
        /// <summary>
        /// Used to render the toolstrip's grip handle.
        /// </summary>
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            using (Pen linePen = new Pen(Color.FromArgb(98, 113, 140), 2))
              {
            linePen.DashPattern = new float[] { 1f, 1f };

            // Top position is determined by the toolstrip's padding, the inner border and the grip's size,
            // which we shorten by 8 pixels to make it more appealing.
            Point gripStart = new Point(e.GripBounds.X, e.GripBounds.Y + e.ToolStrip.GripMargin.Top);
            Point gripEnd = new Point(gripStart.X, e.GripBounds.Y + e.GripBounds.Height - e.ToolStrip.GripMargin.Bottom);
            e.Graphics.DrawLine(linePen, gripStart, gripEnd);
              }
        }
コード例 #17
0
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            if (e.GripStyle == ToolStripGripStyle.Hidden)
            {
                return;
            }

            if (e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical)
            {
                Rectangle r = new Rectangle(e.GripBounds.Left, e.GripBounds.Top + 5, 2, 2);

                for (int i = 0; i < e.GripBounds.Height - 12; i += 4)
                {
                    e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(this.ColorTable.GripLight), r);
                    r.Offset(0, 4);
                }

                Rectangle r2 = new Rectangle(e.GripBounds.Left - 1, e.GripBounds.Top + 4, 2, 2);

                for (int i = 0; i < e.GripBounds.Height - 12; i += 4)
                {
                    e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(this.ColorTable.GripDark), r2);
                    r2.Offset(0, 4);
                }
            }
            else
            {
                Rectangle r = new Rectangle(e.GripBounds.Left + 5, e.GripBounds.Top, 2, 2);

                for (int i = 0; i < e.GripBounds.Width - 11; i += 4)
                {
                    e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(this.ColorTable.GripLight), r);
                    r.Offset(4, 0);
                }

                Rectangle r2 = new Rectangle(e.GripBounds.Left + 4, e.GripBounds.Top - 1, 2, 2);

                for (int i = 0; i < e.GripBounds.Width - 11; i += 4)
                {
                    e.Graphics.FillRectangle(ThemeEngine.Current.ResPool.GetSolidBrush(this.ColorTable.GripDark), r2);
                    r2.Offset(4, 0);
                }
            }

            base.OnRenderGrip(e);
        }
コード例 #18
0
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            Graphics  dc     = e.Graphics;
            Rectangle bounds = new Rectangle(Point.Empty, e.GripBounds.Size);
            bool      flag   = e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical;

            if (ToolStripManager.VisualStylesEnabled && System.Windows.Forms.VisualStyles.VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.Gripper.Normal))
            {
                System.Windows.Forms.VisualStyles.VisualStyleRenderer visualStyleRenderer = VisualStyleRenderer;
                if (flag)
                {
                    visualStyleRenderer.SetParameters(VisualStyleElement.Rebar.Gripper.Normal);
                    bounds.Height = ((bounds.Height - 2) / 4) * 4;
                    bounds.Y      = Math.Max(0, ((e.GripBounds.Height - bounds.Height) - 2) / 2);
                }
                else
                {
                    visualStyleRenderer.SetParameters(VisualStyleElement.Rebar.GripperVertical.Normal);
                }
                visualStyleRenderer.DrawBackground(dc, bounds);
            }
            else
            {
                Color backColor = e.ToolStrip.BackColor;
                FillBackground(dc, bounds, backColor);
                if (flag)
                {
                    if (bounds.Height >= 4)
                    {
                        bounds.Inflate(0, -2);
                    }
                    bounds.Width = 3;
                }
                else
                {
                    if (bounds.Width >= 4)
                    {
                        bounds.Inflate(-2, 0);
                    }
                    bounds.Height = 3;
                }
                this.RenderSmall3DBorderInternal(dc, bounds, ToolBarState.Hot, e.ToolStrip.RightToLeft == RightToLeft.Yes);
            }
        }
コード例 #19
0
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            if (DottedGrip)
            {
                Graphics  g         = e.Graphics;
                Rectangle bounds    = e.GripBounds;
                ToolStrip toolStrip = e.ToolStrip;

                int height = (toolStrip.Orientation == Orientation.Horizontal) ? bounds.Height : bounds.Width;
                int width  = (toolStrip.Orientation == Orientation.Horizontal) ? bounds.Width : bounds.Height;

                int numRectangles = (height - (GRIP_PADDING * 2)) / 4;

                if (numRectangles > 0)
                {
                    Rectangle[] shadowRects = new Rectangle[numRectangles];
                    int         startY      = GRIP_PADDING;
                    int         startX      = (width / 2);

                    for (int i = 0; i < numRectangles; i++)
                    {
                        shadowRects[i] = (toolStrip.Orientation == Orientation.Horizontal) ?
                                         new Rectangle(startX, startY, 2, 2) :
                                         new Rectangle(startY, startX, 2, 2);

                        startY += 4;
                    }

                    g.FillRectangles(SystemBrushes.ControlLight, shadowRects);
                }
            }
            else
            {
                base.OnRenderGrip(e);
            }
        }
コード例 #20
0
 public void DrawGrip(ToolStripGripRenderEventArgs e)
 {
     this.OnRenderGrip(e);
 }
コード例 #21
0
ファイル: QuickFind.cs プロジェクト: Gr33z00/flashdevelop
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     this.renderer.DrawGrip(e);
 }
コード例 #22
0
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (renderer is ToolStripProfessionalRenderer)
     {
         if (e.GripStyle == ToolStripGripStyle.Hidden) return;
         Color fore = GetThemeColor("ToolStrip.3dLightColor");
         using (Brush lightBrush = new SolidBrush(fore == Color.Empty ? this.colorTable.GripLight : fore))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left, e.GripBounds.Top + 6, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(lightBrush, r);
                 r.Offset(0, 4);
             }
         }
         Color back = GetThemeColor("ToolStrip.3dDarkColor");
         using (Brush darkBrush = new SolidBrush(back == Color.Empty ? this.colorTable.GripDark : back))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left - 1, e.GripBounds.Top + 5, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(darkBrush, r);
                 r.Offset(0, 4);
             }
         }
     }
     else if (PlatformHelper.IsRunningOnWindows())
     {
         if (e.GripStyle == ToolStripGripStyle.Hidden) return;
         using (Brush lightBrush = new SolidBrush(this.colorTable.GripLight))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left, e.GripBounds.Top + 8, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(lightBrush, r);
                 r.Offset(0, 4);
             }
         }
         using (Brush darkBrush = new SolidBrush(this.colorTable.GripDark))
         {
             Rectangle r = new Rectangle(e.GripBounds.Left - 1, e.GripBounds.Top + 7, 2, 2);
             for (Int32 i = 0; i < e.GripBounds.Height - 11; i += 4)
             {
                 e.Graphics.FillRectangle(darkBrush, r);
                 r.Offset(0, 4);
             }
         }
     }
     else renderer.DrawGrip(e);
 }
コード例 #23
0
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            const int GripSize = 5;

            if(e.GripStyle != ToolStripGripStyle.Visible) return;

            var graphics = e.Graphics;
            var client = e.GripBounds;
            switch(e.GripDisplayStyle)
            {
                case ToolStripGripDisplayStyle.Horizontal:
                    client.Y += (client.Width - GripSize) / 2;
                    client.Height = 5;
                    break;
                case ToolStripGripDisplayStyle.Vertical:
                    client.X += (client.Width - GripSize) / 2;
                    client.Width = 5;
                    break;
            }
            if(client.Width <= 0 || client.Height <= 0) return;
            using(var brush = new HatchBrush(HatchStyle.Percent20, ColorTable.Grip, ColorTable.ToolStripBackground))
            {
                var ro = default(Point);
                try
                {
                    ro = graphics.RenderingOrigin;
                    graphics.RenderingOrigin = new Point(client.X % 4, client.Y % 4);
                }
                catch(NotImplementedException)
                {
                }
                graphics.FillRectangle(brush, client);
                try
                {
                    graphics.RenderingOrigin = ro;
                }
                catch(NotImplementedException)
                {
                }
            }
        }
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     Graphics dc = e.Graphics;
     Rectangle bounds = new Rectangle(Point.Empty, e.GripBounds.Size);
     bool flag = e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical;
     if (ToolStripManager.VisualStylesEnabled && System.Windows.Forms.VisualStyles.VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.Gripper.Normal))
     {
         System.Windows.Forms.VisualStyles.VisualStyleRenderer visualStyleRenderer = VisualStyleRenderer;
         if (flag)
         {
             visualStyleRenderer.SetParameters(VisualStyleElement.Rebar.Gripper.Normal);
             bounds.Height = ((bounds.Height - 2) / 4) * 4;
             bounds.Y = Math.Max(0, ((e.GripBounds.Height - bounds.Height) - 2) / 2);
         }
         else
         {
             visualStyleRenderer.SetParameters(VisualStyleElement.Rebar.GripperVertical.Normal);
         }
         visualStyleRenderer.DrawBackground(dc, bounds);
     }
     else
     {
         Color backColor = e.ToolStrip.BackColor;
         FillBackground(dc, bounds, backColor);
         if (flag)
         {
             if (bounds.Height >= 4)
             {
                 bounds.Inflate(0, -2);
             }
             bounds.Width = 3;
         }
         else
         {
             if (bounds.Width >= 4)
             {
                 bounds.Inflate(-2, 0);
             }
             bounds.Height = 3;
         }
         this.RenderSmall3DBorderInternal(dc, bounds, ToolBarState.Hot, e.ToolStrip.RightToLeft == RightToLeft.Yes);
     }
 }
コード例 #25
0
		protected override void OnRenderGrip (ToolStripGripRenderEventArgs e)
		{
			ThemeElements.CurrentTheme.ToolStripPainter.OnRenderGrip (e);

			base.OnRenderGrip (e);
		}
コード例 #26
0
		protected virtual void OnRenderGrip (ToolStripGripRenderEventArgs e)
		{
			ToolStripGripRenderEventHandler eh = (ToolStripGripRenderEventHandler)Events [RenderGripEvent];
			if (eh != null)
				eh (this, e);
		}
 public void DrawGrip(ToolStripGripRenderEventArgs e)
 {
     this.OnRenderGrip(e);
     ToolStripGripRenderEventHandler handler = this.Events[EventRenderGrip] as ToolStripGripRenderEventHandler;
     if (handler != null)
     {
         handler(this, e);
     }
 }
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (this.RendererOverride != null)
     {
         base.OnRenderGrip(e);
     }
     else
     {
         Graphics graphics = e.Graphics;
         Rectangle gripBounds = e.GripBounds;
         ToolStrip toolStrip = e.ToolStrip;
         bool flag = e.ToolStrip.RightToLeft == RightToLeft.Yes;
         int num = (toolStrip.Orientation == Orientation.Horizontal) ? gripBounds.Height : gripBounds.Width;
         int num2 = (toolStrip.Orientation == Orientation.Horizontal) ? gripBounds.Width : gripBounds.Height;
         int num3 = (num - 8) / 4;
         if (num3 > 0)
         {
             int num4 = (toolStrip is MenuStrip) ? 2 : 0;
             Rectangle[] rects = new Rectangle[num3];
             int y = 5 + num4;
             int x = num2 / 2;
             for (int i = 0; i < num3; i++)
             {
                 rects[i] = (toolStrip.Orientation == Orientation.Horizontal) ? new Rectangle(x, y, 2, 2) : new Rectangle(y, x, 2, 2);
                 y += 4;
             }
             int num8 = flag ? 1 : -1;
             if (flag)
             {
                 for (int k = 0; k < num3; k++)
                 {
                     rects[k].Offset(-num8, 0);
                 }
             }
             using (Brush brush = new SolidBrush(this.ColorTable.GripLight))
             {
                 graphics.FillRectangles(brush, rects);
             }
             for (int j = 0; j < num3; j++)
             {
                 rects[j].Offset(num8, -1);
             }
             using (Brush brush2 = new SolidBrush(this.ColorTable.GripDark))
             {
                 graphics.FillRectangles(brush2, rects);
             }
         }
     }
 }
コード例 #29
0
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            ThemeElements.CurrentTheme.ToolStripPainter.OnRenderGrip(e);

            base.OnRenderGrip(e);
        }
コード例 #30
0
 protected virtual void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     throw null;
 }
コード例 #31
0
ファイル: ToolStripRenderer.cs プロジェクト: JianwenSun/cc
 /// <include file='doc\ToolStripRenderer.uex' path='docs/doc[@for="ToolStripRenderer.DrawGrip"]/*' />
 /// <devdoc>
 /// Draw the background color
 /// </devdoc>
 public void DrawGrip(ToolStripGripRenderEventArgs e) {   
     OnRenderGrip(e);
     ToolStripGripRenderEventHandler eh = Events[EventRenderGrip] as ToolStripGripRenderEventHandler;
     if (eh != null) {
        eh(this, e);
      }   
 }   
コード例 #32
0
		public void TestToolStripGripRenderEventArgs()
		{
			Graphics g = Graphics.FromImage (new Bitmap (5, 5));
			ToolStrip ts = new ToolStrip();
			ToolStripGripRenderEventArgs e = new ToolStripGripRenderEventArgs(g, ts);

			Assert.AreEqual (new Rectangle(2,0,3,25), e.GripBounds, "CCC1");
			Assert.AreEqual (ToolStripGripDisplayStyle.Vertical, e.GripDisplayStyle, "CCC1");
			Assert.AreEqual (ToolStripGripStyle.Visible, e.GripStyle, "CCC3");
			Assert.AreEqual (g, e.Graphics, "CCC4");
			Assert.AreEqual (ts, e.ToolStrip, "CCC5");
	
		}
コード例 #33
0
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (currentRenderer != null)
         currentRenderer.DrawGrip(e);
     else
         base.OnRenderGrip(e);
 }
コード例 #34
0
        /// <include file='doc\ToolStripProfessionalRenderer.uex' path='docs/doc[@for="ToolStripProfessionalRenderer.OnRenderGrip"]/*' />
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e) {
            if (RendererOverride != null) {
                base.OnRenderGrip(e);
                return;
            }

            Graphics g = e.Graphics;
            Rectangle bounds = e.GripBounds;
            ToolStrip toolStrip = e.ToolStrip;

            bool rightToLeft = (e.ToolStrip.RightToLeft == RightToLeft.Yes);

            int height = (toolStrip.Orientation == Orientation.Horizontal) ? bounds.Height : bounds.Width;
            int width = (toolStrip.Orientation == Orientation.Horizontal) ? bounds.Width : bounds.Height;
            
            int numRectangles =  (height - (GRIP_PADDING * 2)) / 4;
            

            if (numRectangles > 0) {
                // a MenuStrip starts its grip lower and has fewer grip rectangles.
                int yOffset =  (toolStrip is MenuStrip) ? 2 : 0;
                
                Rectangle[] shadowRects = new Rectangle[numRectangles];
                int startY = GRIP_PADDING + 1 + yOffset;
                int startX = (width / 2);

                for (int i = 0; i < numRectangles; i++) {
                    shadowRects[i] = (toolStrip.Orientation == Orientation.Horizontal) ?
                                        new Rectangle(startX, startY, 2, 2) :
                                        new Rectangle(startY, startX, 2,2);
                                        
                    startY += 4;
                }

                // in RTL the GripLight rects should paint to the left of the GripDark rects.
                int xOffset = (rightToLeft) ? 1 : -1;
        
                if (rightToLeft) { 
                    // scoot over the rects in RTL so they fit within the bounds.
                    for (int i = 0; i < numRectangles; i++) {
                        shadowRects[i].Offset(-xOffset, 0);
                    }
                }

                using (Brush b = new SolidBrush(ColorTable.GripLight)) {
                    g.FillRectangles(b, shadowRects);
                }

                for (int i = 0; i < numRectangles; i++) {
                    shadowRects[i].Offset(xOffset, -1);
                }

                using (Brush b = new SolidBrush(ColorTable.GripDark)) {
                    g.FillRectangles(b, shadowRects);
                }
            }
        }
コード例 #35
0
ファイル: FaceRender.cs プロジェクト: Egoily/CSharp-EAlbum
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            bool vert = (e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical);

            if (e.GripStyle == ToolStripGripStyle.Visible)
            {
                Rectangle bounds = e.GripBounds;
                // grip direction
                if (vert)
                {
                    bounds.X = e.AffectedBounds.X;
                    bounds.Width = e.AffectedBounds.Width;
                    if (e.ToolStrip is MenuStrip)
                    {
                        // always returns vertical on menustrip: bug in GripDisplayStyle property?
                        if (e.AffectedBounds.Height > e.AffectedBounds.Width)
                        {
                            vert = false;
                            bounds.Y = e.AffectedBounds.Y;
                        }
                        else
                        {
                            // adjust to even margins tool-menu
                            e.ToolStrip.GripMargin = new Padding(0, 2, 0, 2);
                            bounds.Y = e.AffectedBounds.Y;
                            bounds.Height = e.AffectedBounds.Height;
                        }
                    }
                    else
                    {
                        e.ToolStrip.GripMargin = new Padding(2, 2, 4, 2);
                        bounds.X++;
                        bounds.Width++;
                    }
                }
                else
                {
                    bounds.Y = e.AffectedBounds.Y;
                    bounds.Height = e.AffectedBounds.Height;
                }
                // draw the selected style
                if ((GripStyle == GripType.Dotted) || (GripStyle == GripType.LargeDot))
                    drawDottedGrip(e.Graphics, bounds, vert);
                else
                    drawSolidGrip(e.Graphics, bounds, vert);
            }
        }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// toolstripgriprendereventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this ToolStripGripRenderEventHandler toolstripgriprendereventhandler, Object sender, ToolStripGripRenderEventArgs e, AsyncCallback callback)
        {
            if(toolstripgriprendereventhandler == null) throw new ArgumentNullException("toolstripgriprendereventhandler");

            return toolstripgriprendereventhandler.BeginInvoke(sender, e, callback, null);
        }
コード例 #37
0
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
        {
            if (e.GripStyle == ToolStripGripStyle.Hidden)
                return;

            var g = e.Graphics;

            using (var img = MenuIcons.grip.SetColor(Colors.LightBorder))
            {
                g.DrawImageUnscaled(img, new Point(e.AffectedBounds.Left, e.AffectedBounds.Top));
            }
        }
コード例 #38
0
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (e.GripStyle == ToolStripGripStyle.Visible)
     {
         Rectangle gripBounds = e.GripBounds;
         bool vertical = e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical;
         ToolStrip toolStrip = e.ToolStrip;
         Graphics g = e.Graphics;
         if (vertical)
         {
             gripBounds.X = e.AffectedBounds.X;
             gripBounds.Width = e.AffectedBounds.Width;
             if (toolStrip is MenuStrip)
             {
                 if (e.AffectedBounds.Height > e.AffectedBounds.Width)
                 {
                     vertical = false;
                     gripBounds.Y = e.AffectedBounds.Y;
                 }
                 else
                 {
                     toolStrip.GripMargin = new Padding(0, 2, 0, 2);
                     gripBounds.Y = e.AffectedBounds.Y;
                     gripBounds.Height = e.AffectedBounds.Height;
                 }
             }
             else
             {
                 toolStrip.GripMargin = new Padding(2, 2, 4, 2);
                 gripBounds.X++;
                 gripBounds.Width++;
             }
         }
         else
         {
             gripBounds.Y = e.AffectedBounds.Y;
             gripBounds.Height = e.AffectedBounds.Height;
         }
         this.DrawDottedGrip(g, gripBounds, vertical, false, this.ColorTable.Back, ControlPaint.Dark(this.ColorTable.Base, 0.3f));
     }
 }
コード例 #39
0
		public void DrawGrip (ToolStripGripRenderEventArgs e)
		{ this.OnRenderGrip (e); }
コード例 #40
0
 // This method handles the RenderGrip event.
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     DrawTitleBar(e.Graphics, new Rectangle(0, 0, e.ToolStrip.Width, 7));
 }
 protected virtual void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     if (this.RendererOverride != null)
     {
         this.RendererOverride.OnRenderGrip(e);
     }
 }
コード例 #42
0
		protected override void OnRenderGrip (ToolStripGripRenderEventArgs e)
		{
			if (e.GripStyle == ToolStripGripStyle.Hidden)
				return;

			if (e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical) {
				Rectangle r = new Rectangle (e.GripBounds.Left, e.GripBounds.Top + 5, 2, 2);

				for (int i = 0; i < e.GripBounds.Height - 12; i += 4) {
					e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.GripLight), r);
					r.Offset (0, 4);
			}

				Rectangle r2 = new Rectangle (e.GripBounds.Left - 1, e.GripBounds.Top + 4, 2, 2);

				for (int i = 0; i < e.GripBounds.Height - 12; i += 4) {
					e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.GripDark), r2);
					r2.Offset (0, 4);
				}
			}
			else {
				Rectangle r = new Rectangle (e.GripBounds.Left + 5, e.GripBounds.Top, 2, 2);

				for (int i = 0; i < e.GripBounds.Width - 11; i += 4) {
					e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.GripLight), r);
					r.Offset (4, 0);
				}

				Rectangle r2 = new Rectangle (e.GripBounds.Left + 4, e.GripBounds.Top - 1, 2, 2);

				for (int i = 0; i < e.GripBounds.Width - 11; i += 4) {
					e.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (this.ColorTable.GripDark), r2);
					r2.Offset (4, 0);
				}
			}

			base.OnRenderGrip (e);
		}
コード例 #43
0
 // This method handles the RenderGrip event.
 protected override void OnRenderGrip(ToolStripGripRenderEventArgs e)
 {
     DrawTitleBar(e.Graphics, new Rectangle(0, 0, e.ToolStrip.Width, 7));
 }
コード例 #44
0
        /// <include file='doc\ToolStripRenderer.uex' path='docs/doc[@for="ToolStripRenderer.OnRenderGrip"]/*' />
        /// <devdoc>
        /// Draw the grip.  ToolStrip users should override this if they want to draw differently.
        /// </devdoc>
        protected override void OnRenderGrip(ToolStripGripRenderEventArgs e) {
            
            Graphics g = e.Graphics;
            Rectangle bounds = new Rectangle(Point.Empty, e.GripBounds.Size);
            bool verticalGrip = e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical;
               
            if (ToolStripManager.VisualStylesEnabled  && VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.Gripper.Normal)) {

                VisualStyleRenderer vsRenderer = VisualStyleRenderer;
        
                if (verticalGrip) {
                    vsRenderer.SetParameters(VisualStyleElement.Rebar.Gripper.Normal);  
                   
                    bounds.Height = ((bounds.Height -2/*number of pixels for border*/) / 4) * 4; // make sure height is an even interval of 4. 
                    bounds.Y = Math.Max(0,(e.GripBounds.Height - bounds.Height -2/*number of pixels for border*/) / 2);
                }
                else {
                    vsRenderer.SetParameters(VisualStyleElement.Rebar.GripperVertical.Normal);    
                }
                vsRenderer.DrawBackground(g, bounds);
            }
            else {
                // do some fixup so that we dont paint from end to end.
                Color backColor = e.ToolStrip.BackColor;
                FillBackground(g, bounds, backColor);

                if (verticalGrip) {
                    if (bounds.Height >= 4) {
                      bounds.Inflate(0,-2);     // scoot down 2PX and start drawing
                    }
                    bounds.Width = 3;
                }
                else {
                    if (bounds.Width >= 4) {
                      bounds.Inflate(-2,0);        // scoot over 2PX and start drawing
                    }
                    bounds.Height = 3;
                }
          
                RenderSmall3DBorderInternal(g, bounds, ToolBarState.Hot, (e.ToolStrip.RightToLeft == RightToLeft.Yes));
               
            }
        }
コード例 #45
0
ファイル: ToolStripRenderer.cs プロジェクト: JianwenSun/cc
 /// <include file='doc\ToolStripRenderer.uex' path='docs/doc[@for="ToolStripRenderer.OnRenderGrip"]/*' />
 /// <devdoc>
 /// Draw the grip.  ToolStrip users should override this if they want to draw differently.
 /// </devdoc>
 protected virtual void OnRenderGrip(ToolStripGripRenderEventArgs e) {
     if (RendererOverride != null) {
         RendererOverride.OnRenderGrip(e);
         return;
     }
 }
コード例 #46
0
 public void DrawGrip(ToolStripGripRenderEventArgs e)
 {
     throw null;
 }