当前位置: 首页>>代码示例>>C#>>正文


C# IDesignerHost类代码示例

本文整理汇总了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 };
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:ListenDesigner.cs

示例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 };
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:ParallelDesigner.cs

示例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;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:7,代码来源:SampleToolboxService.cs

示例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));
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:35,代码来源:ControlIdConverter.cs

示例5: CreateComponentsCore

 protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
 {
     CompositeActivity activity = new ParallelActivity {
         Activities = { new SequenceActivity(), new SequenceActivity() }
     };
     return new IComponent[] { activity };
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ParallelToolboxItem.cs

示例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);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:TextDataBindingHandler.cs

示例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);
             }
         }
     }
 }
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:25,代码来源:DropSourceBehavior.cs

示例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) };
 }
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:32,代码来源:ToolStripTemplateNode.cs

示例9: InfoTransactionEditorDialog

        public InfoTransactionEditorDialog(InfoTransaction trans, IDesignerHost host)
        {
            transaction = trans;
            DesignerHost = host;

            InitializeComponent();
        }
开发者ID:san90279,项目名称:UK_OAS,代码行数:7,代码来源:InfoTransactionEditorDialog.cs

示例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!");
            }
        }
开发者ID:san90279,项目名称:UK_OAS,代码行数:30,代码来源:AjaxScheduleDesigner.cs

示例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));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:ControlIDConverter.cs

示例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;
 }
开发者ID:Nathan-M-Ross,项目名称:i360gm,代码行数:34,代码来源:DesignerTransactionUtility.cs

示例13: CreateComponentsCore

 protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
 {
     CompositeActivity activity = new ListenActivity {
         Activities = { new EventDrivenActivity(), new EventDrivenActivity() }
     };
     return new IComponent[] { activity };
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ListenToolboxItem.cs

示例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);
 }
开发者ID:Reegenerator,项目名称:Sample-CustomizeDatasetCS,代码行数:31,代码来源:SelectionUIService.cs

示例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 };
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:ConditionalDesigner.cs


注:本文中的IDesignerHost类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。