I'm trying to replicate the visual basic power packs controls (rectangle, oval, and line) so that express users can get a spin of these wonderful graphic controls. However, I'm having some trouble getting the basic properties of them into the properties window instead of just the code editor window.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Dev9_Controls
{
public enum GradientStyle
{
None,
Horizontal,
Vertical,
ForwardDiagonal,
BackwardDiagonal,
Central
}
public partial class GradientRectangle : UserControl
{
private Color gColor;
private GradientStyle gStyle;
[Category("Fill Gradient Color")]
[Description("Changes the lower color of the rectangle.")]
public Color FillGradientColor
{
get
{
return gColor;
}
set
{
gColor = value;
rectangleShape1.FillGradientColor = gColor;
}
}
[Category("Border Color")]
public override Color BackColor
{
get
{
return rectangleShape1.BorderColor;
}
set
{
rectangleShape1.BorderColor = value;
}
}
[Category("Fill Color")]
[Description("Changes the upper color of the rectangle.")]
public override Color ForeColor
{
get
{
return rectangleShape1.FillColor;
}
set
{
rectangleShape1.FillColor = value;
}
}
[Category("Gradient Style")]
public GradientStyle Style
{
get
{
return gStyle;
}
set
{
gStyle = value;
if (gStyle == GradientStyle.None)
rectangleShape1.FillGradientStyle = Microsoft.VisualBasic.PowerPacks.FillGradientStyle.None;
else if (gStyle == GradientStyle.Horizontal)
rectangleShape1.FillGradientStyle = Microsoft.VisualBasic.PowerPacks.FillGradientStyle.Horizontal;
else if (gStyle == GradientStyle.Vertical)
rectangleShape1.FillGradientStyle = Microsoft.VisualBasic.PowerPacks.FillGradientStyle.Vertical;
else if (gStyle == GradientStyle.ForwardDiagonal)
rectangleShape1.FillGradientStyle = Microsoft.VisualBasic.PowerPacks.FillGradientStyle.ForwardDiagonal;
else if (gStyle == GradientStyle.BackwardDiagonal)
rectangleShape1.FillGradientStyle = Microsoft.VisualBasic.PowerPacks.FillGradientStyle.BackwardDiagonal;
else if (gStyle == GradientStyle.Central)
rectangleShape1.FillGradientStyle = Microsoft.VisualBasic.PowerPacks.FillGradientStyle.Central;
}
}
public GradientRectangle()
{
InitializeComponent();
}
}
}