I can't understand how to load t开发者_运维问答ext into a GtkTexView, how is it done?
You have to access the Buffer property that represents the buffer holding all the content that is shown by GtkTextView.
To simply load a text, you must set the Text property, like that:
textview1.Buffer.Text = "Some sample text that will be displayed."
Assuming the control you added has the name textview1.
If you want some more control on the apperance of the text, you have to use tags to mark the text. For example:
var tag = new TextTag (null);
this.textview1.Buffer.TagTable.Add (tag);
tag.Weight = Pango.Weight.Bold;
var iter = this.textview1.Buffer.GetIterAtLine (0);
this.textview1.Buffer.InsertWithTags (ref iter, "Bold text\n", tag);
This will insert a bold text in first line. A lot more is possible using the TextBuffer, look on the methods available on textview1.Buffer
.
精彩评论