using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace Elsehemy.Controls
{
[Designer(typeof(UserControlDesigner))]
[PropertyTab(typeof(ExtraSuperTab),
PropertyTabScope.Component)]
public partial class TestUserControl : UserControl
{
public TestUserControl()
{
InitializeComponent();
}
int _x;
public int XXX
{
get { return _x; }
set { _x = value; }
}
}
public class ExtraSuperTab :
System.Windows.Forms.Design.PropertyTab
{
public override PropertyDescriptorCollection
GetProperties(object component,
Attribute[] attributes)
{
PropertyDescriptor pd =
TypeDescriptor.CreateProperty(
component.GetType(),
"XXX",
typeof(int),
new CategoryAttribute("Super Properties"));
return (
new PropertyDescriptorCollection(
new PropertyDescriptor[]{pd}
));
}
public override string TabName
{
get { return "Super Tab"; }
}
public override System.Drawing.Bitmap Bitmap
{
get
{
return (System.Drawing.Bitmap)System.
Drawing.Image.FromFile(@"C:\icon.jpg");
}
}
}
}
And in the control don't forget the attribute
[PropertyTab(typeof(ExtraSuperTab),
PropertyTabScope.Component)]
public partial class TestUserControl : UserControl
Via Amr Elsehemy's Blog
No comments:
Post a Comment