• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TextFormatFlags类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: TextViewDialog

 public TextViewDialog()
 {
     InitializeComponent();
     this.sf = new StringFormat(StringFormat.GenericTypographic);
     sf.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
     tf = TextFormatFlags.NoPadding | TextFormatFlags.GlyphOverhangPadding;
 }
开发者ID:nemerle,项目名称:reko,代码行数:7,代码来源:TextViewDialog.cs


示例2: DrawText

 public void DrawText(TextFormatFlags flags)
 {
     string text = this.header.Text;
     int width = TextRenderer.MeasureText(" ", this.font).Width;
     Rectangle bounds = Rectangle.Inflate(this.bounds, -width, 0);
     TextRenderer.DrawText(this.graphics, text, this.font, bounds, this.foreColor, flags);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:DrawListViewColumnHeaderEventArgs.cs


示例3: DrawButton

		public static void DrawButton (Graphics g, Rectangle bounds, string buttonText, Font font, TextFormatFlags flags, Image image, Rectangle imageBounds, bool focused, PushButtonState state)
		{
			if (Application.RenderWithVisualStyles || always_use_visual_styles == true) {
				VisualStyleRenderer vsr = GetPushButtonRenderer (state);

				vsr.DrawBackground (g, bounds);

				if (image != null)
					vsr.DrawImage (g, imageBounds, image);
			} else {
				if (state == PushButtonState.Pressed)
					ControlPaint.DrawButton (g, bounds, ButtonState.Pushed);
				else
					ControlPaint.DrawButton (g, bounds, ButtonState.Normal);

				if (image != null)
					g.DrawImage (image, imageBounds);
			}

			Rectangle focus_rect = bounds;
			focus_rect.Inflate (-3, -3);

			if (focused)
				ControlPaint.DrawFocusRectangle (g, focus_rect);

			if (buttonText != String.Empty)
				if (state == PushButtonState.Disabled)
					TextRenderer.DrawText (g, buttonText, font, focus_rect, SystemColors.GrayText, flags);
				else
					TextRenderer.DrawText (g, buttonText, font, focus_rect, SystemColors.ControlText, flags);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:31,代码来源:ButtonRenderer.cs


示例4: CreateWithGlow

		public static ThemedText CreateWithGlow(Graphics g, string text, Font font, Padding internalBounds,
			Rectangle bounds, Color color, TextFormatFlags formatFlags, int glowSize) {

			return Create(g, text, font, internalBounds, bounds, color, formatFlags,
				new IThemeTextOption[] { new GlowOption(glowSize) }
			);
		}
开发者ID:ccasalicchio,项目名称:Cassini-Original-Project,代码行数:7,代码来源:ThemedTextCreate.cs


示例5: CalendarRendererBoxEventArgs

 public CalendarRendererBoxEventArgs(CalendarRendererEventArgs original, Rectangle bounds, string text, TextFormatFlags flags)
     : this(original)
 {
     Bounds = bounds;
     Text = text;
     Format |= flags;
 }
开发者ID:StephOfPixVert,项目名称:PlanningLab,代码行数:7,代码来源:CalendarRendererBoxEventArgs.cs


示例6: ButtonBase

		protected ButtonBase() : base()
		{
			flat_style	= FlatStyle.Standard;
			flat_button_appearance = new FlatButtonAppearance (this);
			this.image_key = string.Empty;
			this.text_image_relation = TextImageRelation.Overlay;
			this.use_mnemonic = true;
			use_visual_style_back_color = true;
			image_index	= -1;
			image		= null;
			image_list	= null;
			image_alignment	= ContentAlignment.MiddleCenter;
			ImeMode         = ImeMode.Disable;
			text_alignment	= ContentAlignment.MiddleCenter;
			is_default	= false;
			is_pressed	= false;
			text_format	= new StringFormat();
			text_format.Alignment = StringAlignment.Center;
			text_format.LineAlignment = StringAlignment.Center;
			text_format.HotkeyPrefix = HotkeyPrefix.Show;
			text_format.FormatFlags |= StringFormatFlags.LineLimit;

			text_format_flags = TextFormatFlags.HorizontalCenter;
			text_format_flags |= TextFormatFlags.VerticalCenter;
			text_format_flags |= TextFormatFlags.TextBoxControl;

			SetStyle (ControlStyles.ResizeRedraw | 
				ControlStyles.Opaque | 
				ControlStyles.UserMouse | 
				ControlStyles.SupportsTransparentBackColor | 
				ControlStyles.CacheText |
				ControlStyles.OptimizedDoubleBuffer, true);
			SetStyle (ControlStyles.StandardClick, false);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:34,代码来源:ButtonBase.cs


示例7: CanvasText

 /// <summary>
 /// Initialises a new instance of the <see cref="CanvasText"/> class.
 /// </summary>
 public CanvasText()
     : base(CanvasItemLayout.ItemType.Component)
 {
     _stringFormat = TextFormatFlags.SingleLine | TextFormatFlags.WordEllipsis | TextFormatFlags.NoPadding | TextFormatFlags.Top | TextFormatFlags.NoPrefix;
     Alignment = CanvasTextAlign.Middle;
     Font = CanvasItemLayout.DefaultFont;
 }
开发者ID:cixonline,项目名称:cixreader,代码行数:10,代码来源:CanvasText.cs


示例8: DrawTextBox

 public static void DrawTextBox(Graphics g, Rectangle bounds, string textBoxText, Font font, TextFormatFlags flags, TextBoxState state)
 {
     InitializeRenderer((int) state);
     Rectangle backgroundContentRectangle = visualStyleRenderer.GetBackgroundContentRectangle(g, bounds);
     backgroundContentRectangle.Inflate(-2, -2);
     DrawTextBox(g, bounds, textBoxText, font, backgroundContentRectangle, flags, state);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:TextBoxRenderer.cs


示例9: Update

		public void Update(Graphics g, string text, Font font, Padding internalBounds,
			Rectangle bounds, Color color, TextFormatFlags formatFlags, IThemeTextOption[] options) {

			IntPtr compatHdc = this._TextHDC;

			if (bounds.Equals(_TextHDCBounds)) {
				//Same bounds, reuse HDC and Clear it
				IntPtr hClearBrush = Native.GDI.CreateSolidBrush(ColorTranslator.ToWin32(Color.Black));
				Native.RECT cleanRect = new Native.RECT(bounds);
				Native.GDI.FillRect(compatHdc, ref cleanRect, hClearBrush);
				Native.GDI.DeleteObject(hClearBrush);
			}
			else {
				//Other bounds, create new HDC
				IntPtr outputHdc = g.GetHdc();
				IntPtr DIB;
				compatHdc = CreateNewHDC(outputHdc, bounds, out DIB);

				//Store new data
				_TextHDC = compatHdc;
				_TextHDCBounds = bounds;

				//Clear up
				CleanUpHDC(DIB);
				g.ReleaseHdc(outputHdc);
			}

			DrawOnHDC(compatHdc, text, font, internalBounds, bounds, color, formatFlags, options);
		}
开发者ID:ccasalicchio,项目名称:Cassini-Original-Project,代码行数:29,代码来源:ThemedTextCreate.cs


示例10: DrawnText

 public DrawnText(String text, Font font, Rectangle rect, Color color, TextFormatFlags tf)
 {
     this.text = text;
     this.font = font;
     this.rectangle = rect;
     this.color = color;
     this.tf = tf;
 }
开发者ID:ExVision,项目名称:ISSA_2014_Gruppe1,代码行数:8,代码来源:DrawnText.cs


示例11: UxThemeDrawThemeText

		public int UxThemeDrawThemeText (IntPtr hTheme, IDeviceContext dc, int iPartId, int iStateId, string text, TextFormatFlags textFlags, Rectangle bounds)
		{
			XplatUIWin32.RECT BoundsRect = XplatUIWin32.RECT.FromRectangle (bounds);

			int result = UXTheme.DrawThemeText (hTheme, dc.GetHdc (), iPartId, iStateId, text, text.Length, (uint)textFlags, 0, ref BoundsRect);
			dc.ReleaseHdc ();
			return result;
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:8,代码来源:VisualStylesNative.cs


示例12: DrawCheckBox

		public static void DrawCheckBox (Graphics g, Point glyphLocation, Rectangle textBounds, string checkBoxText, Font font, TextFormatFlags flags, Image image, Rectangle imageBounds, bool focused, CheckBoxState state)
		{
			Rectangle bounds = new Rectangle (glyphLocation, GetGlyphSize (g, state));

			if (Application.RenderWithVisualStyles || always_use_visual_styles == true) {
				VisualStyleRenderer vsr = GetCheckBoxRenderer (state);

				vsr.DrawBackground (g, bounds);

				if (image != null)
					vsr.DrawImage (g, imageBounds, image);

				if (focused)
					ControlPaint.DrawFocusRectangle (g, textBounds);

				if (checkBoxText != String.Empty)
					if (state == CheckBoxState.CheckedDisabled || state == CheckBoxState.MixedDisabled || state == CheckBoxState.UncheckedDisabled)
						TextRenderer.DrawText (g, checkBoxText, font, textBounds, SystemColors.GrayText, flags);
					else
						TextRenderer.DrawText (g, checkBoxText, font, textBounds, SystemColors.ControlText, flags);
			} else {
				switch (state) {
					case CheckBoxState.CheckedDisabled:
					case CheckBoxState.MixedDisabled:
					case CheckBoxState.MixedPressed:
						ControlPaint.DrawCheckBox (g, bounds, ButtonState.Inactive | ButtonState.Checked);
						break;
					case CheckBoxState.CheckedHot:
					case CheckBoxState.CheckedNormal:
						ControlPaint.DrawCheckBox (g, bounds, ButtonState.Checked);
						break;
					case CheckBoxState.CheckedPressed:
						ControlPaint.DrawCheckBox (g, bounds, ButtonState.Pushed | ButtonState.Checked);
						break;
					case CheckBoxState.MixedHot:
					case CheckBoxState.MixedNormal:
						ControlPaint.DrawMixedCheckBox (g, bounds, ButtonState.Checked);
						break;
					case CheckBoxState.UncheckedDisabled:
					case CheckBoxState.UncheckedPressed:
						ControlPaint.DrawCheckBox (g, bounds, ButtonState.Inactive);
						break;
					case CheckBoxState.UncheckedHot:
					case CheckBoxState.UncheckedNormal:
						ControlPaint.DrawCheckBox (g, bounds, ButtonState.Normal);
						break;
				}

				if (image != null)
					g.DrawImage (image, imageBounds);

				if (focused)
					ControlPaint.DrawFocusRectangle (g, textBounds);

				if (checkBoxText != String.Empty)
					TextRenderer.DrawText (g, checkBoxText, font, textBounds, SystemColors.ControlText, flags);
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:58,代码来源:CheckBoxRenderer.cs


示例13: WindowsGraphicsWrapper

        public WindowsGraphicsWrapper( IDeviceContext idc, TextFormatFlags flags)
        {
            if( idc is Graphics )
            {
                ApplyGraphicsProperties properties = ApplyGraphicsProperties.None;

                if( (flags & TextFormatFlags.PreserveGraphicsClipping) != 0)
                {
                    properties |= ApplyGraphicsProperties.Clipping;
                }

                if( (flags & TextFormatFlags.PreserveGraphicsTranslateTransform) != 0)
                {
                    properties |= ApplyGraphicsProperties.TranslateTransform;
                }

                // Create the WindowsGraphics from the Grahpics object only if Graphics properties need
                // to be reapplied to the DC wrapped by the WindowsGraphics.
                if( properties != ApplyGraphicsProperties.None )
                {
                    this.wg = WindowsGraphics.FromGraphics( idc as Graphics, properties);
                }
            }
            else
            {
                // If passed-in IDeviceContext object is a WindowsGraphics we can use it directly.
                this.wg = idc as WindowsGraphics;

                if( this.wg != null )
                {
                    // In this case we cache the idc to compare it against the wg in the Dispose method to avoid
                    // disposing of the wg.
                    this.idc = idc;
                }
            }

            if( this.wg == null )
            {
                // The IDeviceContext object is not a WindowsGraphics, or it is a custom IDeviceContext, or
                // it is a Graphics object but we did not need to re-apply Graphics propertiesto the hdc.  
                // So create the WindowsGraphics from the hdc directly. 
                // Cache the IDC so the hdc can be released on dispose.
                this.idc = idc;
                this.wg = WindowsGraphics.FromHdc( idc.GetHdc() );
            }

            // Set text padding on the WindowsGraphics (if any).
            if( (flags & TextFormatFlags.LeftAndRightPadding) != 0 )
            {
                wg.TextPadding = TextPaddingOptions.LeftAndRightPadding;
            }
            else if ((flags & TextFormatFlags.NoPadding) != 0 )
            {
                wg.TextPadding = TextPaddingOptions.NoPadding;
            }
            // else wg.TextPadding = TextPaddingOptions.GlyphOverhangPadding - the default value.
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:57,代码来源:WindowsGraphicsWrapper.cs


示例14: DrawText

 public void DrawText(TextFormatFlags flags)
 {
     string text = (this.itemIndex == -1) ? this.item.Text : this.subItem.Text;
     Font font = (this.itemIndex == -1) ? this.item.Font : this.subItem.Font;
     Color foreColor = (this.itemIndex == -1) ? this.item.ForeColor : this.subItem.ForeColor;
     int width = TextRenderer.MeasureText(" ", font).Width;
     Rectangle bounds = Rectangle.Inflate(this.bounds, -width, 0);
     TextRenderer.DrawText(this.graphics, text, font, bounds, foreColor, flags);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:DrawListViewSubItemEventArgs.cs


示例15: InstantiateNew

 private void InstantiateNew(string text, Font font,
     Color foreColor, Color backColor, TextFormatFlags flags)
 {
     _text = text;
     _font = font;
     _foreColor = foreColor;
     _backColor = backColor;
     _flags = flags;
 }
开发者ID:Isthimius,项目名称:Gondwana,代码行数:9,代码来源:Text.cs


示例16: TextPart

 public TextPart(XmlElement element, ChatMessagePart parent = null, Font font = null)
     : base(parent, font)
 {
     stf = StringFormat.GenericTypographic;
     stf.FormatFlags |= StringFormatFlags.NoClip;
     formatFlags = TextFormatFlags.Default | TextFormatFlags.TextBoxControl | TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix | TextFormatFlags.NoClipping;
     Text = XML = element.InnerText;
     PreParse(element);
     InitText();
 }
开发者ID:jvbsl,项目名称:LiveCodingChat,代码行数:10,代码来源:TextPart.cs


示例17: ToolStripItemTextRenderEventArgs

        /// <include file='doc\ToolStripItemTextRenderEventArgs.uex' path='docs/doc[@for="ToolStripItemTextRenderEventArgs.ToolStripItemTextRenderEventArgs"]/*' />
        /// <devdoc>
        /// This class represents all the information to render the winbar
        /// </devdoc>
        public ToolStripItemTextRenderEventArgs(Graphics g, ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, TextFormatFlags format) : base(g, item) {
            this.text = text;
            this.textRectangle = textRectangle;
            this.defaultTextColor = textColor;
            this.textFont = textFont;
            this.textAlignment = item.TextAlign;
            this.textFormat = format;
            textDirection = item.TextDirection;

        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:ToolStripItemTextRenderEventArgs.cs


示例18: TipText

    public TipText(Graphics graphics, Font font, string text)
      : base(graphics)
    {
      if (text != null && text.Length > short.MaxValue)
        throw new ArgumentException("TipText: text too long (max. is " + short.MaxValue + " characters)", "text");

      tipFont = font; tipText = text;
      Color = SystemColors.InfoText;
      textFormatFlags = TextFormatFlags.Default;
    }
开发者ID:sanyaade-fintechnology,项目名称:SquareOne,代码行数:10,代码来源:TipText.cs


示例19: MirLabel

        public MirLabel()
        {
            DrawControlTexture = true;
            _drawFormat = TextFormatFlags.WordBreak;

            _font = new Font(Settings.FontName, 8F);
            _outLine = true;
            _outLineColour = Color.Black;
            _text = string.Empty;
        }
开发者ID:quttap,项目名称:mir2,代码行数:10,代码来源:MirLabel.cs


示例20: DrawGroupBox

 public static void DrawGroupBox(Graphics g, Rectangle bounds, string groupBoxText, Font font, Color textColor, TextFormatFlags flags, GroupBoxState state)
 {
     if (RenderWithVisualStyles)
     {
         DrawThemedGroupBoxWithText(g, bounds, groupBoxText, font, textColor, flags, state);
     }
     else
     {
         DrawUnthemedGroupBoxWithText(g, bounds, groupBoxText, font, textColor, flags, state);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:GroupBoxRenderer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TextGenerator类代码示例发布时间:2022-05-24
下一篇:
C# TextFormat类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap