I'm trying to incorporate my custom control called "windmill" into my application extension. I've created a few properties that I want to be visible in the properties window and when I built my project and tried to use it in a test project it did not work. To top it off, the main functionality of the control isn't working either. The basic idea is to create four rectangular objects (using the visual basic power packs rectangle control) and at run-time, change one rectangle's color after the other in sequential clockwise order on a timer tick event. However it's not working, yet when I click the custom control during debugging the color becomes brighter but never moves. Below is my source code for the custom control.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.Design;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Dev9
{
public partial class Windmill : UserControl
{
public Windmill()
{
InitializeComponent();
timer1.Start();
}
public override Color ForeColor
{
get
{
return UpperLeft.FillGradientColor;
}
set
{
// I feel that this is the problem with both color sets.
UpperLeft.FillGradientColor = value;
UpperRight.FillGradientColor = value;
LowerLeft.FillGradientColor = value;
LowerRight.FillGradientColor = value;
}
}
public override Color BackColor
{
get
{
return UpperLeft.FillColor;
}
set
{
UpperLeft.FillColor = value;
UpperRight.FillColor = value;
LowerLeft.FillColor = value;
LowerRight.FillColor = value;
}
}
[Browsable(true)]
public Color RotationForeColor = Color.White;
[Browsable(true)]
public Color RotationBackColor = Color.Gray;
[Browsable(true)]
public int Speed = 100;
private void Rotate(object sender, EventArgs e)
{
timer1.Interval = Speed;
if (UpperLeft.FillColor == RotationBackColor)
{
UpperLeft.FillColor = BackColor;
UpperLeft.FillGradientColor = ForeColor;
UpperRight.FillColor = RotationBackColor;
UpperRight.FillGradientColor = RotationForeColor;
}
else if (UpperRight.FillColor == RotationBackColor)
{
UpperRight.FillColor = BackColor;
UpperRight.FillGradientColor = ForeColor;
LowerRight.FillColor = RotationBackColor;
LowerRight.FillGradientColor = RotationForeColor;
}
else if (LowerRight.FillColor == RotationBackColor)
{
LowerRight.FillColor = BackColor;
LowerRight.FillGradientColor = ForeColor;
LowerLeft.FillColor = RotationBackColor;
LowerLeft.FillGradientColor = RotationForeColor;
}
else if (LowerLeft.FillColor == RotationBackColor)
{
LowerLeft.FillColor = BackColor;
LowerLeft.FillGradientColor = ForeColor;
UpperLeft.FillColor = RotationBackColor;
UpperLeft.FillGradientColor = RotationForeColor;
}
}
}
}