Martin,
Thanks for the kind reply. I did implement the steps as you described. The below is my DesignerOptions and DesignerOptionService implementation (benefited from this forum)
using System;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using System.ComponentModel.Design;
namespace MyDesignerHost
{
public class AtlasOptionServiceProvider : IServiceProvider
{
private DesignerOptionService dos = new OptionService();
#region IServiceProvider Members
public object GetService(Type serviceType)
{
if (serviceType == typeof(DesignerOptionService))
{
return dos;
}
return null;
}
#endregion
private class OptionService : DesignerOptionService
{
protected override void PopulateOptionCollection(DesignerOptionCollection options)
{
if (options.Parent == null)
{
base.CreateOptionCollection(options, "DesignerOptions", new Options());
}
}
}
private class Options : DesignerOptions
{
public override bool UseSmartTags
{
get
{
return true;
}
}
public override bool UseSnapLines
{
get
{
return false;
}
}
public override bool ShowGrid
{
get
{
return true;
}
}
}
}
}
Then I added the service in the designerhost implementation:
AtlasOptionServiceProvider aosp = new AtlasOptionServiceProvider();
designerOptionService = aosp.GetService(typeof(DesignerOptionService)) as DesignerOptionService;
serviceContainer.AddService(typeof(DesignerOptionService), designerOptionService);
The smartTag feature still cannot be activated. However, the snapline and showgrid feature works as expected. I have no clue at this point what went wrong. Could you please shed more light on this, preferably with some code demo. Thank you!
Alan
source: http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/e08ef80a-75b8-4229-b53c-2f16ff07dbd3