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


C# ComponentModel.Component类代码示例

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


Component类属于System.ComponentModel命名空间,在下文中一共展示了Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PerformComponentMapping

		public static IRawElementProviderFragment PerformComponentMapping (Component component)
		{
			ScrollBar scb = component as ScrollBar;
			if (scb == null) {
				return null;
			}

			//TODO:
			//   We need to add here a ScrollableControlProvider and then verify
			//   if the internal scrollbar instances are matching this one,
			//   if so, then we return a scrollbar, otherwise we return a pane.
#pragma warning disable 219
			ScrollableControl scrollable;
			//ScrollableControlProvider scrollableProvider;
			if ((scrollable = scb.Parent as ScrollableControl) != null
			    || scb.Parent == null) {
#pragma warning restore 219
			//	scrollableProvider = (ScrollableControlProvider) GetProvider (scrollable);
			//	if (scrollableProvider.ScrollBarExists (scb) == true)
					return new ScrollBarProvider (scb);
			//	else 
			//		provider = new PaneProvider (scb);
			}

			return new PaneProvider (scb);
		}
开发者ID:mono,项目名称:uia2atk,代码行数:26,代码来源:ScrollBarProvider.cs

示例2: CheckAssociatedControl

 private bool CheckAssociatedControl(Component c, Glyph childGlyph, GlyphCollection glyphs)
 {
     bool flag = false;
     ToolStripDropDownItem dropDownItem = c as ToolStripDropDownItem;
     if (dropDownItem != null)
     {
         flag = this.CheckDropDownBounds(dropDownItem, childGlyph, glyphs);
     }
     if (flag)
     {
         return flag;
     }
     Control associatedControl = this.GetAssociatedControl(c);
     if (((associatedControl == null) || (associatedControl == this.toolStripContainer)) || System.Design.UnsafeNativeMethods.IsChild(new HandleRef(this.toolStripContainer, this.toolStripContainer.Handle), new HandleRef(associatedControl, associatedControl.Handle)))
     {
         return flag;
     }
     Rectangle bounds = childGlyph.Bounds;
     Rectangle rect = base.BehaviorService.ControlRectInAdornerWindow(associatedControl);
     if ((c == this.designerHost.RootComponent) || !bounds.IntersectsWith(rect))
     {
         glyphs.Insert(0, childGlyph);
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:ToolStripContainerDesigner.cs

示例3: ClearEvent

        public static void ClearEvent(Component component)
        {
            if (component == null)
            {
                return;
            }

            BindingFlags flag = BindingFlags.NonPublic | BindingFlags.Instance;
            EventHandlerList evList = typeof(Component).GetField("events", flag).GetValue(component) as EventHandlerList;
            if (evList == null)
            {
                return;
            }

            object evEntryData = evList.GetType().GetField("head", flag).GetValue(evList);
            if (evEntryData == null)
            {
                return;
            }
            do
            {
                object key = evEntryData.GetType().GetField("key", flag).GetValue(evEntryData);
                if (key == null)
                {
                    break;
                }
                evList[key] = null;
                evEntryData = evEntryData.GetType().GetField("next", flag).GetValue(evEntryData);

            }
            while (evEntryData != null);
        }
开发者ID:KentaKomai,项目名称:HMF2014,代码行数:32,代码来源:UtilService.cs

示例4: InternalAddTarget

 internal void InternalAddTarget(Component extendee)
 {
     targets.Add(extendee);
     refreshState(extendee);
     AddHandler(extendee);
     OnAddingTarget(extendee);
 }
开发者ID:divyang4481,项目名称:lextudio,代码行数:7,代码来源:Action.cs

示例5: GetAction

 public Action GetAction(Component cmp)
 {
     if (ActionDictionary.ContainsKey(cmp))
         return ActionDictionary[cmp];
     else
         return null;
 }
开发者ID:djpnewton,项目名称:ddraw,代码行数:7,代码来源:ActionListProvider.cs

示例6: GetMenuItem

        ///<summary>
        /// Return the MenuItem that is assigned to each ToolBarButton
        ///</summary>
        public MenuCommand GetMenuItem( Component pComponent )
        {
            if( m_Dictionary.Contains( pComponent ))
                return (MenuCommand) m_Dictionary[ pComponent ];

            return null;
        }
开发者ID:NeuroRoboticTech,项目名称:AnimatLabVersion1,代码行数:10,代码来源:ButtonManager.cs

示例7: GetUICommand

 /// <summary>
 /// This gets the UICommand instance (possibly null) for the specified control.
 /// <param name="control"></param>
 public UICommand GetUICommand(Component control)
 {
     // Return null if there is no entry for the control in the dictionary.
     UICommand ret = null;
     _dict.TryGetValue(control, out ret);
     return ret;
 }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:10,代码来源:UICommandProvider.cs

示例8: RemoveCommandBinding

 public void RemoveCommandBinding(Component component)
 {
     if (component == null) { throw new ArgumentNullException("component"); }
     CommandBindingBase binding = bindings.FirstOrDefault(b => b.Component == component);
     if (binding == null) { throw new ArgumentException("The binding to remove wasn't found."); }
     bindings.Remove(binding);
 }
开发者ID:keremkusmezer,项目名称:baldursgatepartygold,代码行数:7,代码来源:CommandAdapter.cs

示例9: Create

 public CommandBindingBase Create(Component component, ICommand command, Func<object> commandParameterCallback)
 {
     if (component == null) { throw new ArgumentNullException("component"); }
     if (command == null) { throw new ArgumentNullException("command"); }
     if (commandParameterCallback == null) { throw new ArgumentNullException("commandParameterCallback"); }
     return CreateCore(component, command, commandParameterCallback);
 }
开发者ID:keremkusmezer,项目名称:baldursgatepartygold,代码行数:7,代码来源:CommandBindingFactory.cs

示例10: SetStatusInformation

 public void SetStatusInformation(Component selectedComponent, Point location)
 {
     if (selectedComponent != null)
     {
         Rectangle empty = Rectangle.Empty;
         Control control = selectedComponent as Control;
         if (control != null)
         {
             empty = control.Bounds;
         }
         else
         {
             PropertyDescriptor descriptor = TypeDescriptor.GetProperties(selectedComponent)["Bounds"];
             if ((descriptor != null) && typeof(Rectangle).IsAssignableFrom(descriptor.PropertyType))
             {
                 empty = (Rectangle) descriptor.GetValue(selectedComponent);
             }
         }
         if (location != Point.Empty)
         {
             empty.X = location.X;
             empty.Y = location.Y;
         }
         if (this.StatusRectCommand != null)
         {
             this.StatusRectCommand.Invoke(empty);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:StatusCommandUI.cs

示例11: ApplyResources

 protected override void ApplyResources(Component component, string componentName, CultureInfo culture)
 {
     foreach (PropertyDescriptor descriptor in this.GetLocalizableStringProperties(component.GetType()))
     {
         string str = this.GetString(string.Format("{0}.{1}", componentName, descriptor.Name), culture);
         if (str != null)
         {
             descriptor.SetValue(component, str);
         }
     }
     ComboBox box = component as ComboBox;
     if ((box != null) && (box.DataSource == null))
     {
         string item = this.GetString(string.Format("{0}.Items", box.Name), culture);
         if (item != null)
         {
             int selectedIndex = box.SelectedIndex;
             box.BeginUpdate();
             box.Items.Clear();
             int num2 = 1;
             while (item != null)
             {
                 box.Items.Add(item);
                 item = this.GetString(string.Format("{0}.Items{1}", box.Name, num2++), culture);
             }
             if (selectedIndex < box.Items.Count)
             {
                 box.SelectedIndex = selectedIndex;
             }
             box.EndUpdate();
         }
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:33,代码来源:BasicFormStringLocalizer.cs

示例12: IsComponentVisible

		protected override bool IsComponentVisible (Component component)
		{
			// Ensure that even though the TabPages will have
			// Visible = False when they're not selected, they stay
			// in the A11y hierarchy.  This is to model Vista's
			// behavior.
			return true;
		}
开发者ID:mono,项目名称:uia2atk,代码行数:8,代码来源:TabControlProvider.cs

示例13: AddTo

 public void AddTo()
 {
     var collection = new DisposableCollection();
     var disposable = new Component();
     disposable.AddTo(collection);
     Assert.AreEqual(1, collection.Count);
     Assert.IsTrue(collection.Contains(disposable));
 }
开发者ID:jjeffery,项目名称:Cesto,代码行数:8,代码来源:DisposableExtensionsTests.cs

示例14: DisposeWith

		/// <summary>
		/// Causes this object to be disposed when the <see cref="Component"/> is disposed.
		/// </summary>
		/// <param name="disposable">
		///		The <see cref="IDisposable"/> object that</param> should be disposed when
		///		the <paramref name="component"/> is disposed.
		/// <param name="component">
		///		When this component is disposed, the <paramref name="disposable"/> object
		///		should be disposed.
		/// </param>
		/// <remarks>
		///		This is useful for ensuring that objects are disposed when a Windows Forms
		///		control is disposed.
		/// </remarks>
		public static void DisposeWith(this IDisposable disposable, Component component)
		{
			if (disposable == null)
			{
				return;
			}
			Verify.ArgumentNotNull(component, "component");
			component.Disposed += (sender, args) => DisposeOf(disposable);
		}
开发者ID:matthewc-mps-aust,项目名称:quokka,代码行数:23,代码来源:DisposableExtensions.cs

示例15: Load

 public void Load(Component component)
 {
     var source = (InfoComponent)component;
      Id = source.Id;
      Name = source.Name;
      Authors = source.Authors;
      Website = source.Website;
      Targets = source.Targets;
 }
开发者ID:ItzWarty,项目名称:the-dargon-project,代码行数:9,代码来源:InfoComponent.cs


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