57 lines
1.8 KiB
C#

using DevComponents.DotNetBar.Controls;
using DevComponents.DotNetBar.Rendering;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Text;
using System.Windows.Forms.Design;
namespace DevComponents.DotNetBar.Design
{
public class TokenEditorDesigner : ControlDesigner
{
#region Private Variables
#endregion
#region Constructor
#endregion
#region Internal Implementation
public override void Initialize(System.ComponentModel.IComponent component)
{
base.Initialize(component);
if (component == null || component.Site == null || !component.Site.DesignMode)
return;
IDesignerHost dh = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
if (dh != null)
dh.LoadComplete += DesignerLoadComplete;
}
private void DesignerLoadComplete(object sender, EventArgs e)
{
IDesignerHost dh = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
if (dh != null)
dh.LoadComplete -= DesignerLoadComplete;
System.Windows.Forms.Control c = this.Control;
if (c != null && !string.IsNullOrEmpty(c.Text))
TypeDescriptor.GetProperties(c)["Text"].SetValue(c, "");
}
public override void InitializeNewComponent(System.Collections.IDictionary defaultValues)
{
TokenEditor c = this.Control as TokenEditor;
if (c != null)
{
c.BackgroundStyle.Class = ElementStyleClassKeys.DateTimeInputBackgroundKey;
c.Separators.Add(";");
c.Separators.Add(",");
}
base.InitializeNewComponent(defaultValues);
}
#endregion
}
}