当前位置: 首页>>代码示例>>C#>>正文


C# Forms.ToolStripItemRenderEventArgs类代码示例

本文整理汇总了C#中System.Windows.Forms.ToolStripItemRenderEventArgs的典型用法代码示例。如果您正苦于以下问题:C# ToolStripItemRenderEventArgs类的具体用法?C# ToolStripItemRenderEventArgs怎么用?C# ToolStripItemRenderEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ToolStripItemRenderEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了ToolStripItemRenderEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnRenderMenuItemBackground

        protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
        {
            ToolStripItem tsi = ((e != null) ? e.Item : null);

            if((tsi != null) && ((tsi.Owner is ContextMenuStrip) ||
                (tsi.OwnerItem != null)) && tsi.Selected)
            {
                Rectangle rect = tsi.ContentRectangle;
                rect.Offset(0, -1);
                rect.Height += 1;

                Color clrStart = KeePassTsrColorTable.StartGradient(this.ColorTable.MenuItemSelected);
                Color clrEnd = KeePassTsrColorTable.EndGradient(this.ColorTable.MenuItemSelected);
                Color clrBorder = this.ColorTable.MenuItemBorder;

                if(!tsi.Enabled)
                {
                    Color clrBase = this.ColorTable.MenuStripGradientEnd;
                    clrStart = UIUtil.ColorTowardsGrayscale(clrStart, clrBase, 0.5);
                    clrEnd = UIUtil.ColorTowardsGrayscale(clrEnd, clrBase, 0.2);
                    clrBorder = UIUtil.ColorTowardsGrayscale(clrBorder, clrBase, 0.2);
                }

                Graphics g = e.Graphics;
                if(g != null)
                {
                    LinearGradientBrush br = new LinearGradientBrush(rect,
                        clrStart, clrEnd, LinearGradientMode.Vertical);
                    Pen p = new Pen(clrBorder);

                    SmoothingMode smOrg = g.SmoothingMode;
                    g.SmoothingMode = SmoothingMode.HighQuality;

                    GraphicsPath gp = UIUtil.CreateRoundedRectangle(rect.X, rect.Y,
                        rect.Width, rect.Height, DpiUtil.ScaleIntY(2));
                    if(gp != null)
                    {
                        g.FillPath(br, gp);
                        g.DrawPath(p, gp);

                        gp.Dispose();
                    }
                    else // Shouldn't ever happen...
                    {
                        Debug.Assert(false);
                        g.FillRectangle(br, rect);
                        g.DrawRectangle(p, rect);
                    }

                    g.SmoothingMode = smOrg;

                    p.Dispose();
                    br.Dispose();
                    return;
                }
                else { Debug.Assert(false); }
            }

            base.OnRenderMenuItemBackground(e);
        }
开发者ID:Stoom,项目名称:KeePass,代码行数:60,代码来源:KeePassTsr.cs

示例2: OnRenderButtonBackground

        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            base.OnRenderButtonBackground(e);

            var button = (NavigationButton)e.Item;
            if (button == null)
                return;

            var gradTop = ColorTable.ToolStripPanelGradientBegin;
            var gradBottom = ColorTable.ToolStripPanelGradientBegin;

            if (button.Pressed || button.Checked)
            {
                gradTop = NavigationColourTable.CHECKED_GRADIENT_BEGIN;
                gradBottom = NavigationColourTable.CHECKED_GRADIENT_END;
            }
            else if (button.Selected)//hover
            {
                gradTop = NavigationColourTable.HOVER_GRADIENT_BEGIN;
                gradBottom = NavigationColourTable.HOVER_GRADIENT_END;
            }

            var bounds = new Rectangle(Point.Empty, e.Item.Size);
            var g = e.Graphics;

            DrawItemBackGround(g, bounds, gradTop, gradBottom);

            if (button.Pressed || button.Checked || button.Selected)
                DrawItemBorder(g, bounds);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:30,代码来源:NavigationToolStripRenderer.cs

示例3: OnRenderMenuItemBackground

 /// <summary>
 /// Disables menu item highlighting while mousing over 
 /// a menu item when the app doesn't have focus. 
 /// </summary>
 /// <param name="Args">The event holding the menu item to render.</param>
 protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs Args)
 {
     if ( AppHasFocus() )
     {
         base.OnRenderMenuItemBackground(Args);
     }
 }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:12,代码来源:UnrealToolStripItemRenderer.cs

示例4: OnRenderButtonBackground

        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            base.OnRenderButtonBackground(e);

            ToolStripButton button = e.Item as ToolStripButton;

            if (null != button)
            {
                if (button.Checked)
                {
                    SolidBrush brush = new SolidBrush(_darkHeaderColor);
                    Pen pen = new Pen(_separatorColor);

                    e.Graphics.FillRectangle(brush, 0, 0, button.Width - 1, button.Height - 1);
                    e.Graphics.DrawRectangle(pen, 0, 0, button.Width - 1, button.Height - 1);
                }
                else if (button.Selected)
                {
                    SolidBrush brush = new SolidBrush(_lightHeaderColor);
                    Pen pen = new Pen(_separatorColor);

                    e.Graphics.FillRectangle(brush, 0, 0, button.Width - 1, button.Height - 1);
                    e.Graphics.DrawRectangle(pen, 0, 0, button.Width - 1, button.Height - 1);
                }
            }
        }
开发者ID:sp1ke77,项目名称:inSSIDer-2,代码行数:26,代码来源:GrayToolStripRenderer.cs

示例5: OnRenderMenuItemBackground

 protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
 {
     if (e.Item.Bounds.Contains(e.ToolStrip.PointToClient(Cursor.Position)))
         e.Graphics.FillRectangle(buttonHover, new Rectangle(0, 0, e.Item.Bounds.Width, e.Item.Bounds.Height));
     else
         e.Graphics.FillRectangle(buttonBack, new Rectangle(0, 0, e.Item.Bounds.Width, e.Item.Bounds.Height));
 }
开发者ID:mkoscak,项目名称:kv-validator,代码行数:7,代码来源:OpsToolRenderer.cs

示例6: OnRenderDropDownButtonBackground

 /// <summary>
 /// Disables drop down button highlighting while mousing over 
 /// a drop down button when the app doesn't have focus. 
 /// </summary>
 /// <param name="Args">The event holding the drop down button to render.</param>
 protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs Args)
 {
     if ( AppHasFocus() )
     {
         base.OnRenderDropDownButtonBackground(Args);
     }
 }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:12,代码来源:UnrealToolStripItemRenderer.cs

示例7: OnRenderButtonBackground

        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            base.OnRenderButtonBackground(e);

            var g = e.Graphics;

            var bounds = new Rectangle(Point.Empty, e.Item.Size);

            Color backColor = Color.White;

            var button = e.Item as ToolStripButton;
            // Check button is null value
            if (button == null) return;

            if (button.Pressed || button.Checked)
            {
                backColor = Color.FromArgb(0x4d, 0x4d, 0x4d);
            }
            else if (button.Selected)
            {
                backColor = Color.FromArgb(0xe6, 0xe6, 0xe6);
            }

            using (Brush b = new SolidBrush(backColor))
            {
                g.FillRectangle(b, bounds);
            }
        }
开发者ID:panoti,项目名称:DADHMT_LTW,代码行数:28,代码来源:MetroToolStrip.cs

示例8: OnRenderButtonBackground

        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            TabStrip tabStrip = e.ToolStrip as TabStrip;
            ToolStripButton button = e.Item as ToolStripButton;
            Rectangle bounds = new Rectangle(Point.Empty, e.Item.Size);

            if (tabStrip != null) {
                System.Windows.Forms.VisualStyles.TabItemState tabState = System.Windows.Forms.VisualStyles.TabItemState.Normal;
                if (button.Checked) {
                    tabState |= System.Windows.Forms.VisualStyles.TabItemState.Selected;
                }
                if (button.Selected) {
                    tabState |= System.Windows.Forms.VisualStyles.TabItemState.Hot;
                }

                TabRenderer.DrawTabItem(e.Graphics, bounds, tabState);

                if (button.Checked) {
                    VisualStyleRenderer vsr = new VisualStyleRenderer(VisualStyleElement.Tab.TabItem.Hot);
                    Padding borderPadding = button.Padding;
                    borderPadding.Top += 4;
                    borderPadding.Bottom += 2;
                    borderPadding.Left -= 2;
                    borderPadding.Right -= 2;
                    Rectangle rect = LayoutUtils.DeflateRect(bounds, borderPadding);

                    ControlPaint.DrawFocusRectangle(e.Graphics, rect);
                }
            }
            else {
                base.OnRenderButtonBackground(e);
            }
        }
开发者ID:amedinarcr,项目名称:fop,代码行数:33,代码来源:TabStripSystemRenderer.cs

示例9: OnRenderButtonBackground

        protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
        {
            //base.OnRenderButtonBackground(e);
            ToolStripButton item = e.Item as ToolStripButton;
            Graphics g = e.Graphics;
            Rectangle bounds = new Rectangle(Point.Empty, item.Size);

            if (item.CheckState == CheckState.Checked)
            {
                RenderCheckedButtonFill(bounds, item, g);
            }
            else
            {
                if (item.Selected)
                {
                    RenderSelectedButtonFill(bounds, g);
                }
                else
                {
                    Color fillColor = ThemeColorTable.BackgroundColor;
                    using (Brush b = new SolidBrush(fillColor))
                    {
                        g.FillRectangle(b, bounds);
                    }
                }

            }
        }
开发者ID:jaredb7,项目名称:vixen,代码行数:28,代码来源:ThemeToolStripRenderer.cs

示例10: OnRenderSplitButtonBackground

 protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
 {
     // base.OnRenderSplitButtonBackground(e);
     ToolStripSplitButton item = e.Item as ToolStripSplitButton;
     if (null == item) return;
     e.Graphics.DrawLine(new Pen(Color.Red), item.Bounds.Location, new Point(item.Bounds.Location.X, item.Height));
 }
开发者ID:wenysky,项目名称:deepinsummer,代码行数:7,代码来源:ToolStripRender.cs

示例11: OnRenderMenuItemBackground

        protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
        {
            if (e.Item.Enabled)
            {
                if (e.Item.Selected)
                {
                    //If item is selected
                    Rectangle Rect = new Rectangle(3, 2, e.Item.Width - 5, e.Item.Height - 3);
                    e.Graphics.FillRectangle(new SolidBrush(itemHover), Rect);
                }

                //If item is MenuHeader and menu is dropped down
                if (((ToolStripMenuItem)e.Item).DropDown.Visible && e.Item.IsOnDropDown == false)
                {
                    Rectangle Rect = new Rectangle(3, 2, e.Item.Width - 5, e.Item.Height - 3);
                    e.Graphics.FillRectangle(new SolidBrush(itemSelect), Rect);
                }

                e.Item.ForeColor = itemColor;
            }
            else
            {
                e.Item.ForeColor = bgColor1;
            }

            base.OnRenderMenuItemBackground(e);
        }
开发者ID:PokeD,项目名称:Ohana3DS-Rebirth,代码行数:27,代码来源:OMenuStrip.cs

示例12: OnRenderMenuItemBackground

        protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
        {
            if (e.Item.Selected)
            {
                Graphics g = e.Graphics;
                g.SmoothingMode = SmoothingMode.HighQuality;
                GraphicsPath pa = new GraphicsPath();
                Rectangle rect = new Rectangle(2, 1, (int)e.Item.Size.Width - 2, e.Item.Size.Height-1);
                DrawArc(rect, pa);
                LinearGradientBrush lgbrush = new LinearGradientBrush(rect, Color.White, Color.White, LinearGradientMode.Vertical);

                float[] pos = new float[4];
                pos[0] = 0.0F; pos[1] = 0.4F; pos[2] = 0.45F; pos[3] = 1.0F;
                Color[] colors = new Color[4];
                colors[0] = GetColor(0, 50, 100);
                colors[1] = GetColor(0, 0, 30);
                colors[2] = Color.FromArgb(R0, G0, B0);
                colors[3] = GetColor(0, 50, 100);

                ColorBlend mix = new ColorBlend();
                mix.Colors = colors;
                mix.Positions = pos;
                lgbrush.InterpolationColors = mix;
                g.FillPath(lgbrush, pa);
                g.DrawPath(new Pen(StrokeColor), pa);
                lgbrush.Dispose();
            }
            else
            {
                base.OnRenderItemBackground(e);
            }
        }
开发者ID:calvinkwong,项目名称:pol-the-game,代码行数:32,代码来源:RibbonMenuRenderer.cs

示例13: OnRenderButtonBackground

		protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
		{
			if (!(e.Item.Selected))
			{
				base.OnRenderButtonBackground(e);
			}
		}
开发者ID:ehershey,项目名称:development,代码行数:7,代码来源:CustomToolStrip.cs

示例14: OnRenderMenuItemBackground

 /// <summary>  
 /// 渲染菜单项的背景  
 /// </summary>  
 /// <param name="e"></param>  
 protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
 {
     if (e.ToolStrip is MenuStrip)
     {
         //如果被选中或被按下
         if (e.Item.Selected || e.Item.Pressed)
         {
             Blend blend = new Blend();
             float[] fs = new float[5] { 0f, 0.3f, 0.5f, 0.8f, 1f };
             float[] f = new float[5] { 0f, 0.5f, 1f, 0.5f, 0f };
             blend.Positions = fs;
             blend.Factors = f;
             FillLineGradient(e.Graphics, new Rectangle(0, 0, e.Item.Size.Width, e.Item.Size.Height),
                 e.Item.Pressed ? colorconfig.DropDownItemBackColor : colorconfig.MenuItemStartColor,
                 e.Item.Pressed ? colorconfig.DropDownItemBackColor : colorconfig.MenuItemEndColor,
                 90f, blend);
         }
         else
             base.OnRenderMenuItemBackground(e);
     }
     else if (e.ToolStrip is ToolStripDropDown)
     {
         if (e.Item.Selected)
         {
             FillLineGradient(e.Graphics, new Rectangle(2, 2, e.Item.Size.Width-4, e.Item.Size.Height-4), colorconfig.DropDownItemStartColor, colorconfig.DropDownItemEndColor, 90f, null);
         }
     }
     else
     {
         base.OnRenderMenuItemBackground(e);
     }
 }
开发者ID:kinghand,项目名称:KHGraphDB,代码行数:36,代码来源:MenuRender.cs

示例15: OnRenderOverflowButtonBackground

        protected override void OnRenderOverflowButtonBackground(ToolStripItemRenderEventArgs e)
        {
            Brush triangleBrush = new SolidBrush(Color.Black);
            Point2 itemCenter = new Point2(e.Item.Width / 2, e.Item.Height / 2);
            int triangleSize = 2;

            if (e.Item.Pressed)
            {
                e.Graphics.FillRectangle(
                    new SolidBrush(this.ColorTable.ButtonPressedHighlight),
                    1, 1, e.Item.Width - 2, e.Item.Height - 2);
                e.Graphics.DrawRectangle(
                    new Pen(this.ColorTable.ButtonPressedHighlightBorder),
                    1, 1, e.Item.Width - 3, e.Item.Height - 3);
            }
            else if (e.Item.Selected)
            {
                e.Graphics.FillRectangle(
                    new SolidBrush(this.ColorTable.ButtonSelectedHighlight),
                    1, 1, e.Item.Width - 2, e.Item.Height - 2);
                e.Graphics.DrawRectangle(
                    new Pen(this.ColorTable.ButtonSelectedHighlightBorder),
                    1, 1, e.Item.Width - 3, e.Item.Height - 3);
            }

            e.Graphics.FillPolygon(triangleBrush, new Point[] {
                new Point(itemCenter.X - triangleSize, (e.Item.Height * 3 / 4) - triangleSize),
                new Point(itemCenter.X + triangleSize + 1, (e.Item.Height * 3 / 4) - triangleSize),
                new Point(itemCenter.X, (e.Item.Height * 3 / 4) + (triangleSize / 2))});
        }
开发者ID:ChrisLakeZA,项目名称:duality,代码行数:30,代码来源:DualitorToolStripRenderer.cs


注:本文中的System.Windows.Forms.ToolStripItemRenderEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。