本文整理汇总了C#中System.Windows.Forms.Design.Behavior.Glyph类的典型用法代码示例。如果您正苦于以下问题:C# Glyph类的具体用法?C# Glyph怎么用?C# Glyph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Glyph类属于System.Windows.Forms.Design.Behavior命名空间,在下文中一共展示了Glyph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRange
public void AddRange(Glyph[] value)
{
for (int i = 0; i < value.Length; i++)
{
this.Add(value[i]);
}
}
示例2: SetDesignerActionPanel
public void SetDesignerActionPanel(DesignerActionPanel panel, Glyph relatedGlyph)
{
if ((this._panel == null) || (panel != ((DesignerActionPanel) this._panel.Control)))
{
this.relatedGlyph = relatedGlyph;
panel.SizeChanged += new EventHandler(this.PanelResized);
if (this._panel != null)
{
this.Items.Remove(this._panel);
this._panel.Dispose();
this._panel = null;
}
this._panel = new ToolStripControlHost(panel);
this._panel.Margin = Padding.Empty;
this._panel.Size = panel.Size;
base.SuspendLayout();
base.Size = panel.Size;
this.Items.Add(this._panel);
base.ResumeLayout();
if (base.Visible)
{
this.CheckFocusIsRight();
}
}
}
示例3: 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
示例4: OnMouseUp
public override bool OnMouseUp(Glyph g, MouseButtons button)
{
if ((button != MouseButtons.Left) || (this.ParentUI == null))
{
return true;
}
bool flag = true;
if (this.ParentUI.IsDesignerActionPanelVisible)
{
this.HideUI();
}
else if (!this.ignoreNextMouseUp)
{
if (this.serviceProvider != null)
{
ISelectionService service = (ISelectionService) this.serviceProvider.GetService(typeof(ISelectionService));
if ((service != null) && (service.PrimarySelection != this.RelatedComponent))
{
List<IComponent> components = new List<IComponent> {
this.RelatedComponent
};
service.SetSelectedComponents(components, SelectionTypes.Click);
}
}
this.ShowUI(g);
}
else
{
flag = false;
}
this.ignoreNextMouseUp = false;
return flag;
}
示例5: BehaviorService
internal BehaviorService(IServiceProvider serviceProvider, Control windowFrame)
{
this.serviceProvider = serviceProvider;
this.adornerWindow = new AdornerWindow(this, windowFrame);
IOverlayService service = (IOverlayService) serviceProvider.GetService(typeof(IOverlayService));
if (service != null)
{
this.adornerWindowIndex = service.PushOverlay(this.adornerWindow);
}
this.dragEnterReplies = new Hashtable();
this.adorners = new BehaviorServiceAdornerCollection(this);
this.behaviorStack = new ArrayList();
this.hitTestedGlyph = null;
this.validDragArgs = null;
this.actionPointer = null;
this.trackMouseEvent = null;
this.trackingMouseEvent = false;
IMenuCommandService menuService = serviceProvider.GetService(typeof(IMenuCommandService)) as IMenuCommandService;
IDesignerHost host = serviceProvider.GetService(typeof(IDesignerHost)) as IDesignerHost;
if ((menuService != null) && (host != null))
{
this.menuCommandHandler = new MenuCommandHandler(this, menuService);
host.RemoveService(typeof(IMenuCommandService));
host.AddService(typeof(IMenuCommandService), this.menuCommandHandler);
}
this.useSnapLines = false;
this.queriedSnapLines = false;
WM_GETALLSNAPLINES = System.Design.SafeNativeMethods.RegisterWindowMessage("WM_GETALLSNAPLINES");
WM_GETRECENTSNAPLINES = System.Design.SafeNativeMethods.RegisterWindowMessage("WM_GETRECENTSNAPLINES");
SystemEvents.DisplaySettingsChanged += new EventHandler(this.OnSystemSettingChanged);
SystemEvents.InstalledFontsChanged += new EventHandler(this.OnSystemSettingChanged);
SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(this.OnUserPreferenceChanged);
}
示例6: OnMouseEnter
/// <summary>
/// Called when any mouse-enter message enters the adorner window of the BehaviorService.
/// </summary>
/// <param name="g">A Glyph.</param>
/// <returns>true if the message was handled; otherwise, false.</returns>
public override bool OnMouseEnter(Glyph g)
{
// Notify the split container so it can track mouse message
if (_splitContainer != null)
_splitContainer.DesignMouseEnter();
return base.OnMouseEnter(g);
}
示例7: OnDragLeave
public virtual void OnDragLeave(Glyph g, EventArgs e)
{
if (this.callParentBehavior && (this.GetNextBehavior != null))
{
this.GetNextBehavior.OnDragLeave(g, e);
}
else if (this.GlyphIsValid(g))
{
g.Behavior.OnDragLeave(g, e);
}
}
示例8: CheckDropDownBounds
private bool CheckDropDownBounds(ToolStripDropDownItem dropDownItem, Glyph childGlyph, GlyphCollection glyphs)
{
if (dropDownItem == null)
{
return false;
}
Rectangle bounds = childGlyph.Bounds;
Rectangle rect = base.BehaviorService.ControlRectInAdornerWindow(dropDownItem.DropDown);
if (!bounds.IntersectsWith(rect))
{
glyphs.Insert(0, childGlyph);
}
return true;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:ToolStripContainerDesigner.cs
示例9: OnLoseCapture
public override void OnLoseCapture(Glyph g, EventArgs e)
{
this.captureLost = true;
if (this.pushedBehavior)
{
this.pushedBehavior = false;
if (this.BehaviorService != null)
{
if (this.dragging)
{
this.dragging = false;
for (int i = 0; !this.captureLost && (i < this.resizeComponents.Length); i++)
{
Control resizeControl = this.resizeComponents[i].resizeControl as Control;
Rectangle rect = this.BehaviorService.ControlRectInAdornerWindow(resizeControl);
if (!rect.IsEmpty)
{
using (Graphics graphics = this.BehaviorService.AdornerWindowGraphics)
{
graphics.SetClip(rect);
using (Region region = new Region(rect))
{
region.Exclude(Rectangle.Inflate(rect, -2, -2));
this.BehaviorService.Invalidate(region);
}
graphics.ResetClip();
}
}
}
this.BehaviorService.EnableAllAdorners(true);
}
this.BehaviorService.PopBehavior(this);
if (this.lastResizeRegion != null)
{
this.BehaviorService.Invalidate(this.lastResizeRegion);
this.lastResizeRegion.Dispose();
this.lastResizeRegion = null;
}
}
}
if (this.resizeTransaction != null)
{
DesignerTransaction resizeTransaction = this.resizeTransaction;
this.resizeTransaction = null;
using (resizeTransaction)
{
resizeTransaction.Cancel();
}
}
}
示例10: OnDragOver
public virtual void OnDragOver(Glyph g, DragEventArgs e)
{
if (this.callParentBehavior && (this.GetNextBehavior != null))
{
this.GetNextBehavior.OnDragOver(g, e);
}
else if (this.GlyphIsValid(g))
{
g.Behavior.OnDragOver(g, e);
}
else if (e.Effect != DragDropEffects.None)
{
e.Effect = (Control.ModifierKeys == Keys.Control) ? DragDropEffects.Copy : DragDropEffects.Move;
}
}
示例11: OnMouseDown
/// <summary>
/// Called when any mouse-down message enters the adorner window of the BehaviorService.
/// </summary>
/// <param name="g">A Glyph.</param>
/// <param name="button">A MouseButtons value indicating which button was clicked.</param>
/// <param name="pt">The location at which the click occurred.</param>
/// <returns>true if the message was handled; otherwise, false.</returns>
public override bool OnMouseDown(Glyph g, MouseButtons button, Point pt)
{
if (_splitContainer != null)
{
// Convert the adorner coordinate to the split container client coordinate
Point splitPt = PointToSplitContainer(g, pt);
// Notify the split container so it can track mouse message
if (_splitContainer.DesignMouseDown(splitPt, button))
{
// Splitter is starting to be moved, we need to capture mouse input
_splitContainer.Capture = true;
}
}
return base.OnMouseDown(g, button, pt);
}
示例12: OnMouseDown
public override bool OnMouseDown(Glyph g, MouseButtons button, Point mouseLoc)
{
if (button == MouseButtons.Left)
{
ISelectionService service = (ISelectionService) this.serviceProvider.GetService(typeof(ISelectionService));
if ((service != null) && !this.containerControl.Equals(service.PrimarySelection as Control))
{
service.SetSelectedComponents(new object[] { this.containerControl }, SelectionTypes.Toggle | SelectionTypes.Click);
ContainerSelectorGlyph glyph = g as ContainerSelectorGlyph;
if (glyph == null)
{
return false;
}
using (BehaviorServiceAdornerCollectionEnumerator enumerator = this.behaviorService.Adorners.GetEnumerator())
{
while (enumerator.MoveNext())
{
foreach (Glyph glyph2 in enumerator.Current.Glyphs)
{
ContainerSelectorGlyph glyph3 = glyph2 as ContainerSelectorGlyph;
if ((glyph3 != null) && !glyph3.Equals(glyph))
{
ContainerSelectorBehavior relatedBehavior = glyph3.RelatedBehavior as ContainerSelectorBehavior;
ContainerSelectorBehavior behavior2 = glyph.RelatedBehavior as ContainerSelectorBehavior;
if (((relatedBehavior != null) && (behavior2 != null)) && behavior2.ContainerControl.Equals(relatedBehavior.ContainerControl))
{
relatedBehavior.OkToMove = true;
relatedBehavior.InitialDragPoint = this.DetermineInitialDragPoint(mouseLoc);
continue;
}
}
}
}
goto Label_0167;
}
}
this.InitialDragPoint = this.DetermineInitialDragPoint(mouseLoc);
this.OkToMove = true;
}
Label_0167:
return false;
}
示例13: OnMouseMove
public override bool OnMouseMove(Glyph g, MouseButtons button, Point mouseLoc)
{
if (!this.pushedBehavior)
{
return false;
}
bool flag = Control.ModifierKeys == Keys.Alt;
if (flag && (this.dragManager != null))
{
this.dragManager.EraseSnapLines();
}
if (flag || !mouseLoc.Equals(this.lastMouseLoc))
{
if (this.lastMouseAbs != null)
{
System.Design.NativeMethods.POINT pt = new System.Design.NativeMethods.POINT(mouseLoc.X, mouseLoc.Y);
System.Design.UnsafeNativeMethods.ClientToScreen(new HandleRef(this, this.behaviorService.AdornerWindowControl.Handle), pt);
if ((pt.x == this.lastMouseAbs.x) && (pt.y == this.lastMouseAbs.y))
{
return true;
}
}
if (!this.dragging)
{
if ((Math.Abs((int) (this.initialPoint.X - mouseLoc.X)) <= (DesignerUtils.MinDragSize.Width / 2)) && (Math.Abs((int) (this.initialPoint.Y - mouseLoc.Y)) <= (DesignerUtils.MinDragSize.Height / 2)))
{
return false;
}
this.InitiateResize();
this.dragging = true;
}
if ((this.resizeComponents == null) || (this.resizeComponents.Length == 0))
{
return false;
}
PropertyDescriptor descriptor = null;
PropertyDescriptor descriptor2 = null;
PropertyDescriptor descriptor3 = null;
PropertyDescriptor descriptor4 = null;
if (this.initialResize)
{
descriptor = TypeDescriptor.GetProperties(this.resizeComponents[0].resizeControl)["Width"];
descriptor2 = TypeDescriptor.GetProperties(this.resizeComponents[0].resizeControl)["Height"];
descriptor3 = TypeDescriptor.GetProperties(this.resizeComponents[0].resizeControl)["Top"];
descriptor4 = TypeDescriptor.GetProperties(this.resizeComponents[0].resizeControl)["Left"];
if ((descriptor != null) && !typeof(int).IsAssignableFrom(descriptor.PropertyType))
{
descriptor = null;
}
if ((descriptor2 != null) && !typeof(int).IsAssignableFrom(descriptor2.PropertyType))
{
descriptor2 = null;
}
if ((descriptor3 != null) && !typeof(int).IsAssignableFrom(descriptor3.PropertyType))
{
descriptor3 = null;
}
if ((descriptor4 != null) && !typeof(int).IsAssignableFrom(descriptor4.PropertyType))
{
descriptor4 = null;
}
}
Control resizeControl = this.resizeComponents[0].resizeControl as Control;
this.lastMouseLoc = mouseLoc;
this.lastMouseAbs = new System.Design.NativeMethods.POINT(mouseLoc.X, mouseLoc.Y);
System.Design.UnsafeNativeMethods.ClientToScreen(new HandleRef(this, this.behaviorService.AdornerWindowControl.Handle), this.lastMouseAbs);
int num = Math.Max(resizeControl.MinimumSize.Height, 10);
int num2 = Math.Max(resizeControl.MinimumSize.Width, 10);
if (this.dragManager != null)
{
bool flag2 = true;
bool shouldSnapHorizontally = true;
if ((((this.targetResizeRules & SelectionRules.BottomSizeable) != SelectionRules.None) || ((this.targetResizeRules & SelectionRules.TopSizeable) != SelectionRules.None)) && (resizeControl.Height == num))
{
flag2 = false;
}
else if ((((this.targetResizeRules & SelectionRules.RightSizeable) != SelectionRules.None) || ((this.targetResizeRules & SelectionRules.LeftSizeable) != SelectionRules.None)) && (resizeControl.Width == num2))
{
flag2 = false;
}
PropertyDescriptor descriptor5 = TypeDescriptor.GetProperties(resizeControl)["IntegralHeight"];
if (descriptor5 != null)
{
object obj2 = descriptor5.GetValue(resizeControl);
if ((obj2 is bool) && ((bool) obj2))
{
shouldSnapHorizontally = false;
}
}
if (!flag && flag2)
{
this.lastSnapOffset = this.dragManager.OnMouseMove(resizeControl, this.GenerateSnapLines(this.targetResizeRules, mouseLoc), ref this.didSnap, shouldSnapHorizontally);
}
else
{
this.dragManager.OnMouseMove(new Rectangle(-100, -100, 0, 0));
}
mouseLoc.X += this.lastSnapOffset.X;
mouseLoc.Y += this.lastSnapOffset.Y;
}
//.........这里部分代码省略.........
示例14: OnMouseUp
public override bool OnMouseUp(Glyph g, MouseButtons button)
{
_designer.AddPanel(this, EventArgs.Empty);
return base.OnMouseUp(g, button);
}
示例15: OnMouseDown
public override bool OnMouseDown(Glyph g, MouseButtons button, Point mouseLoc)
{
if (button != MouseButtons.Left)
{
return this.pushedBehavior;
}
this.targetResizeRules = SelectionRules.None;
SelectionGlyphBase base2 = g as SelectionGlyphBase;
if (base2 != null)
{
this.targetResizeRules = base2.SelectionRules;
this.cursor = base2.HitTestCursor;
}
if (this.targetResizeRules != SelectionRules.None)
{
ISelectionService service = (ISelectionService) this.serviceProvider.GetService(typeof(ISelectionService));
if (service == null)
{
return false;
}
this.initialPoint = mouseLoc;
this.lastMouseLoc = mouseLoc;
this.primaryControl = service.PrimarySelection as Control;
ArrayList list = new ArrayList();
foreach (object obj2 in service.GetSelectedComponents())
{
if (obj2 is Control)
{
PropertyDescriptor descriptor = TypeDescriptor.GetProperties(obj2)["Locked"];
if ((descriptor == null) || !((bool) descriptor.GetValue(obj2)))
{
list.Add(obj2);
}
}
}
if (list.Count == 0)
{
return false;
}
this.resizeComponents = new ResizeComponent[list.Count];
for (int i = 0; i < list.Count; i++)
{
this.resizeComponents[i].resizeControl = list[i];
}
this.pushedBehavior = true;
this.BehaviorService.PushCaptureBehavior(this);
}
return false;
}