當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。