本文整理汇总了C#中Gtk.TextView.ModifyFont方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.ModifyFont方法的具体用法?C# TextView.ModifyFont怎么用?C# TextView.ModifyFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TextView
的用法示例。
在下文中一共展示了TextView.ModifyFont方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MultiLineTextTool
public MultiLineTextTool (IDrawingEditor editor, MultiLineTextFigure fig, ITool dt): base (editor, fig, dt) {
_textview = new Gtk.TextView ();
_textview.Buffer.Changed += new System.EventHandler (ChangedHandler);
_textview.ModifyFont (fig.PangoLayout.FontDescription.Copy ());
_textview.RightMargin = 5;
_textview.Justification = ConvertJustificaton ();
}
示例2: windowTerminalGTK
public windowTerminalGTK(clsHost host)
: base(String.Format("{0} - {1}:{2}",host.Name,host.RemoteHost,host.RemoteSSHPort))
{
SSH = new clsSSHTerminal(host);
Host = host;
ScrolledWindow scrolledWindow = new ScrolledWindow();
textview1 = new TextView();
this.SetSizeRequest(800,600);
scrolledWindow.Add(textview1);
textview1.ModifyFont(FontDescription.FromString(host.TerminalFont));
this.Add(scrolledWindow);
this.CanFocus = true;
ShowAll ();
SSH.TerminalData += (string text) =>
{
Gtk.Application.Invoke (delegate {
TextIter mIter = textview1.Buffer.EndIter;
textview1.Buffer.Insert(ref mIter, text);
textview1.ScrollToIter(textview1.Buffer.EndIter, 0, false, 0, 0);
});
};
}
示例3: GetWidget
public Widget GetWidget (MethodDefinition method)
{
FontDescription fd = FontDescription.FromString ("Courier 10 Pitch 10");
TextView ilTextView = new TextView ();
ilTextView.ModifyFont (fd);
ilTextView.Editable = false;
ilTextView.Buffer.Text = GetIlSource (method);
ScrolledWindow sw = new ScrolledWindow ();
sw.Add (ilTextView);
sw.ShowAll ();
return sw;
}
示例4: Main
static void Main(string[] args)
{
OurParserTask r = new OurParserTask(Console.In);
r.run();
Gtk.Application.Init();
Gtk.Window window = new Gtk.Window("Repodoc - Gtk# frontend");
Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow();
Gtk.TextView tv = new Gtk.TextView();
tv.Editable = false;
tv.CursorVisible = false;
Pango.FontDescription fontdesc =
Pango.FontDescription.FromString("Monospace");
tv.ModifyFont(fontdesc);
DocsTreeView t = new DocsTreeView(tv, r);
sw.Add(t);
Gtk.VPaned vp = new Gtk.VPaned();
vp.BorderWidth = 6;
vp.Pack1(sw, true, true);
window.Add(vp);
Gtk.ScrolledWindow sw2 = new Gtk.ScrolledWindow();
sw2.Add(tv);
vp.Pack2(sw2, true, true);
window.SetDefaultSize(500, 400);
window.DeleteEvent += delete_event;
window.ShowAll();
Gtk.Application.Run();
}
示例5: CreateText
private ScrolledWindow CreateText (TextBuffer buffer, bool IsSource)
{
ScrolledWindow scrolledWindow = new ScrolledWindow ();
scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
scrolledWindow.ShadowType = ShadowType.In;
TextView textView = new TextView (buffer);
textView.Editable = false;
textView.CursorVisible = false;
scrolledWindow.Add (textView);
if (IsSource) {
FontDescription fontDescription = FontDescription.FromString ("Courier 12");
textView.ModifyFont (fontDescription);
textView.WrapMode = Gtk.WrapMode.None;
} else {
// Make it a bit nicer for text
textView.WrapMode = Gtk.WrapMode.Word;
textView.PixelsAboveLines = 2;
textView.PixelsBelowLines = 2;
}
return scrolledWindow;
}
示例6: AddHelpPane
void AddHelpPane()
{
VBox desc = new VBox (false, 0);
descTitleLabel = new Label ();
descTitleLabel.SetAlignment(0, 0);
descTitleLabel.SetPadding (5, 2);
descTitleLabel.UseMarkup = true;
desc.PackStart (descTitleLabel, false, false, 0);
ScrolledWindow textScroll = new ScrolledWindow ();
textScroll.HscrollbarPolicy = PolicyType.Never;
textScroll.VscrollbarPolicy = PolicyType.Automatic;
desc.PackEnd (textScroll, true, true, 0);
//TODO: Use label, but wrapping seems dodgy.
descTextView = new TextView ();
descTextView.WrapMode = WrapMode.Word;
descTextView.WidthRequest = 1;
descTextView.HeightRequest = 70;
descTextView.Editable = false;
descTextView.LeftMargin = 5;
descTextView.RightMargin = 5;
Pango.FontDescription font = Style.FontDescription.Copy ();
font.Size = (font.Size * 8) / 10;
descTextView.ModifyFont (font);
textScroll.Add (descTextView);
descFrame = desc;
vpaned.Pack2 (descFrame, false, true);
descFrame.ShowAll ();
UpdateHelp ();
}
示例7: TestResultsPad
public TestResultsPad ()
{
testService.TestSuiteChanged += new EventHandler (OnTestSuiteChanged);
IdeApp.Workspace.WorkspaceItemClosed += OnWorkspaceItemClosed;
panel = new VBox ();
// Results notebook
book = new HPaned ();
panel.PackStart (book, true, true, 0);
panel.FocusChain = new Gtk.Widget [] { book };
// Failures tree
failuresTreeView = new MonoDevelop.Ide.Gui.Components.PadTreeView ();
failuresTreeView.HeadersVisible = false;
failuresStore = new TreeStore (typeof(Xwt.Drawing.Image), typeof(string), typeof(object), typeof(string), typeof(int), typeof(int));
var pr = new CellRendererImage ();
CellRendererText tr = new CellRendererText ();
TreeViewColumn col = new TreeViewColumn ();
col.PackStart (pr, false);
col.AddAttribute (pr, "image", 0);
col.PackStart (tr, false);
col.AddAttribute (tr, "markup", 1);
failuresTreeView.AppendColumn (col);
failuresTreeView.Model = failuresStore;
var sw = new MonoDevelop.Components.CompactScrolledWindow ();
sw.ShadowType = ShadowType.None;
sw.Add (failuresTreeView);
book.Pack1 (sw, true, true);
outputView = new MonoDevelop.Ide.Gui.Components.LogView.LogTextView ();
outputView.ModifyFont (FontService.MonospaceFont);
outputView.Editable = false;
bold = new TextTag ("bold");
bold.Weight = Pango.Weight.Bold;
outputView.Buffer.TagTable.Add (bold);
sw = new MonoDevelop.Components.CompactScrolledWindow ();
sw.ShadowType = ShadowType.None;
sw.Add (outputView);
book.Pack2 (sw, true, true);
outputViewScrolled = sw;
failuresTreeView.RowActivated += OnRowActivated;
failuresTreeView.Selection.Changed += OnRowSelected;
failuresTreeView.DoPopupMenu = delegate (EventButton evt) {
IdeApp.CommandService.ShowContextMenu (failuresTreeView, evt,
"/MonoDevelop/NUnit/ContextMenu/TestResultsPad");
};
Control.ShowAll ();
outputViewScrolled.Hide ();
}
示例8: Build
protected virtual void Build()
{
// Widget LPS.Util.UtilMainWindow
this.Name = "LPS.Util.UtilMainWindow";
this.Title = Mono.Unix.Catalog.GetString("UtilMainWindow");
this.WindowPosition = ((Gtk.WindowPosition) (4));
// Container child LPS.Util.UtilMainWindow.Gtk.Container+ContainerChild
this.vbox2 = new Gtk.VBox();
this.vbox2.Name = "vbox2";
this.vbox2.Spacing = 6;
VPaned vpaned = new VPaned();
vpaned.Position = 300;
vbox2.PackStart(vpaned);
tw = new TextView();
Pango.FontDescription font = new Pango.FontDescription();
font.Family = "Courier";
font.Weight = Pango.Weight.Bold;
tw.ModifyFont(font);
ScrolledWindow sc = new ScrolledWindow();
sc.Add(tw);
vpaned.Add2(sc);
tw.KeyPressEvent += HandleTwKeyPressEvent;
// Container child vbox2.Gtk.Box+BoxChild
this.entry1 = new Gtk.Entry();
this.entry1.CanFocus = true;
this.entry1.Name = "entry1";
this.entry1.IsEditable = true;
this.entry1.InvisibleChar = '●';
this.vbox2.PackEnd(this.entry1);
Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild) (this.vbox2[this.entry1]));
w1.Position = 0;
w1.Expand = false;
w1.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.GtkScrolledWindow = new Gtk.ScrolledWindow();
this.GtkScrolledWindow.Name = "GtkScrolledWindow";
this.GtkScrolledWindow.ShadowType = ((Gtk.ShadowType) (1));
// Container child GtkScrolledWindow.Gtk.Container+ContainerChild
this.outputView = new Gtk.TextView();
this.outputView.CanFocus = true;
this.outputView.Name = "outputView";
this.outputView.Editable = false;
this.GtkScrolledWindow.Add(this.outputView);
vpaned.Add1(this.GtkScrolledWindow);
Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild) (this.vbox2[this.GtkScrolledWindow]));
w3.Position = 1;
this.Add(this.vbox2);
if((this.Child != null))
{
this.Child.ShowAll();
}
this.DefaultWidth = 400;
this.DefaultHeight = 300;
this.Show();
this.entry1.Activated += new System.EventHandler(this.OnEntry1Activated);
}
示例9: OutputConsole
public OutputConsole()
{
buffer = new Gtk.TextBuffer(new Gtk.TextTagTable());
textEditorControl = new Gtk.TextView(buffer);
textEditorControl.Editable = true;
sw = new ScrolledWindow();
sw.ShadowType = ShadowType.Out;
sw.Add(textEditorControl);
this.PackStart(sw, true, true, 0);
vbt = new VBox();
Gdk.Pixbuf clear_pixbuf = MainClass.Tools.GetIconFromStock("file-new.png", IconSize.SmallToolbar);
Button btnClear = new Button(new Gtk.Image(clear_pixbuf));
btnClear.TooltipText = MainClass.Languages.Translate("clear");
btnClear.Relief = ReliefStyle.None;
btnClear.CanFocus = false;
btnClear.WidthRequest = btnClear.HeightRequest = 24;
btnClear.Clicked += delegate(object sender, EventArgs e) {
Clear();
};
Gdk.Pixbuf save_pixbuf = MainClass.Tools.GetIconFromStock("save.png", IconSize.SmallToolbar);
Button btnSave = new Button(new Gtk.Image(save_pixbuf));
btnSave.TooltipText = MainClass.Languages.Translate("save");
btnSave.Relief = ReliefStyle.None;
btnSave.CanFocus = false;
btnSave.WidthRequest = btnSave.HeightRequest = 24;
btnSave.Clicked += delegate(object sender, EventArgs e) {
Save();
};
vbt.WidthRequest = 24;
vbt.PackStart(btnClear, false, false, 0);
vbt.PackStart(btnSave, false, false, 0);
this.PackEnd(vbt, false, false, 0);
bold = new TextTag("bold");
bold.Weight = Pango.Weight.Bold;
buffer.TagTable.Add(bold);
errorTag = new TextTag("error");
errorTag.Foreground = "red";
buffer.TagTable.Add(errorTag);
consoleLogTag = new TextTag("consoleLog");
consoleLogTag.Foreground = "darkgrey";
buffer.TagTable.Add(consoleLogTag);
tag = new TextTag("0");
tag.LeftMargin = 10;
buffer.TagTable.Add(tag);
tags.Add(tag);
endMark = buffer.CreateMark("end-mark", buffer.EndIter, false);
outputDispatcher = new GLib.TimeoutHandler(OutputDispatchHandler);
customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
textEditorControl.ModifyFont(customFont);
textEditorControl.KeyPressEvent += HandleTextEditorControlKeyPressEvent;
this.ShowAll();
}
示例10: GetWidget
private Widget GetWidget (CustomAttributeCollection cac)
{
FontDescription fd = FontDescription.FromString ("Courier 10 Pitch 10");
VBox vbox = new VBox (false, 0);
ScrolledWindow sw = new ScrolledWindow ();
sw.AddWithViewport (vbox);
if ((cac != null) && (cac.Count > 0)) {
foreach (CustomAttribute ca in cac) {
TextView textview = new TextView ();
textview.Editable = false;
textview.Buffer.Text = Format (ca);
textview.ModifyFont (fd);
Expander expander = new Expander (ca.Constructor.DeclaringType.FullName);
expander.Add (textview);
vbox.Add (expander);
}
}
sw.ShowAll ();
return sw;
}
示例11: SqlEditorSharp
// Constructors
public SqlEditorSharp() : base(false, 4)
{
scroll = new ScrolledWindow (
new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
scroll.HscrollbarPolicy = Gtk.PolicyType.Automatic;
scroll.VscrollbarPolicy = Gtk.PolicyType.Automatic;
scroll.ShadowType = Gtk.ShadowType.In;
this.PackStart (scroll, true, true, 0);
// default font famly for SQL editor
family = "courier";
// other default settings
use_hi_lighting = false;
// create text tag table
TextTagTable textTagTable = new TextTagTable ();
// anything else is normaltext
normaltext_tag = new TextTag ("normaltext");
normaltext_tag.Family = family;
normaltext_tag.Foreground = "black";
normaltext_tag.Style = Pango.Style.Normal;
textTagTable.Add (normaltext_tag);
// SQL Keywords - SELECT FROM WHERE, etc
sql_tag = new TextTag ("sql");
sql_tag.Family = family;
sql_tag.Foreground = "blue";
sql_tag.Style = Pango.Style.Normal;
textTagTable.Add (sql_tag);
// c like free comment - used within a SQL statement
freecomment_tag = new TextTag ("freecomment");
freecomment_tag.Family = family;
freecomment_tag.Foreground = "darkgreen";
freecomment_tag.Style = Pango.Style.Italic;
textTagTable.Add (freecomment_tag);
// c++ like line comment, but using two hyphens
linecomment_tag = new TextTag ("linecomment");
linecomment_tag.Family = family;
linecomment_tag.Foreground = "darkgreen";
linecomment_tag.Style = Pango.Style.Italic;
textTagTable.Add (linecomment_tag);
/* single quoted constant - WHERE COL1 = 'ABC' */
singlequotedconstant_tag = new TextTag ("singlequotedconstant");
singlequotedconstant_tag.Family = family;
singlequotedconstant_tag.Foreground = "red";
singlequotedconstant_tag.Style = Pango.Style.Normal;
textTagTable.Add (singlequotedconstant_tag);
// create TextBuffer and TextView
sqlTextBuffer = new TextBuffer (textTagTable);
sqlTextView = new TextView (sqlTextBuffer);
// allow it to be edited
sqlTextView.Editable = true;
// attach OnTextChanged callback function
// to "changed" signal so we can do something
// when the text has changed in the buffer
sqlTextBuffer.Changed += new EventHandler (OnTextChanged);
sqlTextView.ModifyFont (Pango.FontDescription.FromString ("courier new"));
// add the TextView to the ScrolledWindow
scroll.Add (sqlTextView);
}
示例12: CreateOutputResultsTextView
ScrolledWindow CreateOutputResultsTextView ()
{
ScrolledWindow sw;
sw = new ScrolledWindow (
new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
new Adjustment (0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;
sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
sw.ShadowType = Gtk.ShadowType.In;
textView = new TextView ();
buf = textView.Buffer;
textView.Editable = false;
textView.ModifyFont (Pango.FontDescription.FromString ("courier new"));
sw.Add (textView);
return sw;
}