本文整理汇总了C#中IDesignerHost类的典型用法代码示例。如果您正苦于以下问题:C# IDesignerHost类的具体用法?C# IDesignerHost怎么用?C# IDesignerHost使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDesignerHost类属于命名空间,在下文中一共展示了IDesignerHost类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateComponentsCore
protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
{
CompositeActivity listenActivity = new ListenActivity();
listenActivity.Activities.Add(new EventDrivenActivity());
listenActivity.Activities.Add(new EventDrivenActivity());
return (IComponent[])new IComponent[] { listenActivity };
}
示例2: CreateComponentsCore
protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
{
CompositeActivity parallelActivity = new ParallelActivity();
parallelActivity.Activities.Add(new SequenceActivity());
parallelActivity.Activities.Add(new SequenceActivity());
return (IComponent[])new IComponent[] { parallelActivity };
}
示例3: SampleToolboxService
public SampleToolboxService(IDesignerHost host)
{
this.host = host;
// Our MainForm adds our ToolboxPane to the host's services.
toolbox = host.GetService(typeof(SampleDesignerApplication.ToolBoxPane)) as SampleDesignerApplication.ToolBoxPane;
}
示例4: GetControls
/// <devdoc>
/// Returns a list of all control IDs in the container.
/// </devdoc>
private string[] GetControls(IDesignerHost host, object instance) {
IContainer container = host.Container;
// Locate nearest container
IComponent component = instance as IComponent;
if (component != null && component.Site != null) {
container = component.Site.Container;
}
if (container == null) {
return null;
}
ComponentCollection allComponents = container.Components;
ArrayList array = new ArrayList();
// For each control in the container
foreach (IComponent comp in (IEnumerable)allComponents) {
Control control = comp as Control;
// Ignore DesignerHost.RootComponent (Page or UserControl), controls that don't have ID's,
// and the Control itself
if (control != null &&
control != instance &&
control != host.RootComponent &&
control.ID != null &&
control.ID.Length > 0 &&
FilterControl(control)) {
array.Add(control.ID);
}
}
array.Sort(Comparer.Default);
return (string[])array.ToArray(typeof(string));
}
示例5: CreateComponentsCore
protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
{
CompositeActivity activity = new ParallelActivity {
Activities = { new SequenceActivity(), new SequenceActivity() }
};
return new IComponent[] { activity };
}
示例6: DataBindControl
public override void DataBindControl(IDesignerHost designerHost, Control control)
{
DataBinding runtimeDataBinding = ((IDataBindingsAccessor) control).DataBindings["Text"];
if (runtimeDataBinding != null)
{
PropertyInfo property = control.GetType().GetProperty("Text");
if ((property != null) && (property.PropertyType == typeof(string)))
{
DesignTimeDataBinding binding2 = new DesignTimeDataBinding(runtimeDataBinding);
string str = string.Empty;
if (!binding2.IsCustom)
{
try
{
str = DataBinder.Eval(((IDataItemContainer) control.NamingContainer).DataItem, binding2.Field, binding2.Format);
}
catch
{
}
}
if ((str == null) || (str.Length == 0))
{
str = System.Design.SR.GetString("Sample_Databound_Text");
}
property.SetValue(control, str, null);
}
}
}
示例7: DropSourceBehavior
internal DropSourceBehavior(ICollection dragComponents, Control source, Point initialMouseLocation)
{
this.serviceProviderSource = source.Site;
if (this.serviceProviderSource != null)
{
this.behaviorServiceSource = (BehaviorService) this.serviceProviderSource.GetService(typeof(BehaviorService));
if ((this.behaviorServiceSource != null) && ((dragComponents != null) && (dragComponents.Count > 0)))
{
this.srcHost = (IDesignerHost) this.serviceProviderSource.GetService(typeof(IDesignerHost));
if (this.srcHost != null)
{
this.data = new BehaviorDataObject(dragComponents, source, this);
this.allowedEffects = DragDropEffects.Move | DragDropEffects.Copy;
this.dragComponents = new DragComponent[dragComponents.Count];
this.parentGridSize = Size.Empty;
this.lastEffect = DragDropEffects.None;
this.lastFeedbackLocation = new Point(-1, -1);
this.lastSnapOffset = Point.Empty;
this.dragImageRect = Rectangle.Empty;
this.clearDragImageRect = Rectangle.Empty;
this.InitiateDrag(initialMouseLocation, dragComponents);
}
}
}
}
示例8: ToolStripTemplateNode
public ToolStripTemplateNode(IComponent component, string text, Image image)
{
this.component = component;
this.activeItem = component as ToolStripItem;
this._designerHost = (IDesignerHost) component.Site.GetService(typeof(IDesignerHost));
this._designer = this._designerHost.GetDesigner(component);
this._designSurface = (DesignSurface) component.Site.GetService(typeof(DesignSurface));
if (this._designSurface != null)
{
this._designSurface.Flushed += new EventHandler(this.OnLoaderFlushed);
}
if (!isScalingInitialized)
{
if (System.Windows.Forms.DpiHelper.IsScalingRequired)
{
TOOLSTRIP_TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x16);
TEMPLATE_HEIGHT = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsY(0x13);
TOOLSTRIP_TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x5c);
TEMPLATE_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(0x1f);
TEMPLATE_HOTREGION_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(9);
MINITOOLSTRIP_DROPDOWN_BUTTON_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(11);
MINITOOLSTRIP_TEXTBOX_WIDTH = System.Windows.Forms.DpiHelper.LogicalToDeviceUnitsX(90);
}
isScalingInitialized = true;
}
this.SetupNewEditNode(this, text, image, component);
this.commands = new MenuCommand[] {
new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyMoveRight), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Delete), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Cut), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Copy), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeUp), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeDown), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeLeft), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeRight), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeySizeHeightDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthIncrease),
new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightIncrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeWidthDecrease), new MenuCommand(new EventHandler(this.OnMenuCut), MenuCommands.KeyNudgeHeightDecrease)
};
this.addCommands = new MenuCommand[] { new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Undo), new MenuCommand(new EventHandler(this.OnMenuCut), StandardCommands.Redo) };
}
示例9: InfoTransactionEditorDialog
public InfoTransactionEditorDialog(InfoTransaction trans, IDesignerHost host)
{
transaction = trans;
DesignerHost = host;
InitializeComponent();
}
示例10: GenButtons
public void GenButtons(object sender, EventArgs e)
{
if (schedule == null)
{
schedule = this.Component as AjaxSchedule;
}
if (schedule.ScheduleButtons.Count == 0)
{
if (host == null)
{
host = (IDesignerHost)this.GetService(typeof(IDesignerHost));
}
if (svcCompChange == null)
{
svcCompChange = (IComponentChangeService)this.GetService(typeof(IComponentChangeService));
}
DesignerTransaction trans = host.CreateTransaction("Generate buttons");
this.addButton(AjaxScheduleButtonType.PreviousYear, "<<");
this.addButton(AjaxScheduleButtonType.Previous, "<");
this.addButton(AjaxScheduleButtonType.NextYear, ">>");
this.addButton(AjaxScheduleButtonType.Next, ">");
this.addButton(AjaxScheduleButtonType.Today, "today");
this.addButton(AjaxScheduleButtonType.Month, "month");
this.addButton(AjaxScheduleButtonType.Week, "week");
this.addButton(AjaxScheduleButtonType.Day, "day");
trans.Commit();
MessageBox.Show("generate buttons successful!");
}
}
示例11: GetControls
private string[] GetControls(IDesignerHost host, object instance)
{
IContainer container = host.Container;
IComponent component = instance as IComponent;
if ((component != null) && (component.Site != null))
{
container = component.Site.Container;
}
if (container == null)
{
return null;
}
ComponentCollection components = container.Components;
ArrayList list = new ArrayList();
foreach (IComponent component2 in components)
{
Control control = component2 as Control;
if ((((control != null) && (control != instance)) && ((control != host.RootComponent) && (control.ID != null))) && ((control.ID.Length > 0) && this.FilterControl(control)))
{
list.Add(control.ID);
}
}
list.Sort(Comparer.Default);
return (string[]) list.ToArray(typeof(string));
}
示例12: DoInTransaction
public static object DoInTransaction(IDesignerHost theHost, string theTransactionName, TransactionAwareParammedMethod theMethod, object theParam)
{
DesignerTransaction transaction = null;
object obj2 = null;
try
{
transaction = theHost.CreateTransaction(theTransactionName);
obj2 = theMethod(theHost, theParam);
}
catch (CheckoutException exception)
{
if (exception != CheckoutException.Canceled)
{
throw exception;
}
}
catch
{
if (transaction != null)
{
transaction.Cancel();
transaction = null;
}
throw;
}
finally
{
if (transaction != null)
{
transaction.Commit();
}
}
return obj2;
}
示例13: CreateComponentsCore
protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
{
CompositeActivity activity = new ListenActivity {
Activities = { new EventDrivenActivity(), new EventDrivenActivity() }
};
return new IComponent[] { activity };
}
示例14: SelectionUIService
public SelectionUIService(IDesignerHost host)
{
base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.StandardClick | ControlStyles.Opaque, true);
this.host = host;
this.dragHandler = null;
this.dragComponents = null;
this.selectionItems = new Hashtable();
this.selectionHandlers = new Hashtable();
this.AllowDrop = true;
this.Text = "SelectionUIOverlay";
this.selSvc = (ISelectionService) host.GetService(typeof(ISelectionService));
if (this.selSvc != null)
{
this.selSvc.SelectionChanged += new EventHandler(this.OnSelectionChanged);
}
host.TransactionOpened += new EventHandler(this.OnTransactionOpened);
host.TransactionClosed += new DesignerTransactionCloseEventHandler(this.OnTransactionClosed);
if (host.InTransaction)
{
this.OnTransactionOpened(host, EventArgs.Empty);
}
IComponentChangeService service = (IComponentChangeService) host.GetService(typeof(IComponentChangeService));
if (service != null)
{
service.ComponentRemoved += new ComponentEventHandler(this.OnComponentRemove);
service.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged);
}
SystemEvents.DisplaySettingsChanged += new EventHandler(this.OnSystemSettingChanged);
SystemEvents.InstalledFontsChanged += new EventHandler(this.OnSystemSettingChanged);
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(this.OnUserPreferenceChanged);
}
示例15: CreateComponentsCore
protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
{
CompositeActivity conditionalActivity = new IfElseActivity();
conditionalActivity.Activities.Add(new IfElseBranchActivity());
conditionalActivity.Activities.Add(new IfElseBranchActivity());
return (IComponent[])new IComponent[] { conditionalActivity };
}