I'm trying to make a Textbox with a FocusColor property...When the focus
changes to the
control, the backcolor must change automaticly to the color setted by the
focusColor property.
Very simple, the control works fine when creating it dynamicly from code.
My aim is to add design functionality, so I can use it from the Visual
Studio .Net toolbox.
When I compile my code, no errors are reproted and Visual studio leaves a
dll in the release directory. (cdaTextBox.dll)
Even making a design time dll succeeded (design.cdaTextBox.dll). To make
such a dll, I use the command line compiler csc.exe from within a batch file
'Build.bat'. Csc.exe does not report any errors.
But, and this is my problem, when I try to add the control to the toolbox,
Visual Studio fires an error:
There are no components in 'C:\Program Files\Microsoft Visual Studio
.NET 2003\CompactFrameworkSDK\v1.0.5000
\Windows CE\Designer\design.cdaTextBox.dll' That can be placed on the
toolbox.
Can someone tell me what I have to change to my code to make it working?
This is the batchfile code (it runs well):
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\csc.exe /noconfig
/define:NETCFDESIGNTIME /target:library /out:design.cdaTextBox.dll
cdaTextBox.cs AssemblyInfo.cs /res:DatAction.Controls.cdaTextBox.bmp
/r:"C:\Program Files\Microsoft Visual Studio .NET
2003\CompactFrameworkSDK\v1.0.5000\Windows CE\Designer\System.CF.Design.dll"
/r:"C:\Program Files\Microsoft Visual Studio .NET
2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Windows.Forms.dll" /r:"C:\Program Files\Microsoft
Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows
CE\Designer\System.CF.Drawing.dll" /r:System.Windows.Forms.dll
/r:System.Drawing.dll /r:System.dll /r:System.XML.dll /r:System.Data.dll
/nowarn:1595 >z.txt
This is My C# code:
using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.ComponentModel;
#if NETCFDESIGNTIME
[assembly: System.CF.Design.RuntimeAssemblyAttribute("PictureButton,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")]
#endif
namespace Company.Controls
{
class cdaTextBox: System.Windows.Forms.TextBox
{
#region "Private data members"
private System.Drawing.Color mFocusColor = System.Drawing.Color.Blue;
private System.Drawing.Color mFocusTextColor =
System.Drawing.Color.Yellow;
private System.Drawing.Color mOriginalColor;
private System.Drawing.Color mOrinalTextColor;
#endregion
#region "Properties!"
#if NETCFDESIGNTIME
[
System.ComponentModel.Category("Colours"),
System.ComponentModel.Description("This our colours")
]
#endif
public System.Drawing.Color FocusColor
{
get
{
return mFocusColor;
}
set
{
mFocusColor=value;
}
}
#if NETCFDESIGNTIME
[
System.ComponentModel.Category("Colours"),
System.ComponentModel.Description("This our colours")
]
#endif
public System.Drawing.Color FocusTextColor
{
get
{
return mFocusTextColor;
}
set
{
mFocusTextColor=value;
}
}
#endregion
protected override void OnGotFocus(System.EventArgs e)
{
mOriginalColor = this.BackColor;
mOrinalTextColor = this.ForeColor;
this.BackColor = mFocusColor;
this.ForeColor = mFocusTextColor;
}
protected override void OnLostFocus(System.EventArgs e)
{
this.BackColor = mOriginalColor;
this.ForeColor = mOrinalTextColor;
}
}
}