Custom Control,visual studio 2005,visual studio 2003

Nov 26 2007 3:43 PM
working in conversion of vs2003,custom control programming . i want to upgrade that to vs2005,.net compact framework 2.0.

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

{

/// <summary>

/// 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.

/// </summary>

public class SmartCheckbox : System.Windows.Forms.CheckBox

{

private static Font _defaultFont = new Font("Arial",

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;

}

/// <summary>

/// Handles Keypad input. Uses the minus and Enter keys to toggle the checkbox on/off.

/// </summary>

/// <param name="e"></param>

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);

}

}

}