本文整理汇总了C#中Gtk.TextBuffer.InsertPixbuf方法的典型用法代码示例。如果您正苦于以下问题:C# TextBuffer.InsertPixbuf方法的具体用法?C# TextBuffer.InsertPixbuf怎么用?C# TextBuffer.InsertPixbuf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TextBuffer
的用法示例。
在下文中一共展示了TextBuffer.InsertPixbuf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertText
private void InsertText (TextBuffer buffer)
{
Pixbuf pixbuf = Gdk.Pixbuf.LoadFromResource ("gtk-logo-rgb.gif");
pixbuf = pixbuf.ScaleSimple (32, 32, InterpType.Bilinear);
// get start of buffer; each insertion will revalidate the
// iterator to point to just after the inserted text.
TextIter insertIter = buffer.StartIter;
buffer.Insert (ref insertIter,
"The text widget can display text with all kinds of nifty attributes. It also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n");
buffer.InsertWithTagsByName (ref insertIter, "Font styles. ", "heading");
buffer.Insert (ref insertIter, "For example, you can have ");
buffer.InsertWithTagsByName (ref insertIter, "italic", "italic");
buffer.Insert (ref insertIter, ", ");
buffer.InsertWithTagsByName (ref insertIter, "bold", "bold");
buffer.Insert (ref insertIter, ", or ");
buffer.InsertWithTagsByName (ref insertIter, "monospace (typewriter)", "monospace");
buffer.Insert (ref insertIter, ", or ");
buffer.InsertWithTagsByName (ref insertIter, "big", "big");
buffer.Insert (ref insertIter, " text. ");
buffer.Insert (ref insertIter,
"It's best not to hardcode specific text sizes; you can use relative sizes as with CSS, such as ");
buffer.InsertWithTagsByName (ref insertIter, "xx-small", "xx-small");
buffer.Insert (ref insertIter, " or");
buffer.InsertWithTagsByName (ref insertIter, "x-large", "x-large");
buffer.Insert (ref insertIter,
" to ensure that your program properly adapts if the user changes the default font size.\n\n");
buffer.InsertWithTagsByName (ref insertIter, "Colors. ", "heading");
buffer.Insert (ref insertIter, "Colors such as ");
buffer.InsertWithTagsByName (ref insertIter, "a blue foreground", "blue_foreground");
buffer.Insert (ref insertIter, " or ");
buffer.InsertWithTagsByName (ref insertIter, "a red background", "red_background");
buffer.Insert (ref insertIter, " or even ");
buffer.InsertWithTagsByName (ref insertIter, "a stippled red background",
"red_background",
"background_stipple");
buffer.Insert (ref insertIter, " or ");
buffer.InsertWithTagsByName (ref insertIter,
"a stippled blue foreground on solid red background",
"blue_foreground",
"red_background",
"foreground_stipple");
buffer.Insert (ref insertIter, " (select that to read it) can be used.\n\n");
buffer.InsertWithTagsByName (ref insertIter, "Underline, strikethrough, and rise. ", "heading");
buffer.InsertWithTagsByName (ref insertIter, "Strikethrough", "strikethrough");
buffer.Insert (ref insertIter, ", ");
buffer.InsertWithTagsByName (ref insertIter, "underline", "underline");
buffer.Insert (ref insertIter, ", ");
buffer.InsertWithTagsByName (ref insertIter, "double underline", "double_underline");
buffer.Insert (ref insertIter, ", ");
buffer.InsertWithTagsByName (ref insertIter, "superscript", "superscript");
buffer.Insert (ref insertIter, ", and ");
buffer.InsertWithTagsByName (ref insertIter, "subscript", "subscript");
buffer.Insert (ref insertIter, " are all supported.\n\n");
buffer.InsertWithTagsByName (ref insertIter, "Images. ", "heading");
buffer.Insert (ref insertIter, "The buffer can have images in it: ");
buffer.InsertPixbuf (ref insertIter, pixbuf);
buffer.InsertPixbuf (ref insertIter, pixbuf);
buffer.InsertPixbuf (ref insertIter, pixbuf);
buffer.Insert (ref insertIter, " for example.\n\n");
buffer.InsertWithTagsByName (ref insertIter, "Spacing. ", "heading");
buffer.Insert (ref insertIter, "You can adjust the amount of space before each line.\n");
buffer.InsertWithTagsByName (ref insertIter, "This line has a whole lot of space before it.\n",
"big_gap_before_line", "wide_margins");
buffer.InsertWithTagsByName (ref insertIter, "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n",
"big_gap_after_line", "wide_margins");
buffer.InsertWithTagsByName (ref insertIter, "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n",
"double_spaced_line", "wide_margins");
buffer.Insert (ref insertIter, "Also note that those lines have extra-wide margins.\n\n");
buffer.InsertWithTagsByName (ref insertIter, "Editability. ", "heading");
buffer.InsertWithTagsByName (ref insertIter, "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n",
"not_editable");
buffer.InsertWithTagsByName (ref insertIter, "Wrapping. ", "heading");
buffer.Insert (ref insertIter, "This line (and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n");
buffer.InsertWithTagsByName (ref insertIter, "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n",
"char_wrap");
buffer.InsertWithTagsByName (ref insertIter, "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n",
"no_wrap");
//.........这里部分代码省略.........
示例2: InsertTextTable
private void InsertTextTable(TextBuffer buffer)
{
Pixbuf pixbuf2 = MainClass.Tools.GetIconFromStock("file-ms.png",IconSize.Menu);
TextIter insertIter = buffer.StartIter;
List<Feature> listDif = MainClass.LicencesSystem.GetUserDifferent(featureLicence);
if(listDif!= null){
foreach(Feature ftv in listDif){
buffer.Insert (ref insertIter," ");
buffer.InsertPixbuf (ref insertIter, pixbuf2);
buffer.Insert (ref insertIter, String.Format(" {0} \n", ftv.Name));
}
}
buffer.ApplyTag ("word_wrap", buffer.StartIter, buffer.EndIter);
}