本文整理汇总了C#中TextView类的典型用法代码示例。如果您正苦于以下问题:C# TextView类的具体用法?C# TextView怎么用?C# TextView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextView类属于命名空间,在下文中一共展示了TextView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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);
}
示例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.");
}
示例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
}
}
示例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;
}
示例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 ();
}
示例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);
}
}
}
示例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();
}
示例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 );
}
}
示例10: InlineUIElementGenerator
public InlineUIElementGenerator(TextView textView, UIElement element, ITextAnchor anchor)
{
this.textView = textView;
this.element = element;
this.anchor = anchor;
this.anchor.Deleted += delegate { Remove(); };
}
示例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);
}
}
}
示例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);
}
}
}
示例13: VisualLine
internal VisualLine(TextView textView, DocumentLine firstDocumentLine)
{
Debug.Assert(textView != null);
Debug.Assert(firstDocumentLine != null);
this.textView = textView;
this.FirstDocumentLine = firstDocumentLine;
}
示例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);
}
}
}
示例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();
}