• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IDesignerHost类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IDesignerHost的典型用法代码示例。如果您正苦于以下问题:C# IDesignerHost类的具体用法?C# IDesignerHost怎么用?C# IDesignerHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IDesignerHost类属于命名空间,在下文中一共展示了IDesignerHost类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: ChangeToolStripParentVerb

 internal ChangeToolStripParentVerb(string text, ToolStripDesigner designer)
 {
     this._designer = designer;
     this._provider = designer.Component.Site;
     this._host = (IDesignerHost) this._provider.GetService(typeof(IDesignerHost));
     this.componentChangeSvc = (IComponentChangeService) this._provider.GetService(typeof(IComponentChangeService));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ChangeToolStripParentVerb.cs


示例17: CreateComponentsCore

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


示例18: DeserializeToolboxItem

		// We don't really deserialize a tool box item, we fabricate
		// it is the drag source is a node that has a type.  Otherwise
		// we just return null indicating this is not from the toolbox
		public ToolboxItem DeserializeToolboxItem(Object obj, IDesignerHost host)
		{
			//Console.WriteLine("TBS:DeserializeToolBoxItem " + obj);
			if (!(obj is IDataObject))
				return null;
			IDataObject data = (IDataObject)obj;
			bool found = false;
			IDragDropItem sourceNode = null;
			// Look for a node that represents a type, this is either
			// a constructor or a type node
			foreach (Type t in BrowserTree.DragSourceTypes) {
				sourceNode = (IDragDropItem)data.GetData(t);
				if (sourceNode != null && sourceNode is ITargetType) {
					found = true;
					break;
				}
			}
			if (!found)
				return null;
			Type type = ((ITargetType)sourceNode).Type;
			if (!(typeof(Control).IsAssignableFrom(type)))
				return null;
			IDesignSurfaceNode dNode = (IDesignSurfaceNode)sourceNode;
			if (!dNode.OnDesignSurface)
				return null;
			ToolboxItem ti = new ToolboxItem(type);
			ti.ComponentsCreated += new ToolboxComponentsCreatedEventHandler(ComponentsCreated);
			return ti;
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:32,代码来源:ToolBoxService.cs


示例19: CreateComponentsCore

        // 

        protected override IComponent[] CreateComponentsCore(IDesignerHost host)
        {
            Type typeOfComponent = GetType(host, AssemblyName, TypeName, true);

            if (typeOfComponent == null && host != null)
                typeOfComponent = host.GetType(TypeName);

            if (typeOfComponent == null)
            {
                ITypeProviderCreator tpc = null;
                if (host != null)
                    tpc = (ITypeProviderCreator)host.GetService(typeof(ITypeProviderCreator));
                if (tpc != null)
                {
                    System.Reflection.Assembly assembly = tpc.GetTransientAssembly(this.AssemblyName);
                    if (assembly != null)
                        typeOfComponent = assembly.GetType(this.TypeName);
                }

                if (typeOfComponent == null)
                    typeOfComponent = GetType(host, AssemblyName, TypeName, true);
            }

            ArrayList comps = new ArrayList();
            if (typeOfComponent != null)
            {
                if (typeof(IComponent).IsAssignableFrom(typeOfComponent))
                    comps.Add(TypeDescriptor.CreateInstance(null, typeOfComponent, null, null));
            }

            IComponent[] temp = new IComponent[comps.Count];
            comps.CopyTo(temp, 0);
            return temp;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:36,代码来源:WinOEToolBoxItem.cs


示例20: SelectWizard

 private static void SelectWizard(IComponent wizardControl, IDesignerHost host)
 {
     if (wizardControl == null)
     {
         return;
     }
     if (host == null)
     {
         return;
     }
     while (true)
     {
         WizardDesigner designer = (WizardDesigner) host.GetDesigner(wizardControl);
         if (designer == null)
         {
             return;
         }
         ISelectionService service = (ISelectionService) host.GetService(typeof (ISelectionService));
         if (service == null)
         {
             return;
         }
         object[] components = new object[] {wizardControl};
         service.SetSelectedComponents(components, SelectionTypes.Replace);
         return;
     }
 }
开发者ID:amedinarcr,项目名称:fop,代码行数:27,代码来源:WizardStepCollectionEditor.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDesignerSerializationManager类代码示例发布时间:2022-05-24
下一篇:
C# IDerivation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap