rjdelrosario

Hello to all.

I would like to implement a multiview like control in Windows Forms. Is this achievable What are the possible implementations for this Code samples will help. Thanks in advance!

- Raymond



Re: Windows Forms General Multiview like control in Windows Forms

nobugz

You are not going to get any decent answers on this question until you define the term "multiview".





Re: Windows Forms General Multiview like control in Windows Forms

rjdelrosario

I'm referring to the Multiview Control in ASP.NET 2.0. How can I implement this in Windows Forms Thanks again.



Re: Windows Forms General Multiview like control in Windows Forms

Yu Guo ĘC MSFT

Hi, rjdelrosario,

I think TabControl is just what you want in Windows Forms,

and you can change its view by clicking the tabs.

Please check the following URL to learn more about TabControl

http://msdn2.microsoft.com/en-us/library/system.windows.forms.tabcontrol.tabpages(VS.80).aspx

Hope this helps,

Regards






Re: Windows Forms General Multiview like control in Windows Forms

rjdelrosario

Hi Yu.

I'm afraid the TabControl isn't exactly what I'm looking for. I'm looking for a control implementation that looks like the interface on "My Computer" (you click on icons on the left side and then the proper screens / UI show up at the center). What is the best way of implementing this

Thanks in advance.

- Raymond





Re: Windows Forms General Multiview like control in Windows Forms

Yu Guo ĘC MSFT

Hi, rjdelrosario,

It's not always easy to find a best way Smile

If you are new to Windows Form programming,

then just use some Panel controls.

And if you click some buttons.

you can show a panel,

and hide all the other panels.

Information about panel control,

http://msdn2.microsoft.com/en-us/library/system.windows.forms.panel(VS.80).aspx

But it would be difficult to design your UI.

However, if you are familiar with the matter of how to write customized controls,

here is a small sample for a Customized TabControl which can hide its tabs.

Then you can use buttons to chang its tab status.

using System;

Code Snippet

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DataGridView
{
[ToolboxBitmap(typeof(System.Windows.Forms.TabControl))]
public partial class TabControl : System.Windows.Forms.TabControl
{
private bool m_HideTabs = false;

[DefaultValue(false)]
[RefreshProperties(RefreshProperties.All)]
public bool HideTabs
{
get { return m_HideTabs; }
set
{
if (m_HideTabs == value) return;
m_HideTabs = value;
if (value == true) this.Multiline = true;
this.UpdateStyles();
}
}

[RefreshProperties(RefreshProperties.All)]
public new bool Multiline
{
get
{
if (this.HideTabs) return true;
return base.Multiline;
}
set
{
if (this.HideTabs)
base.Multiline = true;
else
base.Multiline = value;
}
}

public override System.Drawing.Rectangle DisplayRectangle
{
get
{
if (this.HideTabs)
return new Rectangle(0, 0, Width, Height);
else
{
int tabStripHeight, itemHeight;

if (this.Alignment <= TabAlignment.Bottom)
itemHeight = this.ItemSize.Height;
else
itemHeight = this.ItemSize.Width;

if (this.Appearance == TabAppearance.Normal)
tabStripHeight = 5 + (itemHeight * this.RowCount);
else
tabStripHeight = (3 + itemHeight) * this.RowCount;

switch (this.Alignment)
{
case TabAlignment.Bottom:
return new Rectangle(4, 4, Width - 8, Height - tabStripHeight - 4);
case TabAlignment.Left:
return new Rectangle(tabStripHeight, 4, Width - tabStripHeight - 4, Height - 8);
case TabAlignment.Right:
return new Rectangle(4, 4, Width - tabStripHeight - 4, Height - 8);
default:
return new Rectangle(4, tabStripHeight, Width - 8, Height - tabStripHeight - 4);
}

}

}

}

}

}

Hope this helps,

Regards