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

C# TextView类代码示例

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

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



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

示例1: Draw

        public void Draw(TextView textView, DrawingContext drawingContext)
        {
            if (textView == null)
                throw new ArgumentNullException("textView");
            if (drawingContext == null)
                throw new ArgumentNullException("drawingContext");

            if (currentResults == null || !textView.VisualLinesValid)
                return;

            var visualLines = textView.VisualLines;
            if (visualLines.Count == 0)
                return;

            int viewStart = visualLines.First().FirstDocumentLine.Offset;
            int viewEnd = visualLines.Last().LastDocumentLine.EndOffset;

            foreach (SearchResult result in currentResults.FindOverlappingSegments(viewStart, viewEnd - viewStart)) {
                BackgroundGeometryBuilder geoBuilder = new BackgroundGeometryBuilder();
                geoBuilder.AlignToMiddleOfPixels = true;
                geoBuilder.CornerRadius = 3;
                geoBuilder.AddSegment(textView, result);
                Geometry geometry = geoBuilder.CreateGeometry();
                if (geometry != null) {
                    drawingContext.DrawGeometry(markerBrush, markerPen, geometry);
                }
            }
        }
开发者ID:eolandezhang,项目名称:Diagram,代码行数:28,代码来源:SearchResultBackgroundRenderer.cs


示例2: ColumnRulerRenderer

        public ColumnRulerRenderer(TextView textView)
        {
            if (textView == null)
                throw new ArgumentNullException("textView");

            this.pen = new Pen(new SolidColorBrush(DefaultForeground), 1);
            this.pen.Freeze();
            this.textView = textView;

              ColumnRulerRenderer oldRenderer = null;

              // Make sure there is only one of this type of background renderer
              // Otherwise, we might keep adding and WPF keeps drawing them on top of each other
              foreach (var item in this.textView.BackgroundRenderers)
              {
            if (item != null)
            {
              if (item is ColumnRulerRenderer)
            oldRenderer = item as ColumnRulerRenderer;
            }
              }

              this.textView.BackgroundRenderers.Remove(oldRenderer);

            this.textView.BackgroundRenderers.Add(this);
        }
开发者ID:joazlazer,项目名称:ModdingStudio,代码行数:26,代码来源:ColumnRulerRenderer.cs


示例3: OnCreate

		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			this.SetContentView(Resource.Layout.Main);

			var playButton = this.FindViewById<Button>(Resource.Id.PlayPauseButton);
			var stopButton = this.FindViewById<Button>(Resource.Id.StopButton);
			var searchView = this.FindViewById<SearchView>(Resource.Id.SearchView);
			this.listView = this.FindViewById<ListView>(Resource.Id.listView1);
			this.timeDisplay = this.FindViewById<TextView>(Resource.Id.TimeDisplay);
			this.adapter = new SongResultsAdapter(this, new Song[0]);
			this.player = new MediaPlayer();
			
			this.switcher = this.FindViewById<ViewSwitcher>(Resource.Id.ViewSwitcher);
			this.loadingMessage = this.FindViewById<TextView>(Resource.Id.LoadingMessage);
			
			playButton.Click += this.PlayButton_Click;
			stopButton.Click += this.StopButton_Click;
			searchView.QueryTextSubmit += this.SearchView_QueryTextSubmit;
			searchView.QueryTextChange += this.SearchView_QueryTextChange;
			this.listView.ItemClick += this.ListView_ItemClick;
			this.player.BufferingUpdate += this.Player_BufferingUpdate;
			this.player.Error += this.Player_Error;

			this.ShowListViewMessage("Write in the search box to start.");
		}
开发者ID:jairov4,项目名称:Ownfy,代码行数:27,代码来源:MainActivity.cs


示例4:

		void ITextViewConnect.RemoveFromTextView(TextView textView)
		{
			if (wasAutoAddedToTextView && this.TextView == textView) {
				this.TextView = null;
				Debug.Assert(!wasAutoAddedToTextView); // setting this.TextView should have unset this flag
			}
		}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:7,代码来源:AbstractMargin.cs


示例5: Main9

	public static int Main9 (string[] args)
	{
		Gtk.Application.Init ();
		Window win = new Window ("Custom Widget Test");
		win.DeleteEvent += new DeleteEventHandler (OnQuit);
		
		VPaned paned = new VPaned ();
		CustomWidget cw = new CustomWidget ();
		cw.Label = "This one contains a button";
		Button button = new Button ("Ordinary button");
		cw.Add (button);
		paned.Pack1 (cw, true, false);

		cw = new CustomWidget ();
		cw.Label = "And this one a TextView";
		cw.StockId = Stock.JustifyLeft;
		ScrolledWindow sw = new ScrolledWindow (null, null);
		sw.ShadowType = ShadowType.In;
		sw.HscrollbarPolicy = PolicyType.Automatic;
		sw.VscrollbarPolicy = PolicyType.Automatic;
		TextView textView = new TextView ();
		sw.Add (textView);
		cw.Add (sw);
		paned.Pack2 (cw, true, false);
		
		win.Add (paned);
		win.ShowAll ();
		Gtk.Application.Run ();
		return 0;
	}
开发者ID:akrisiun,项目名称:gtk-sharp,代码行数:30,代码来源:CustomWidget.cs


示例6: Main

    public static void Main()
    {
        BusG.Init ();
        Application.Init ();

        tv = new TextView ();
        ScrolledWindow sw = new ScrolledWindow ();
        sw.Add (tv);

        Button btn = new Button ("Click me");
        btn.Clicked += OnClick;

        Button btnq = new Button ("Click me (thread)");
        btnq.Clicked += OnClickQuit;

        VBox vb = new VBox (false, 2);
        vb.PackStart (sw, true, true, 0);
        vb.PackStart (btn, false, true, 0);
        vb.PackStart (btnq, false, true, 0);

        Window win = new Window ("D-Bus#");
        win.SetDefaultSize (640, 480);
        win.Add (vb);
        win.Destroyed += delegate {Application.Quit ();};
        win.ShowAll ();

        bus = Bus.Session.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus"));

        Application.Run ();
    }
开发者ID:bl8,项目名称:dbus-sharp-glib,代码行数:30,代码来源:TestThreads.cs


示例7: Draw

 public void Draw(TextView textView, DrawingContext drawingContext)
 {
     foreach (TextSegment current in this.SearchHitsSegments)
     {
         foreach (Rect current2 in BackgroundGeometryBuilder.GetRectsForSegment(textView, current))
         {
             Point bottomLeft = current2.BottomLeft;
             Point bottomRight = current2.BottomRight;
             Pen pen = new Pen(new SolidColorBrush(Colors.OrangeRed), 1);
             pen.Freeze();
             double num = 2.5;
             int count = System.Math.Max((int)((bottomRight.X - bottomLeft.X) / num) + 1, 4);
             StreamGeometry streamGeometry = new StreamGeometry();
             using (StreamGeometryContext streamGeometryContext = streamGeometry.Open())
             {
                 streamGeometryContext.BeginFigure(bottomLeft, true, true);
                 streamGeometryContext.LineTo(current2.TopLeft, true, false);
                 streamGeometryContext.LineTo(current2.TopRight, true, false);
                 streamGeometryContext.LineTo(current2.BottomRight, true, false);
             }
             streamGeometry.Freeze();
             drawingContext.DrawGeometry(Brushes.Transparent, pen, streamGeometry);
         }
     }
 }
开发者ID:BernardNotarianni,项目名称:DownmarkerWPF,代码行数:25,代码来源:SearchBackgroundRenderer.cs


示例8: Main

    public static void Main(string[] args)
    {
        Application.Init();

        //Create the Window
        Window myWin = new Window("GtkSpell# Sample App");
        myWin.Resize(200,200);

        //Create a TextView
        TextView myTextView = new TextView();

        SpellCheck mySpellCheck;

        //Bind GtkSpell to our textview
        if (args.Length > 0)
          mySpellCheck = new SpellCheck(myTextView, args[0]);
        else
          mySpellCheck = new SpellCheck(myTextView, "en-us");

        //spellCheck.Detach();
        //spellCheck.();

        //Add the TextView to the form
        myWin.Add(myTextView);

        //Show Everything
        myWin.ShowAll();

        myWin.DeleteEvent += new DeleteEventHandler(delete);

        Application.Run();
    }
开发者ID:mono,项目名称:gtkspell-sharp,代码行数:32,代码来源:TestGtkSpell.cs


示例9: Draw

        public void Draw(TextView textView, DrawingContext drawingContext)
        {
            if (this.result == null)
            return;

              BackgroundGeometryBuilder builder = new BackgroundGeometryBuilder();

              builder.CornerRadius = 1;
              builder.AlignToMiddleOfPixels = true;

              builder.AddSegment(textView, new TextSegment() { StartOffset = result.OpeningBracketOffset, Length = result.OpeningBracketLength });
              builder.CloseFigure(); // prevent connecting the two segments
              builder.AddSegment(textView, new TextSegment() { StartOffset = result.ClosingBracketOffset, Length = result.ClosingBracketLength });

              Geometry geometry = builder.CreateGeometry();

              //Transform highlightFixTransform = new TranslateTransform(0, 2);
              //geometry.Transform.Value.OffsetY = 2;

              if (borderPen == null)
            this.UpdateColors(DefaultBackground, DefaultBackground);
              if (result.ClosingBracketLength == 0)
              this.UpdateColors(InvalidBackground, InvalidBackground);
              else
              this.UpdateColors(DefaultBackground, DefaultBackground);

              if (geometry != null)
              {
            drawingContext.DrawGeometry(backgroundBrush, borderPen, geometry );
              }
        }
开发者ID:votrongdao,项目名称:DaxStudio,代码行数:31,代码来源:BracketHighlightRenderer.cs


示例10: InlineUIElementGenerator

		public InlineUIElementGenerator(TextView textView, UIElement element, ITextAnchor anchor)
		{
			this.textView = textView;
			this.element = element;
			this.anchor = anchor;
			this.anchor.Deleted += delegate { Remove(); };
		}
开发者ID:hefnerliu,项目名称:SharpDevelop,代码行数:7,代码来源:InlineUIElementGenerator.cs


示例11: Draw

 public void Draw(TextView textview, DrawingContext drawingContext)
 {
     if (_result != null)
     {
         var backgroundGeometryBuilder = new BackgroundGeometryBuilder
         {
             CornerRadius = 1.0,
             AlignToMiddleOfPixels = true
         };
         backgroundGeometryBuilder.AddSegment(textview, new TextSegment
         {
             StartOffset = _result.OpeningBracketOffset,
             Length = _result.OpeningBracketLength
         });
         backgroundGeometryBuilder.CloseFigure();
         backgroundGeometryBuilder.AddSegment(textview, new TextSegment
         {
             StartOffset = _result.ClosingBracketOffset,
             Length = _result.ClosingBracketLength
         });
         var geometry = backgroundGeometryBuilder.CreateGeometry();
         if (_borderPen == null)
         {
             UpdateColors(DefaultBackground, DefaultBackground);
         }
         if (geometry != null)
         {
             drawingContext.DrawGeometry(_backgroundBrush, _borderPen, geometry);
         }
     }
 }
开发者ID:mookiejones,项目名称:miEditor,代码行数:31,代码来源:BracketHighlightRenderer.cs


示例12: Draw

		public void Draw(TextView textView, DrawingContext drawingContext)
		{
			if (textView == null)
			{
				throw new ArgumentNullException("textView");
			}
			if (drawingContext == null)
			{
				throw new ArgumentNullException("drawingContext");
			}
			if (this.currentResults == null || !textView.VisualLinesValid)
			{
				return;
			}
			ReadOnlyCollection<VisualLine> visualLines = textView.VisualLines;
			if (visualLines.Count == 0)
			{
				return;
			}
			int offset = visualLines.First<VisualLine>().FirstDocumentLine.Offset;
			int endOffset = visualLines.Last<VisualLine>().LastDocumentLine.EndOffset;
			foreach (var current in this.currentResults.FindOverlappingSegments(offset, endOffset - offset))
			{
				BackgroundGeometryBuilder backgroundGeometryBuilder = new BackgroundGeometryBuilder();
				backgroundGeometryBuilder.AlignToMiddleOfPixels = true;
				backgroundGeometryBuilder.CornerRadius = 3.0;
				backgroundGeometryBuilder.AddSegment(textView, current);
				Geometry geometry = backgroundGeometryBuilder.CreateGeometry();
				if (geometry != null)
				{
					drawingContext.DrawGeometry(this.markerBrush, this.markerPen, geometry);
				}
			}
		}
开发者ID:cornelius90,项目名称:InnovatorAdmin,代码行数:34,代码来源:SearchResultBackgroundRenderer.cs


示例13: VisualLine

		internal VisualLine(TextView textView, DocumentLine firstDocumentLine)
		{
			Debug.Assert(textView != null);
			Debug.Assert(firstDocumentLine != null);
			this.textView = textView;
			this.FirstDocumentLine = firstDocumentLine;
		}
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:7,代码来源:VisualLine.cs


示例14: Draw

        public void Draw(TextView textView, DrawingContext drawingContext)
        {
            if (_segments == null)
                return;

            lock (_segments)
            {
                foreach (var segment in _segments)
                {
                    var startLine = textView.GetVisualLine(segment.StartLineNumber);
                    var endLine = textView.GetVisualLine(segment.EndLineNumber);

                    // Make sure that startLine is valid (in view) since that is where we'll start to render
                    // the background. In case endLine is null, that means that we're outside of the view and
                    // should render the background to the last visible line.
                    if (startLine == null)
                        continue;

                    if (endLine == null)
                        endLine = textView.VisualLines.Last();

                    var y = startLine.GetTextLineVisualYPosition(startLine.TextLines[0], VisualYPosition.LineTop) - _textView.ScrollOffset.Y;
                    var yEnd = endLine.GetTextLineVisualYPosition(endLine.TextLines[0], VisualYPosition.LineBottom) - _textView.ScrollOffset.Y;

                    var rect = new System.Windows.Rect(0, y, textView.ActualWidth, yEnd - y);
                    drawingContext.DrawRectangle(_hightlightBrush, null, rect);
                }
            }
        }
开发者ID:peterschen,项目名称:SMAStudio,代码行数:29,代码来源:InlineScriptDocumentTransformer.cs


示例15: MainWindow

    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();

        Table table = new Table(2, 2, true);

        Add(table); 
        ShowAll();

        buttonView = new Button("View");
        // when this button is clicked, it'll run hello()
        buttonView.Clicked += (s, a) =>
        {
            View();
        };


        textviewView = new TextView();

        table.Attach(buttonView, 0, 2, 0, 1);
        table.Attach(textviewView, 0, 2, 1, 2);
        table.ShowAll();

        View();
    }
开发者ID:EifelMono,项目名称:NetAtmo,代码行数:25,代码来源:MainWindow.cs


示例16: TextArea

		/// <summary>
		/// Creates a new TextArea instance.
		/// </summary>
		protected TextArea(TextView textView)
		{
			if (textView == null)
				throw new ArgumentNullException("textView");
			this.textView = textView;
			this.Options = textView.Options;
			textView.SetBinding(TextView.DocumentProperty, new Binding(DocumentProperty.Name) { Source = this });
			textView.SetBinding(TextView.OptionsProperty, new Binding(OptionsProperty.Name) { Source = this });
			
			textView.Services.AddService(typeof(TextArea), this);
			
			leftMargins.Add(new LineNumberMargin { TextView = textView, TextArea = this } );
			leftMargins.Add(new Line {
			                	X1 = 0, Y1 = 0, X2 = 0, Y2 = 1,
			                	StrokeDashArray = { 0, 2 },
			                	Stretch = Stretch.Fill,
			                	Stroke = Brushes.Gray,
			                	StrokeThickness = 1,
			                	StrokeDashCap = PenLineCap.Round,
			                	Margin = new Thickness(2, 0, 2, 0)
			                });
			
			textView.LineTransformers.Add(new SelectionColorizer(this));
			textView.InsertLayer(new SelectionLayer(this), KnownLayer.Selection, LayerInsertionPosition.Replace);
			
			caret = new Caret(this);
			caret.PositionChanged += (sender, e) => RequestSelectionValidation();
			
			this.DefaultInputHandler = new TextAreaDefaultInputHandler(this);
			this.ActiveInputHandler = this.DefaultInputHandler;
		}
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:34,代码来源:TextArea.cs


示例17: ModuleOutlineControl

        void ITextEditorExtension.Attach(ITextEditor editor)
        {
            _outlineContent = new ModuleOutlineControl(editor);

            _textView = editor.GetService(typeof(TextView)) as TextView;
            _textView.Services.AddService(typeof(IOutlineContentHost), _outlineContent);
        }
开发者ID:mks786,项目名称:vb6leap,代码行数:7,代码来源:VbpTextEditorExtension.cs


示例18: CreateBinding

        protected override IElementFrame CreateBinding(TextView view, DocPoint start, DocPoint end)
        {
            if (!IsVisibleInView(view))
                return null;

            return new TileElementFrame(base.CreateBinding(view, start, start)) { XOffset = -30, TileWidth = 11, TileHeight = 11 };
        }
开发者ID:kevinmiles,项目名称:dxcorecommunityplugins,代码行数:7,代码来源:RunMethodTileDocumentAdornment.cs


示例19: TextArea

		/// <summary>
		/// Creates a new TextArea instance.
		/// </summary>
		protected TextArea(TextView textView)
		{
			if (textView == null)
				throw new ArgumentNullException("textView");
			this.textView = textView;
			this.Options = textView.Options;
			
			selection = emptySelection = new EmptySelection(this);
			
			textView.Services.AddService(typeof(TextArea), this);
			
			textView.LineTransformers.Add(new SelectionColorizer(this));
			textView.InsertLayer(new SelectionLayer(this), KnownLayer.Selection, LayerInsertionPosition.Replace);
			
			caret = new Caret(this);
			caret.PositionChanged += (sender, e) => RequestSelectionValidation();
			caret.PositionChanged += CaretPositionChanged;
			AttachTypingEvents();
			ime = new ImeSupport(this);
			
			leftMargins.CollectionChanged += leftMargins_CollectionChanged;
			
			this.DefaultInputHandler = new TextAreaDefaultInputHandler(this);
			this.ActiveInputHandler = this.DefaultInputHandler;
		}
开发者ID:bbqchickenrobot,项目名称:AvalonEdit,代码行数:28,代码来源:TextArea.cs


示例20: AddSegment

 /// <summary>
 /// Adds the specified segment to the geometry.
 /// </summary>
 public void AddSegment(TextView textView, ISegment segment)
 {
     if (textView == null)
         throw new ArgumentNullException(nameof(textView));
     Size pixelSize = PixelSnapHelpers.GetPixelSize(textView);
     foreach (Rect r in GetRectsForSegment(textView, segment, ExtendToFullWidthAtLineEnd))
     {
         if (AlignToWholePixels)
         {
             AddRectangle(PixelSnapHelpers.Round(r.Left, pixelSize.Width),
                          PixelSnapHelpers.Round(r.Top + 1, pixelSize.Height),
                          PixelSnapHelpers.Round(r.Right, pixelSize.Width),
                          PixelSnapHelpers.Round(r.Bottom + 1, pixelSize.Height));
         }
         else if (AlignToMiddleOfPixels)
         {
             AddRectangle(PixelSnapHelpers.PixelAlign(r.Left, pixelSize.Width),
                          PixelSnapHelpers.PixelAlign(r.Top + 1, pixelSize.Height),
                          PixelSnapHelpers.PixelAlign(r.Right, pixelSize.Width),
                          PixelSnapHelpers.PixelAlign(r.Bottom + 1, pixelSize.Height));
         }
         else
         {
             AddRectangle(r.Left, r.Top + 1, r.Right, r.Bottom + 1);
         }
     }
 }
开发者ID:arkanoid1,项目名称:Yanitta,代码行数:30,代码来源:BackgroundGeometryBuilder.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TextViewContext类代码示例发布时间:2022-05-24
下一篇:
C# TextUnit类代码示例发布时间: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