Unable to get custom design-time textbox on form


P

PeterB

Hi!

I have created a custom textbox with design time support (almost) using this
article:
http://www.intelliprog.com/articles/index.html

I even added some custom icons using the info in this thread:
http://groups.google.com/groups?hl=...soft.public.dotnet.framework.compactframework

The article above is however using a label as control so I am using the
following code to implement the design-time support (stolen from OpenNETCF's
TextBoxEx control *thanks guys*) and only changed the name of the
constructor and destrucor.

My three textboxes is shown in VS (.NET 2003) (with my pretty icons), but
when dragging them to a form (form1.cs) nothing is shown on the form and no
code is added to form1.cs. What could be the reason for this???

I am compiling three textboxes into 1 dll and my
System.CF.Design.RuntimeAssemblyAttribute is in the AssemblyInfo.cs file,
and another problem I have is that the version of the file (also shown in
the toolbox customization window) says 0.0.0.0 but I have 2.0.0.1 both in
the RuntimeAssemblyAttribute clause and in the assembly:AssemblyVersion
information in AssemblyInfo.cs.

Any suggestions would be greatly appreciated!

regards,

Peter
 
Ad

Advertisements

P

PeterB

This is the Design time code, everything else is left out from design compilation:

#if DESIGN
/// <summary>
/// Constructor
/// </summary>
public TextBoxEdit()
{
BorderStyle = BorderStyle.FixedSingle;
}

/// <summary>
/// Destructor
/// </summary>
~TextBoxEdit()
{
}

#region ------------ Design time painting ------------

/// <summary>
/// Paints the background of the control.
/// </summary>
/// <param name="e">A PaintEventArgs that contains information about the control to paint.</param>
protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e)
{
//base.OnPaintBackground(e);
}

/// <summary>
/// OnPaint override
/// </summary>
protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea)
{
Pen pb = new Pen(Color.Black);

SolidBrush bw = new SolidBrush(Color.White);
SolidBrush bb = new SolidBrush(Color.Black);
SolidBrush bg = new SolidBrush(Color.Gray);

if (this.ReadOnly)
pea.Graphics.FillRectangle(bg,this.ClientRectangle);
else
pea.Graphics.FillRectangle(bw,this.ClientRectangle);

pea.Graphics.DrawString(
this.Text,
this.Font,
bb,
2,
2);

pb.Dispose();

bb.Dispose();
bw.Dispose();
bg.Dispose();

//base.OnPaint(pea);
}

/// Raises the Resize event.
/// </summary>
/// <param name="e">An EventArgs that contains the event data.</param>
protected override void OnResize(System.EventArgs e)
{
this.Invalidate();

base.OnResize(e);
}
#endregion
#endif
 

Top