本文整理汇总了C#中Gtk.ScrolledWindow.AddWithViewport方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.ScrolledWindow.AddWithViewport方法的具体用法?C# Gtk.ScrolledWindow.AddWithViewport怎么用?C# Gtk.ScrolledWindow.AddWithViewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ScrolledWindow
的用法示例。
在下文中一共展示了Gtk.ScrolledWindow.AddWithViewport方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVisualizerWidget
public override Gtk.Widget GetVisualizerWidget (ObjectValue val)
{
var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
string file = Path.GetTempFileName ();
Gdk.Pixbuf pixbuf;
ops.AllowTargetInvoke = true;
try {
var pix = (RawValue) val.GetRawValue (ops);
pix.CallMethod ("Save", file, "png");
pixbuf = new Gdk.Pixbuf (file);
} finally {
File.Delete (file);
}
var sc = new Gtk.ScrolledWindow ();
sc.ShadowType = Gtk.ShadowType.In;
sc.HscrollbarPolicy = Gtk.PolicyType.Automatic;
sc.VscrollbarPolicy = Gtk.PolicyType.Automatic;
var image = new Gtk.Image (pixbuf);
sc.AddWithViewport (image);
sc.ShowAll ();
return sc;
}
示例2: Build
private void Build()
{
var swScroll = new Gtk.ScrolledWindow();
// Drawing area
this.drawingArea = new Gtk.DrawingArea();
this.drawingArea.ExposeEvent += (o, args) => this.OnExposeDrawingArea();
// Layout
swScroll.AddWithViewport( this.drawingArea );
this.VBox.PackStart( swScroll, true, true, 5 );
this.AddButton( Gtk.Stock.Close, Gtk.ResponseType.Close );
// Polish
this.WindowPosition = Gtk.WindowPosition.CenterOnParent;
this.Resize( 320, 200 );
this.SetGeometryHints(
this,
new Gdk.Geometry() {
MinWidth = 320,
MinHeight = 200
},
Gdk.WindowHints.MinSize
);
}
示例3: GetVisualizerWidget
public override Gtk.Widget GetVisualizerWidget (ObjectValue val)
{
Gdk.Pixbuf pixbuf;
string file = Path.GetTempFileName ();
try {
RawValue pix = (RawValue) val.GetRawValue ();
pix.CallMethod ("Save", file, "png");
pixbuf = new Gdk.Pixbuf (file);
} finally {
File.Delete (file);
}
Gtk.ScrolledWindow sc = new Gtk.ScrolledWindow ();
sc.ShadowType = Gtk.ShadowType.In;
sc.HscrollbarPolicy = Gtk.PolicyType.Automatic;
sc.VscrollbarPolicy = Gtk.PolicyType.Automatic;
Gtk.Image image = new Gtk.Image (pixbuf);
sc.AddWithViewport (image);
sc.ShowAll ();
return sc;
}
示例4: Build
/// <summary>
/// Build the UI
/// </summary>
private void Build()
{
var swScroll = new Gtk.ScrolledWindow();
this.drawingArea = new Gtk.DrawingArea();
this.drawingArea.SetSizeRequest( 640, 480 );
swScroll.AddWithViewport( this.drawingArea );
this.Add( swScroll );
// Polish
this.SetGeometryHints(
this,
new Gdk.Geometry() {
MinWidth = 500,
MinHeight = 350
},
Gdk.WindowHints.MinSize );
// Events
this.DeleteEvent += (o, args) => Gtk.Application.Quit();
this.drawingArea.ExposeEvent += (o, args) => this.OnExposed();
this.ShowAll();
}
示例5: AddTableToNotebook
private void AddTableToNotebook(Gtk.Table table)
{
Gtk.ScrolledWindow frame = new Gtk.ScrolledWindow();
frame.ShadowType = Gtk.ShadowType.None;
frame.SetPolicy(Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
frame.AddWithViewport(table);
table.RowSpacing = 1;
table.ColumnSpacing = 0;
_notebook.AppendPage(frame, new Gtk.Label(string.Empty));
}
示例6: BuildNotebook
private void BuildNotebook()
{
var vBox = new Gtk.VBox( false, 5 );
var hBox = new Gtk.HPaned();
this.nbDocPages = new Gtk.Notebook();
this.nbDocPages.SwitchPage += (o, args) => this.OnCurrentPageChanged();
// Text view for the document
var swScrollText = new Gtk.ScrolledWindow();
this.txtDocument = new Gtk.TextView { Editable = false };
swScrollText.AddWithViewport( this.txtDocument );
this.txtDocument.FocusOutEvent += (o, args) => this.StoreQuestionText();
// Test treeview
this.tvDocument = new Gtk.TreeView();
var swScroll = new Gtk.ScrolledWindow();
var frmTest = new Gtk.Frame( "Test" );
( (Gtk.Label) frmTest.LabelWidget ).Markup = "<b>Test</b>";
frmTest.Add( swScroll );
swScroll.AddWithViewport( this.tvDocument );
// Frame question
var frmQuestion = new Gtk.Frame( "Question" );
var swScrolledQuestion = new Gtk.ScrolledWindow();
( (Gtk.Label) frmQuestion.LabelWidget ).Markup = "<b>Question</b>";
this.edQuestionText = new Gtk.TextView();
this.edQuestionText.KeyReleaseEvent += (o, args) => this.OnQuestionTextChanged();
swScrolledQuestion.AddWithViewport( edQuestionText );
frmQuestion.Add( swScrolledQuestion );
vBox.PackStart( frmQuestion, false, false, 5 );
// Frame answers
var bttAnswers = new Gtk.HButtonBox();
var vBoxAnswers = new Gtk.VBox( false, 5 );
var frmAnswer = new Gtk.Frame( "Answer" );
var hBoxAnswers = new Gtk.HBox( false, 5 );
var hBoxCorrect = new Gtk.HBox( false, 5 );
var swScrolledAnswers = new Gtk.ScrolledWindow();
( (Gtk.Label) frmAnswer.LabelWidget ).Markup = "<b>Answer</b>";
this.tvAnswers = new Gtk.TreeView();
swScrolledAnswers.Add( this.tvAnswers );
this.btAddAnswer = new Gtk.Button( new Gtk.Image( this.iconAdd.ScaleSimple( 16, 16, InterpType.Bilinear ) ) );
this.btAddAnswer.Clicked += (sender, e) => this.AddAnswer();
this.btRemoveAnswer = new Gtk.Button( new Gtk.Image( this.iconRemove.ScaleSimple( 16, 16, InterpType.Bilinear ) ) );
this.btRemoveAnswer.Clicked += (sender, e) => this.RemoveAnswer();
bttAnswers.Add( this.btAddAnswer );
bttAnswers.Add( this.btRemoveAnswer );
bttAnswers.Layout = Gtk.ButtonBoxStyle.Center;
bttAnswers.Spacing = 20;
hBoxAnswers.PackStart( swScrolledAnswers, true, true, 5 );
vBoxAnswers.PackStart( hBoxAnswers, true, true, 5 );
this.spNumberValidAnswer = new Gtk.SpinButton( 1, 20, 1 );
this.spNumberValidAnswer.ValueChanged += (o, args) => this.OnCorrectAnswerChanged();
hBoxCorrect.PackStart( new Gtk.Label( "Correct answer:" ), false, false, 5 );
hBoxCorrect.PackStart( this.spNumberValidAnswer, false, false, 5 );
hBoxCorrect.PackEnd( bttAnswers, false, false, 5 );
vBoxAnswers.PackStart( hBoxCorrect, false, false, 5 );
frmAnswer.Add( vBoxAnswers );
vBox.PackStart( frmAnswer, true, true, 5 );
// Layout
hBox.Pack1( frmTest, false, false );
hBox.Pack2( vBox, false, false );
this.nbDocPages.AppendPage( hBox, new Gtk.Label( "Edit" ) );
this.nbDocPages.AppendPage( swScrollText, new Gtk.Label( "Document" ) );
this.nbDocPages.Page = 0;
}
示例7: CreateFakeWidget
Gtk.Widget CreateFakeWidget (string typeName)
{
Stetic.Custom c = new Stetic.Custom ();
// Give it some default size
c.WidthRequest = 20;
c.HeightRequest = 20;
Gtk.Container box = null;
switch (typeClassDescriptor.Name) {
case "Gtk.Alignment":
box = new Gtk.Alignment (0.5f, 0.5f, 1f, 1f);
break;
case "Gtk.Fixed":
box = new Gtk.Alignment (0.5f, 0.5f, 1f, 1f);
break;
case "Gtk.Frame":
box = new Gtk.Frame ();
break;
case "Gtk.Box":
case "Gtk.HBox": {
Gtk.HBox cc = new Gtk.HBox ();
cc.PackStart (c, true, true, 0);
return cc;
}
case "Gtk.VBox": {
Gtk.VBox cc = new Gtk.VBox ();
cc.PackStart (c, true, true, 0);
return cc;
}
case "Gtk.Paned":
case "Gtk.VPaned": {
Gtk.VPaned cc = new Gtk.VPaned ();
cc.Add1 (c);
return cc;
}
case "Gtk.HPaned": {
Gtk.HPaned cc = new Gtk.HPaned ();
cc.Add1 (c);
return cc;
}
case "Gtk.Notebook": {
Gtk.Notebook nb = new Gtk.Notebook ();
nb.ShowTabs = false;
nb.AppendPage (c, null);
return nb;
}
case "Gtk.ScrolledWindow": {
Gtk.ScrolledWindow cc = new Gtk.ScrolledWindow ();
cc.VscrollbarPolicy = Gtk.PolicyType.Never;
cc.HscrollbarPolicy = Gtk.PolicyType.Never;
cc.AddWithViewport (c);
return cc;
}
case "Gtk.Table": {
Gtk.Table t = new Gtk.Table (1, 1, false);
t.Attach (c, 0, 1, 0, 1);
return t;
}
case "Gtk.ButtonBox":
return new Gtk.HButtonBox ();
}
if (box != null) {
box.Add (c);
return box;
} else {
Stetic.CustomWidget custom = new Stetic.CustomWidget ();
if (custom.Child != null)
custom.Remove (custom.Child);
custom.Add (c);
return custom;
}
}
示例8: BuildTable
private void BuildTable()
{
var swView = new Gtk.ScrolledWindow();
this.tvTable = new Gtk.TreeView();
this.tvTable.EnableSearch = false;
this.ttTable = new GtkUtil.TableTextView( this.tvTable, Headers.Count, Headers.Count );
this.ttTable.Headers = Headers;
this.tvTable.ButtonReleaseEvent += OnTableClick;
this.tvTable.RowActivated += ( sender, evt ) => this.OnEdit();
this.lblEmptyExplanation = new Gtk.Label(){ UseMarkup = true };
swView.AddWithViewport( this.tvTable );
this.vbMain.PackStart( swView, true, true, 5 );
this.vbMain.PackStart( this.lblEmptyExplanation, false, false, 5 );
}