R – Drawing lines in Visual Studio for Compact Framework 2.0

compact-frameworknetvisual studiowindows-mobile

I'm looking for a toolkit to allow me to draw lines and boxes at design time in Visual Studio 2008 for .NET Compact Framework 2.0.

I've looked over the VisualBasic PowerPacks but that seems to be available only for desktop .NET.

Does anyone know of any such tool?

Best Answer

Are you using WinForms? A lot of the controls implement a Site property which returns this type http://msdn.microsoft.com/en-us/library/system.componentmodel.isite.aspx is has a DesignMode property which you can use to check if it's in design mode or not.

In the void OnRender(...) method you can check this property if it's set or not and you can then draw depending on design time or not.

protected override void OnRender(...)
{
    if (this.Site != null && 
        this.Site.DesignMode) 
    {
        // Draw something...
    }
}

Check out this post about potentional problems with Site and the DesignMode property http://decav.com/blogs/andre/archive/2007/04/18/1078.aspx