Hiding TabPages from User with TabControl

Hiding TabPages from User with TabControl

Post by Leon Fries » Wed, 01 Dec 2004 07:28:24


Hi,

is there a possibilty to hide the TabPages from a TabControl and if
so, how?
What I actually want is hiding the TabPages from the user so the user
can only see and use the one TabPage I'm showing him (or her for that
matter ;-)), but wont be able to choose (or see) the TabPages.

Leon
 
 
 

Hiding TabPages from User with TabControl

Post by U2VyZ » Wed, 01 Dec 2004 11:05:03

Have you tried TabPages' Visible, Enabled properties? Also you could maybe
remove unwanted TabPage and add it back again at a later time if needed?

 
 
 

Hiding TabPages from User with TabControl

Post by Herfried K » Wed, 01 Dec 2004 16:16:44

"Leon Friesema" <leon@@frostbits.nl> schrieb:

<URL: http://www.yqcomputer.com/ ;

--
M S Herfried K. Wagner
M V P <URL: http://www.yqcomputer.com/ ;
V B <URL: http://www.yqcomputer.com/ ;
 
 
 

Hiding TabPages from User with TabControl

Post by Herfried K » Wed, 01 Dec 2004 16:17:06

"Serg" < XXXX@XXXXX.COM > schrieb:

These properties do not work.

--
M S Herfried K. Wagner
M V P <URL: http://www.yqcomputer.com/ ;
V B <URL: http://www.yqcomputer.com/ ;
 
 
 

Hiding TabPages from User with TabControl

Post by Leon Fries » Wed, 01 Dec 2004 22:15:16

On Tue, 30 Nov 2004 08:17:06 +0100, "Herfried K. Wagner [MVP]"



Correct

Leon
 
 
 

Hiding TabPages from User with TabControl

Post by Leon Fries » Wed, 01 Dec 2004 22:17:09

On Tue, 30 Nov 2004 08:16:44 +0100, "Herfried K. Wagner [MVP]"



Thanks for your reply, but, this doesn't contain the functionality I
needed. I want to hide to complete "Tabbing" header, not just single
tabs.


Leon.
 
 
 

Hiding TabPages from User with TabControl

Post by Herfried K » Thu, 02 Dec 2004 02:52:21

"Leon Friesema" <leon@@frostbits.nl> schrieb:

\\\
Me.TabControl1.Region = _
New Region( _
New RectangleF( _
Me.TabPage1.Left, _
Me.TabPage1.Top, _
Me.TabPage1.Width, _
Me.TabPage1.Height _
) _
)
///

--
M S Herfried K. Wagner
M V P <URL: http://www.yqcomputer.com/ ;
V B <URL: http://www.yqcomputer.com/ ;
 
 
 

Hiding TabPages from User with TabControl

Post by Leon Fries » Thu, 02 Dec 2004 03:14:56

On Tue, 30 Nov 2004 18:52:21 +0100, "Herfried K. Wagner [MVP]"



Interesting example :-) Does work, but now I got problems with
Docking-Style: Fill.. Maybe I can change some parts. Thanks anyway

Leon.
 
 
 

Hiding TabPages from User with TabControl

Post by U2VyZ » Thu, 02 Dec 2004 03:39:04

I didn't realize you needed to hide tab headers. Have you tried DotNetMagic
tab control? It has all the functionality one would ever need.

http://www.yqcomputer.com/

I remember the source code was free also, not sure that's the case now.
 
 
 

Hiding TabPages from User with TabControl

Post by Mick Doher » Thu, 02 Dec 2004 16:21:35

ttp://dotnetrix.co.uk/tabcontrols.html --> An alternative method of tabpage
navigation.

As an alternative why not use a collection of Panels?
Here's a start (Needs a little work but it'll do the job).
\\\
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing.Design

Public Class PanelCollection
Inherits System.Windows.Forms.ScrollableControl

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call
setstyle(ControlStyles.AllPaintingInWmPaint Or
ControlStyles.DoubleBuffer Or ControlStyles.ResizeRedraw Or
ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
MyBase.DockPadding.All = 3

End Sub

'UserControl overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container
End Sub

#End Region

<Editor(GetType(PanelCollectionEditor), GetType(UITypeEditor))> _
Public ReadOnly Property Panels() As ControlCollection
Get
Return MyBase.Controls
End Get
End Property

Private m_SelectedPanel As Panel = Nothing

Public Property SelectedPanel() As Panel
Get
If Controls.Count > 0 Then
Return m_SelectedPanel
End If
End Get
Set(ByVal Value As Panel)
If Value Is m_SelectedPanel Then Return
If m_SelectedPanel Is Nothing = False Then
m_SelectedPanel.Visible = False
End If
m_SelectedPanel = Value
If Value Is Nothing Then Return
m_SelectedPanel.Visible = True
End Set
End Property

Protected Overrides ReadOnly Property DefaultSize() As
System.Drawing.Size
Get
Return New Size(200, 100)
End Get
End Property

Protected Overrides Sub OnControlAdded(ByVal e As
System.Windows.Forms.ControlEventArgs)
If TypeOf e.Control Is Panel Then
e.Control.Dock = DockStyle.Fill
SelectedPanel = CType(e.Control, Panel)
Else
Throw New ArgumentException("Only Panels can be added to a
PanelCollection")
End If
End Sub

Friend Class PanelCollectionEditor
Inherits CollectionEditor

Public Sub New(ByVal type As System.Type)
MyBase.new(type)
End Sub

Protected Overrides Function CreateCollectionItemType() As
System.Type
Return GetType(Panel)
End Function

End Class

<Browsable(False), EditorBrowsable(EditorBrowsableState.Never