更改monodevelop c中的标签文本#

问题描述:

我目前正在构建一个Web浏览器。更改monodevelop c中的标签文本#

我正在使用笔记本小部件作为tabcontrol。

但有一个问题:如何更改标签的文本?

我有一个自定义小部件,位于每个由用户打开的选项卡中。自定义小部件不过是一个webview。它只是让事情变得更容易,我也可以使用这种方法来控制错误。

现在,由于笔记本中的选项卡是自定义小部件的父项,因此如何从自定义小部件更改选项卡的文本。我在Parent属性中看不到Text属性。

感谢您的帮助。

P.S.我使用的MonoDevelop 2.6,语言:C#

编辑:

我主要的主窗口中,我加入这个控制我的自定义小工具添加到我的笔记本电脑(我已经改名为TabControl的):

// function to add a new tab 
private void AddTab(string URL) 
{ 
    // Create new label for the tab 
    Label label = new Label(); 
    label.Text = "Loading..."; 
    // Add the page to the TabControl 
    TabControl.AppendPage(control, label); 
    // Show the TabControl and its children 
    TabControl.ShowAll(); 

    // Navigate to the specified URL 
    view.Open(URL); 
} 

而且在我的自定义小部件,它仅包含Webkit.WebView,我有这样的:

使用系统;使用WebKit;使用Gtk;

public partial class WebControl : Gtk.Bin 
{ 
    public WebView view = new WebView(); 

    public WebControl() 
    { 
     this.Build(); 

     view.Open("http://www.google.com.au"); 

     this.Add(view); 

     view.Show(); 
     view.ShowAll(); 

     this.Show(); 
     this.ShowAll(); 

     view.LoadFinished += new LoadFinishedHandler(viewLoadFinished); 
    } 

    protected void viewLoadFinished (object sender, WebKit.LoadFinishedArgs e) 
    { 
     // This is where I want to change the text of the tab, and the tab is the parent of this custom control 
    } 

    public WebView CurrentView 
    { 
     get { return view; } 
    } 

所以,有我的代码。我只是找不到笔记本标签的属性来更改

+0

请显示一些代码 –

的文本Gtk.Widget的.Parent属性显然不具有特定于父级控件的类型的属性,因为它不会被强制转换到实际的窗口小部件类型。你必须投你自己。

一旦你走了父母的列表中Gtk.Notebook,你可以调用notebook.SetTabLabelText (this, "new text");(或类似的东西,我可能不会有姓名权,因为我没有在我面前的任何代码)