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


C# Forms.ToolStripItemTextRenderEventArgs类代码示例

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


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

示例1: OnRenderItemTextNew

 //Modification of original OnRenderItemText to allow color to be set even if the control is disabled
 protected void OnRenderItemTextNew(ToolStripItemTextRenderEventArgs e)
 {
     Graphics dc = e.Graphics;
         Color textColor = e.TextColor;
         Font textFont = e.TextFont;
         string text = e.Text;
         Rectangle textRectangle = e.TextRectangle;
         TextFormatFlags textFormat = e.TextFormat;
         //textColor = item.Enabled ? textColor : SystemColors.GrayText;
         if (((e.TextDirection != ToolStripTextDirection.Horizontal) && (textRectangle.Width > 0)) && (textRectangle.Height > 0))
         {
             Size size = /*LayoutUtils.FlipSize(*/textRectangle.Size/*)*/;
             using (Bitmap bitmap = new Bitmap(size.Width, size.Height, PixelFormat.Format32bppPArgb))
             {
                 using (Graphics graphics2 = Graphics.FromImage(bitmap))
                 {
                     graphics2.TextRenderingHint = TextRenderingHint.AntiAlias;
                     TextRenderer.DrawText(graphics2, text, textFont, new Rectangle(Point.Empty, size), textColor, textFormat);
                     bitmap.RotateFlip((e.TextDirection == ToolStripTextDirection.Vertical90) ? RotateFlipType.Rotate90FlipNone : RotateFlipType.Rotate270FlipNone);
                     dc.DrawImage(bitmap, textRectangle);
                 }
                 return;
             }
         }
         TextRenderer.DrawText(dc, text, textFont, textRectangle, textColor, textFormat);
 }
开发者ID:sp1ke77,项目名称:inSSIDer-2,代码行数:27,代码来源:GrayToolStripRenderer.cs

示例2: OnRenderItemText

 protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
 {
     Rectangle textRectangle = e.TextRectangle;
     if (((e.ToolStrip is ToolStripDropDown) && (e.Item is ToolStripMenuItem)) && (textRectangle.Left < 40))
     {
         textRectangle = Rectangle.FromLTRB(0x18, textRectangle.Top, textRectangle.Right, textRectangle.Bottom);
     }
     if (!e.Item.Enabled)
     {
         textRectangle.Offset(1, 1);
         TextRenderer.DrawText(e.Graphics, e.Text, e.TextFont, textRectangle, SystemColors.ControlLightLight, e.TextFormat);
         textRectangle.Offset(-1, -1);
         TextRenderer.DrawText(e.Graphics, e.Text, e.TextFont, textRectangle, SystemColors.GrayText, e.TextFormat);
     }
     else
     {
         ToolStripSplitButton button = e.Item as ToolStripSplitButton;
         if (!((e.Item is ToolStripMenuItem) || !((button != null) ? button.ButtonPressed : e.Item.Pressed)))
         {
             textRectangle.Offset(1, 1);
         }
         e.TextRectangle = textRectangle;
         ToolStripMenuItem item = e.Item as ToolStripMenuItem;
         if ((item != null) && (item.Selected || item.DropDown.Visible))
         {
             e.TextColor = SystemColors.HighlightText;
         }
         base.OnRenderItemText(e);
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:30,代码来源:ToolStripFlatRenderer.cs

示例3: OnRenderItemText

        /// <summary>
        /// Raises the RenderItemText event.
        /// </summary>
        /// <param name="e">A ToolStripItemTextRenderEventArgs that contains the event data.</param>
        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
        {
			if (ColorTable.UseSystemColors == false)
			{
				ProfessionalColorTable colorTable = ColorTable as XiaoCai.WinformUI.Panels.ProfessionalColorTable;
				if (colorTable != null)
				{
					if ((e.ToolStrip is MenuStrip) && (e.Item.Selected == false) && e.Item.Pressed == false)
					{
						if (colorTable.MenuItemText != Color.Empty)
						{
							e.TextColor = colorTable.MenuItemText;
						}
					}
					if ((e.ToolStrip is StatusStrip) && (e.Item.Selected == false) && e.Item.Pressed == false)
					{
						if (colorTable.StatusStripText != Color.Empty)
						{
							e.TextColor = colorTable.StatusStripText;
						}
					}
				}
			}
            base.OnRenderItemText(e);
        }
开发者ID:GarnettLuo,项目名称:XiaoCai.WinformUI,代码行数:29,代码来源:Office2007Renderer.cs

示例4: OnRenderItemText

        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
        {
            if ((e.Item is ToolStripMenuItem) && (e.Item.Selected || e.Item.Pressed))
                e.TextColor = e.Item.ForeColor;

            base.OnRenderItemText(e);
        }
开发者ID:JamesLinus,项目名称:sharpshell,代码行数:7,代码来源:ToolStripRenderers.cs

示例5: OnRenderItemText

 protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) {
     if(fNoPrefix) {
         e.TextFormat |= TextFormatFlags.NoPrefix;
     }
     e.TextColor = e.Item.Selected ? SystemColors.HighlightText : SystemColors.MenuText;
     base.OnRenderItemText(e);
 }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:7,代码来源:XPMenuRenderer.cs

示例6: OnRenderItemText

        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
        {
            ToolStripStatusLabel label = e.Item as ToolStripStatusLabel;

            // It's not a label, panic, wait no; just let the SystemRenderer do it's thing
            if (label == null)
            {
                base.OnRenderItemText(e);
                return;
            }

            // If we are rendering a link we don't support AutoEllipsie
            if (label.IsLink)
            {
                base.OnRenderItemText(e);
                return;
            }

            TextRenderer.DrawText(e.Graphics,
                label.Text,
                label.Font,
                e.TextRectangle,
                label.ForeColor,
                TextFormatFlags.EndEllipsis);
        }
开发者ID:wow4all,项目名称:evemu_server,代码行数:25,代码来源:AutoEllipsisToolStripRenderer.cs

示例7: OnRenderItemText

		protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
		{
			// Without this, the ToolStrip renderer leaves some border artifacts
			// even when the style is set to "no border".
			e.SizeTextRectangleToText();
			base.OnRenderItemText(e);
		}
开发者ID:unieagle,项目名称:libpalaso,代码行数:7,代码来源:ToolStripExtensions.cs

示例8: OnRenderItemText

 protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
 {
     Tab item = e.Item as Tab;
     if (item != null)
     {
         e.TextRectangle = e.Item.ContentRectangle;
         e.TextFormat |= TextFormatFlags.EndEllipsis;
         if (item.Pressed)
         {
             Rectangle textRectangle = e.TextRectangle;
             textRectangle.Offset(-1, -1);
             e.TextRectangle = textRectangle;
         }
         if (!((item.Checked || e.Item.IsForeColorSet()) || e.ToolStrip.IsForeColorSet()))
         {
             e.TextColor = SystemColors.GrayText;
         }
         if (item.Checked && !e.TextFont.Bold)
         {
             using (e.TextFont = new Font(e.TextFont, FontStyle.Bold))
             {
                 if (TextRenderer.MeasureText(e.Graphics, e.Text, e.TextFont).Width <= e.TextRectangle.Width)
                 {
                     e.TextFormat &= ~TextFormatFlags.EndEllipsis;
                 }
                 base.OnRenderItemText(e);
             }
             return;
         }
     }
     base.OnRenderItemText(e);
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:32,代码来源:TabStripVS2k3Renderer.cs

示例9: OnRenderItemText

            protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
            {
                var helper = new GraphicsHelper(e.Graphics);
                var button = e.Item as ToolStripButton;

                var shadow = new Rectangle(
                    e.TextRectangle.X + 1,
                    e.TextRectangle.Y + 1,
                    e.TextRectangle.Width,
                    e.TextRectangle.Height);

                uint shadowColor = UColor.Blend(0xdd, UColor.White);
                uint textColor = e.TextColor.ToUInt();

                if (e.Item.Selected || e.Item.Pressed || (button != null && button.Checked))
                {
                    shadowColor = UColor.Blend(0x7a, UColor.Black);
                    textColor = UColor.White;
                }

                var format = new StringFormat();
                format.LineAlignment = StringAlignment.Center;
                format.Alignment = StringAlignment.Near;

                helper.Text(e.Text, e.TextFont, shadowColor, shadow, format);
                helper.Text(e.Text, e.TextFont, textColor, e.TextRectangle, format);
            }
开发者ID:matheus2984,项目名称:SoulEngine,代码行数:27,代码来源:Menu.cs

示例10: OnRenderItemText

 protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
 {
     // In the case the renderer is used for a control sitting on an Aero glass window (Vista+)
       // we have to draw the text manually, as it would appear semi-transparently otherwise.
       Color color = Color.FromArgb(255, e.TextColor.R, e.TextColor.G, e.TextColor.B);
       using (SolidBrush brush = new SolidBrush(color))
     e.Graphics.DrawString(e.Text, e.TextFont, brush, e.TextRectangle);
 }
开发者ID:abibell,项目名称:mysql-workbench,代码行数:8,代码来源:WbToolStripRenderers.cs

示例11: OnRenderItemText

 protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
 {
     //e.TextFormat = TextFormatFlags.Left | TextFormatFlags.VerticalCenter;
     if (e.Item.Enabled)
         e.TextColor = Color.Black;
     else
         e.TextColor = Color.Gray;
     base.OnRenderItemText(e);
 }
开发者ID:schultzisaiah,项目名称:just-gestures,代码行数:9,代码来源:MyContextMenuRenderer.cs

示例12: OnRenderItemText

		protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
		{
			if (e.Item.Selected)
			{
				e.TextColor = Color.FromArgb(255, 223, 127);
			}

			base.OnRenderItemText(e);
		}
开发者ID:ehershey,项目名称:development,代码行数:9,代码来源:CustomToolStrip.cs

示例13: OnRenderItemText

        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
        {
            //if (e.Item.Bounds.Contains(e.ToolStrip.PointToClient(Cursor.Position)))
            e.TextColor = Color.White;
            /*if (e.Item is ToolStripMenuItem)
                e.TextColor = Color.Black;*/

            base.OnRenderItemText(e);
        }
开发者ID:mkoscak,项目名称:kv-validator,代码行数:9,代码来源:OpsToolRenderer.cs

示例14: OnRenderItemText

        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
        {
            if (e.Item.Selected && e.Item.Pressed == false)
                e.TextColor = MetroUI.Style.AccentFrontColor;
            else
                e.TextColor = MetroUI.Style.ForeColor;

            base.OnRenderItemText(e);
        }
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:9,代码来源:metroToolStripRenderer.cs

示例15: OnRenderItemText

        protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
        {
            if (e.Item is ToolStripLabel)
            {
                e.TextRectangle = new Rectangle(e.TextRectangle.X + 5, e.TextRectangle.Y, e.Item.Bounds.Width - 5, e.TextRectangle.Height);
                base.OnRenderItemText(e);
                return;
            }

            var text = e.Text;
            var font = e.TextFont;
            var rect = e.TextRectangle;
            var format = e.TextFormat;

            // symbol 0x25CF
            var iconCol = MyColors.LeftToolGray;
            if (e.Item.Tag != null && e.Item.Tag is Color)
                iconCol = (Color)e.Item.Tag;
            e.TextColor = iconCol;
            e.TextFont = new Font(e.TextFont.FontFamily, 18);
            e.Text = Common.theSign;
            e.TextFormat = TextFormatFlags.NoPadding | TextFormatFlags.Left;
            e.TextRectangle = new Rectangle(e.TextRectangle.X, 2, 40, 40);
            base.OnRenderItemText(e);

            // render textu
            e.Text = text;
            e.TextFont = new Font(font, FontStyle.Bold);
            e.TextRectangle = rect;
            e.TextFormat = format;
            e.TextColor = Color.White;
            e.TextRectangle = new Rectangle(e.TextRectangle.X + 25, e.TextRectangle.Y, e.Item.Bounds.Width - 25, e.TextRectangle.Height);
            var index = text.LastIndexOf('.');
            if (index == -1)
            {
                // polozka bez poctu..
                base.OnRenderItemText(e);
                return;
            }

            // text polozky
            var title = text.Substring(0, index + 1);
            e.TextColor = Color.White;
            e.Text = title;
            base.OnRenderItemText(e);

            // pocet poloziek
            var count = "0";
            if (text.Contains(' '))
                count = text.Substring(text.IndexOf(' ') + 1).Trim('(', ')');
            e.Text = count;
            e.TextFont = font;
            e.TextColor = MyColors.LeftToolGray;
            e.TextFormat = TextFormatFlags.NoPadding | TextFormatFlags.Right;
            e.TextRectangle = new Rectangle(e.TextRectangle.X, e.TextRectangle.Y, e.Item.Bounds.Width - e.TextRectangle.X - 10, e.TextRectangle.Height);
            base.OnRenderItemText(e);
        }
开发者ID:mkoscak,项目名称:kv-validator,代码行数:57,代码来源:ToolRenderer.cs


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