本文整理汇总了C#中System.Windows.Forms.Design.Behavior.Behavior.OnMouseDoubleClick方法的典型用法代码示例。如果您正苦于以下问题:C# Behavior.OnMouseDoubleClick方法的具体用法?C# Behavior.OnMouseDoubleClick怎么用?C# Behavior.OnMouseDoubleClick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Design.Behavior.Behavior
的用法示例。
在下文中一共展示了Behavior.OnMouseDoubleClick方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMouseDoubleClick
// When you double-click on an AnchorGlyph, the value of
// the control's Anchor property is toggled.
//
// Note that the value of the Anchor property is not set
// by direct assignment. Instead, the
// PropertyDescriptor.SetValue method is used. This
// enables notification of the design environment, so
// related events can be raised, for example, the
// IComponentChangeService.ComponentChanged event.
public override bool OnMouseDoubleClick(
Glyph g,
MouseButtons button,
Point mouseLoc)
{
base.OnMouseDoubleClick(g, button, mouseLoc);
if (button == MouseButtons.Left)
{
AnchorGlyph ag = g as AnchorGlyph;
PropertyDescriptor pdAnchor =
TypeDescriptor.GetProperties(ag.relatedControl)["Anchor"];
if (ag.IsEnabled)
{
// The glyph is enabled.
// Clear the AnchorStyle flag to disable the Glyph.
pdAnchor.SetValue(
ag.relatedControl,
ag.relatedControl.Anchor ^ ag.anchorStyle );
}
else
{
// The glyph is disabled.
// Set the AnchorStyle flag to enable the Glyph.
pdAnchor.SetValue(
ag.relatedControl,
ag.relatedControl.Anchor | ag.anchorStyle);
}
}
return true;
}