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


C# StringFormat.GetTabStops方法代码示例

本文整理汇总了C#中System.Drawing.StringFormat.GetTabStops方法的典型用法代码示例。如果您正苦于以下问题:C# StringFormat.GetTabStops方法的具体用法?C# StringFormat.GetTabStops怎么用?C# StringFormat.GetTabStops使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.StringFormat的用法示例。


在下文中一共展示了StringFormat.GetTabStops方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: saveStringFormat

		internal void saveStringFormat(StringFormat sf)
		{
			if (sf == null)
			{
				writer.Write((int)0);
				return;
			}
			writer.Write((int)1);

			StringAlignment al;
			int dsl;
			StringDigitSubstitute dsm;
			StringFormatFlags sff;
			System.Drawing.Text.HotkeyPrefix hp;
			StringAlignment lal;
			StringTrimming tr;
			float fto;
			float[] ts;

			al = sf.Alignment;
			dsl = sf.DigitSubstitutionLanguage;
			dsm = sf.DigitSubstitutionMethod;
			sff = sf.FormatFlags;
			hp = sf.HotkeyPrefix;
			lal = sf.LineAlignment;
			tr = sf.Trimming;
			ts = sf.GetTabStops(out fto);

			writer.Write((int)al);
			writer.Write(dsl);
			writer.Write((int)dsm);
			writer.Write((int)sff);
			writer.Write((int)hp);
			writer.Write((int)lal);
			writer.Write((int)tr);
			writer.Write((double)fto);
			writer.Write(ts.GetLength(0));
			foreach (float f in ts)
				writer.Write((double)f);
		}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:40,代码来源:PersistContext.cs

示例2: TabsStops

		public void TabsStops() 
		{
			using (StringFormat smf = new StringFormat ()) {
				float firstTabOffset;
				float[] tabsSrc = { 100, 200, 300, 400 };
				float[] tabStops;

				smf.SetTabStops (200, tabsSrc);
				tabStops = smf.GetTabStops (out firstTabOffset);

				Assert.AreEqual (200, firstTabOffset);
				Assert.AreEqual (tabsSrc.Length, tabStops.Length);
				Assert.AreEqual (tabsSrc[0], tabStops[0]);
				Assert.AreEqual (tabsSrc[1], tabStops[1]);
				Assert.AreEqual (tabsSrc[2], tabStops[2]);
				Assert.AreEqual (tabsSrc[3], tabStops[3]);
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:18,代码来源:TestStringFormat.cs

示例3: GetTextFormatFlagsFromStringFormat

            /// <summary>
            /// Gets a TextFormatFlags value from the specified StringFormat object.
            /// </summary>
            private static TextFormatFlags GetTextFormatFlagsFromStringFormat(StringFormat format)
            {
                TextFormatFlags glyphOverhangPadding = TextFormatFlags.GlyphOverhangPadding;
                if (format != null)
                {
                    float num;
                    if (format.GetTabStops(out num) != null)
                    {
                        glyphOverhangPadding |= TextFormatFlags.ExpandTabs;
                    }
                    if ((format.FormatFlags & StringFormatFlags.DirectionRightToLeft) != 0)
                    {
                        glyphOverhangPadding |= TextFormatFlags.RightToLeft;
                    }
                    if ((format.FormatFlags & StringFormatFlags.FitBlackBox) != 0)
                    {
                        glyphOverhangPadding |= TextFormatFlags.NoPadding;
                    }
                    if ((format.FormatFlags & StringFormatFlags.NoWrap) != 0)
                    {
                        glyphOverhangPadding |= TextFormatFlags.SingleLine;
                    }
                    else
                    {
                        glyphOverhangPadding |= TextFormatFlags.WordBreak;
                    }
                    if ((format.FormatFlags & StringFormatFlags.LineLimit) != 0)
                    {
                        glyphOverhangPadding |= TextFormatFlags.TextBoxControl;
                    }
                    switch (format.Alignment)
                    {
                        case StringAlignment.Center:
                            glyphOverhangPadding |= TextFormatFlags.HorizontalCenter;
                            break;

                        case StringAlignment.Far:
                            glyphOverhangPadding |= TextFormatFlags.Right;
                            break;

                        default:
                            //glyphOverhangPadding = glyphOverhangPadding;
                            break;
                    }
                    switch (format.LineAlignment)
                    {
                        case StringAlignment.Center:
                            glyphOverhangPadding |= TextFormatFlags.VerticalCenter;
                            break;

                        case StringAlignment.Far:
                            glyphOverhangPadding |= TextFormatFlags.Bottom;
                            break;

                        default:
                            //glyphOverhangPadding = glyphOverhangPadding;
                            break;
                    }
                    switch (format.Trimming)
                    {
                        case StringTrimming.EllipsisCharacter:
                            glyphOverhangPadding |= TextFormatFlags.EndEllipsis | TextFormatFlags.TextBoxControl;
                            break;

                        case StringTrimming.EllipsisWord:
                            glyphOverhangPadding |= TextFormatFlags.EndEllipsis | TextFormatFlags.TextBoxControl;
                            break;

                        case StringTrimming.EllipsisPath:
                            glyphOverhangPadding |= TextFormatFlags.PathEllipsis | TextFormatFlags.TextBoxControl;
                            break;

                        default:
                            if ((format.FormatFlags & StringFormatFlags.NoClip) != 0)
                            {
                                glyphOverhangPadding |= TextFormatFlags.NoClipping;
                            }
                            break;
                    }
                    switch (format.HotkeyPrefix)
                    {
                        case HotkeyPrefix.None:
                            return (glyphOverhangPadding | TextFormatFlags.NoPrefix);

                        case HotkeyPrefix.Show:
                            return glyphOverhangPadding;

                        case HotkeyPrefix.Hide:
                            return (glyphOverhangPadding | TextFormatFlags.HidePrefix);
                    }
                }
                return glyphOverhangPadding;
            }
开发者ID:vandro,项目名称:MVCVisualDesigner,代码行数:96,代码来源:DiagramRenderTextHelper.cs


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