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


C# TextFormatFlags类代码示例

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


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


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