English 中文(简体)
WinForm TabControl: 如何生动地隐藏/tab头??
原标题:WinForm TabControl: How to hide/show tab headers dynamically?

我想把我的表象“Control”变成一个小小小小小 to,以拯救一些屏幕上的房地产: 如果只有一张表格,只要有两条或两条以上表格就显示制片头。

我知道,你可以按照

最佳回答
问题回答

严重挖掘了一条轨道,但我知道另一种解决办法。 我不知道它来自什么地方,但这里是:

(VB.NET)

Tabcontrol1.Region = New Region (New RectangleF(TabPage1.Left, TabPage1.Top, TabPage1.Width, TabPage1.Height))

<代码>TabControl1为您的制表控制的名称和TabPage 1为这一控制的第一个制表页。

如果你想把它当作例行公事,你可以做这样的事情:

Public Sub hideTabs(ByVal TC as TabControl)
    TC.Region = New Region(New RectangleF(TC.TabPages(0).Left,TC.TabPages(0).Top, TC.TabPages(0).Width, TC.TabPages(0).Height))
End Sub

这是一件容易的事。 令人信服的是,头盔没有在运行时间显示,但在设计时间可以发现。

扩大汉斯的答复:

我想让TabaControl也能在设计时间隐藏制片,但当时存在一个问题,即一旦你藏有制片,就没有办法选择TabControl再翻一番,从而形成一种能够控制这一财产的习俗。

Imports System.Windows.Forms

Public Class NoHeaderTabPage
Inherits TabPage

Public Property ShowTabs() As Boolean
    Get
        Return CType(Me.Parent, NoHeaderTabControl).ShowTabs
    End Get
    Set(ByVal value As Boolean)
        CType(Me.Parent, NoHeaderTabControl).ShowTabs = value
    End Set
End Property

End Class




相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签