This is the following code which is written in vs 2003, i want to convert that to 2005 . i want to know how to write the design time support and metadata assembly.
thank you
using System;
using System.Data;
using System.Windows.Forms;
using System.Drawing;
#if NETCFDESIGNTIME
[assembly: System.CF.Design.RuntimeAssemblyAttribute("SmartCheckbox,Version=1.0.2.0,Culture=neutral,PublicKeyToken=null")]
#endif
namespace SmartCheckbox
{
///
/// SmartCheckbox is a derivative of the CheckBox control. The minus and enter keys can each be
/// used to check or uncheck the control. This is useful when we don't have a plus or space key
/// on the keypad.
///
public class SmartCheckbox : System.Windows.Forms.CheckBox
{
8.25f, System.Drawing.FontStyle.Regular);
public override System.Drawing.Font Font
{
get
{
return(base.Font);
}
set
{
if ( value == null )
base.Font = _defaultFont;
else
{
//if ( value == System.Windows.Forms.Control.DefaultFont )
// base.Font = _defaultFont;
//else
base.Font = value;
}
}
}
public SmartCheckbox()
{
Font = _defaultFont;
}
///
/// Handles Keypad input. Uses the minus and Enter keys to toggle the checkbox on/off.
///
///
protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
{
if ( e.KeyCode == Keys.Enter ||
e.KeyCode == Keys.Subtract || // This is KeyValue 109. Keypad sends 189.
e.KeyValue == 189 ) // Keys.OemMinus (Frikkin enum not supported by CF!!!)
{
Checked = !Checked;
e.Handled = true;
}
base.OnKeyDown(e);
}
protected override void OnKeyUp(KeyEventArgs e)
{
if ( e.KeyValue == 189 )
e.Handled = true;
base.OnKeyUp (e);
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
if ( e.KeyChar == (char)45 || // ASCII '-' (This is what gets caught in PocketAE)
e.KeyChar == (char)26 ) // ASCII 'SUB'
{
e.Handled = true;
}
base.OnKeyPress (e);
}
}
}
Replies
Know the answer? Post it — somebody with the same question will find it here.