本文整理汇总了C#中IWpfTextViewMargin.GetTextViewMargin方法的典型用法代码示例。如果您正苦于以下问题:C# IWpfTextViewMargin.GetTextViewMargin方法的具体用法?C# IWpfTextViewMargin.GetTextViewMargin怎么用?C# IWpfTextViewMargin.GetTextViewMargin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWpfTextViewMargin
的用法示例。
在下文中一共展示了IWpfTextViewMargin.GetTextViewMargin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SimpleScrollBar
public SimpleScrollBar(IWpfTextViewHost host, IWpfTextViewMargin containerMargin, FrameworkElement container,
IScrollMapFactoryService scrollMapFactoryService)
{
_textView = host.TextView;
_realScrollBarMargin =
containerMargin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar) as IWpfTextViewMargin;
if (_realScrollBarMargin != null)
{
_realScrollBar = _realScrollBarMargin as IVerticalScrollBar;
if (_realScrollBar != null)
{
_realScrollBarMargin.VisualElement.IsVisibleChanged += OnScrollBarIsVisibleChanged;
_realScrollBar.TrackSpanChanged += OnScrollBarTrackSpanChanged;
}
}
ResetTrackSpan();
_scrollMapFactory = scrollMapFactoryService;
_useElidedCoordinates = false;
ResetScrollMap();
_scrollMap.MappingChanged += delegate { RaiseTrackChangedEvent(); };
container.SizeChanged += OnContainerSizeChanged;
}
示例2: ScrollDiffMargin
internal ScrollDiffMargin(IWpfTextView textView, UnifiedDiff unifiedDiff, IMarginCore marginCore, IWpfTextViewMargin containerMargin)
: base(textView)
{
var scrollBarMargin = containerMargin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar);
// ReSharper disable once SuspiciousTypeConversion.Global
_scrollBar = (IVerticalScrollBar)scrollBarMargin;
ViewModel = new ScrollDiffMarginViewModel(marginCore, unifiedDiff, UpdateDiffDimensions);
UserControl = new ScrollDiffMarginControl { DataContext = ViewModel, Width = MarginWidth, MaxWidth = MarginWidth, MinWidth = MarginWidth};
}
示例3: CreateMargin
/// <summary>
/// Creates an <see cref="IWpfTextViewMargin"/> for the given <see cref="IWpfTextViewHost"/>.
/// </summary>
/// <param name="wpfTextViewHost">The <see cref="IWpfTextViewHost"/> for which to create the <see cref="IWpfTextViewMargin"/>.</param>
/// <param name="marginContainer">The margin that will contain the newly-created margin.</param>
/// <returns>The <see cref="IWpfTextViewMargin"/>.
/// The value may be null if this <see cref="IWpfTextViewMarginProvider"/> does not participate for this context.
/// </returns>
#endregion
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer) {
var scrollBar = marginContainer.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar) as IVerticalScrollBar;
if (scrollBar == null) {
return null;
}
return new DiagnosticStripeMargin(
wpfTextViewHost.TextView,
scrollBar,
_editorFormatMapService);
}
示例4: CreateMargin
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
{
if (textViewHost.TextView.Roles.ContainsAny(RejectedRoles))
{
return null;
}
DTE dte = (DTE) ServiceProvider.GetService(typeof (DTE));
// Hide the real scroll bar
IWpfTextViewMargin realScrollBar =
containerMargin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar) as IWpfTextViewMargin;
if (realScrollBar != null)
{
realScrollBar.VisualElement.MinWidth = 0.0;
realScrollBar.VisualElement.Width = 0.0;
}
IWpfTextView textView = textViewHost.TextView;
SimpleScrollBar scrollBar = new SimpleScrollBar(
textView,
containerMargin,
_scrollMapFactory);
ProgressiveScroll progressiveScroll = new ProgressiveScroll(
containerMargin,
textView,
_outliningManagerService.GetOutliningManager(textView),
_tagAggregatorFactoryService.CreateTagAggregator<ChangeTag>(textView),
_tagAggregatorFactoryService.CreateTagAggregator<IVsVisibleTextMarkerTag>(textView),
_tagAggregatorFactoryService.CreateTagAggregator<IErrorTag>(textView),
dte.Debugger,
scrollBar,
new ColorSet(FormatMapService.GetEditorFormatMap(textView)));
return progressiveScroll;
}
示例5: RemoveVerticalScrollBar
private void RemoveVerticalScrollBar(IWpfTextViewMargin container_margin)
{
var realScrollBarMargin = container_margin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar) as IWpfTextViewMargin;
if (realScrollBarMargin != null)
{
realScrollBarMargin.VisualElement.MinWidth = 0.0;
realScrollBarMargin.VisualElement.Width = 0.0;
}
}
示例6: Create
public IGuidObjectsProvider Create(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin, string marginName) {
if (wpfTextViewHost == null)
throw new ArgumentNullException(nameof(wpfTextViewHost));
if (margin == null)
throw new ArgumentNullException(nameof(margin));
if (marginName == null)
throw new ArgumentNullException(nameof(marginName));
if (margin.GetTextViewMargin(marginName) != margin)
throw new ArgumentException();
return new GuidObjectsProvider(wpfTextViewHost, margin, marginName, marginContextMenuHandlerProviders);
}
示例7: SimpleScrollBar
public SimpleScrollBar(IWpfTextView textView, IWpfTextViewMargin containerMargin, IScrollMapFactoryService scrollMapFactory)
{
_textView = textView;
_textView.LayoutChanged += OnLayoutChanged;
Width = Options.ScrollBarWidth;
_realScrollBarMargin = containerMargin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar) as IWpfTextViewMargin;
if (_realScrollBarMargin != null)
{
_realScrollBar = _realScrollBarMargin as IVerticalScrollBar;
if (_realScrollBar != null)
{
_realScrollBarMargin.VisualElement.IsVisibleChanged += OnScrollBarIsVisibleChanged;
_realScrollBar.TrackSpanChanged += OnScrollBarTrackSpanChanged;
}
}
ResetTrackSpan();
_scrollMapFactory = scrollMapFactory;
ResetScrollMap();
_scrollMap.MappingChanged += delegate { RaiseTrackChangedEvent(); };
}
示例8: GetAssociatedMouseProcessor
public IMouseProcessor GetAssociatedMouseProcessor(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin) {
if (margin.GetTextViewMargin(PredefinedMarginNames.Glyph) == margin)
return wpfTextViewHost.TextView.Properties.GetOrCreateSingletonProperty(typeof(GlyphTextMarkerServiceMouseProcessor), () => new GlyphTextMarkerServiceMouseProcessor(glyphTextMarkerServiceImpl, wpfTextViewHost, margin));
return null;
}
示例9: ScrollbarMargin
/// <summary>
/// Creates a <see cref="ScrollbarMargin"/> for a given <see cref="IWpfTextView"/>.
/// </summary>
/// <param name="textView">The <see cref="IWpfTextView"/> to attach the margin to.</param>
/// <param name="marginContainer">Margin container. Is defined in the <see cref="ScrollbarMarginFactory"/> by the <see cref="MarginContainerAttribute"/>.</param>
/// <param name="marginCore">The class which receives, processes and provides necessary data for <see cref="ScrollbarMargin"/>.</param>
public ScrollbarMargin(IWpfTextView textView, IWpfTextViewMargin marginContainer, MarginCore marginCore)
{
Debug.WriteLine("Entering constructor.", MarginName);
_textView = textView;
_marginCore = marginCore;
InitializeLayout();
ITextViewMargin scrollBarMargin = marginContainer.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar);
// ReSharper disable once SuspiciousTypeConversion.Global - scrollBarMargin is IVerticalScrollBar.
_scrollBar = (IVerticalScrollBar)scrollBarMargin;
marginCore.MarginRedraw += OnMarginCoreMarginRedraw;
if (marginCore.IsActivated)
DrawMargins(marginCore.GetChangedLines());
}