动态标签大小 [英] Dynamic Tab Size
问题描述
我需要根据某些条件动态设置标签大小.假设我需要将第一个标签大小设置为10.
I need to set tab size dynamically, according to some condition. Assume that I need to set the first tab size = 10. 有什么办法可以避免这个问题? Is there some way to avoid this issue? 嗨VadimLuk, 感谢您的帖子. 我想缩进样式是设置为默认值 您可以尝试vsIndentStyle吗? vsIndentStyleSmart. 有关详细信息,
http://msdn.microsoft.com/en-us/library/envdte.vsindentstyle.aspx For more information,
http://msdn.microsoft.com/en-us/library/envdte.vsindentstyle.aspx 这是一个线程如何打开/关闭智能缩进 Ziwei Chen 这篇关于动态标签大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋![Export(typeof(ITextParagraphPropertiesFactoryService))]
[ContentType("C/C++")]
public class MyParagraphPropertiesFactoryService : ITextParagraphPropertiesFactoryService
{
public TextParagraphProperties Create(IFormattedLineSource formattedLineSource, TextFormattingRunProperties textProperties,
IMappingSpan line, IMappingPoint lineStart, int lineSegment)
{
return new MyParagraphProperties(textProperties, formattedLineSource, 10);
}
}
public class MyParagraphProperties : TextFormattingParagraphProperties
{
public MyParagraphProperties(TextFormattingRunProperties textProperties, IFormattedLineSource formattedLineSource, int firstTabSize)
:
base(textProperties, formattedLineSource.ColumnWidth * (double)formattedLineSource.TabSize)
{
ColumnWidth = formattedLineSource.ColumnWidth;
FirstTabSize = firstTabSize;
}
public override IList<TextTabProperties> Tabs
{
get
{
double offset = ColumnWidth * (double)FirstTabSize + 1;
return new List<TextTabProperties> {
new TextTabProperties(TextTabAlignment.Left, offset, 0, 0)
};
}
}
public double ColumnWidth { get; set; }
public int FirstTabSize { get; set; }
}
推荐答案