本文整理汇总了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);
}
示例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);
}
示例4: InternalAddTarget
internal void InternalAddTarget(Component extendee)
{
targets.Add(extendee);
refreshState(extendee);
AddHandler(extendee);
OnAddingTarget(extendee);
}
示例5: GetAction
public Action GetAction(Component cmp)
{
if (ActionDictionary.ContainsKey(cmp))
return ActionDictionary[cmp];
else
return null;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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();
}
}
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}