當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。