本文整理汇总了C#中UMD.HCIL.Piccolo.Event.PInputEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# PInputEventArgs类的具体用法?C# PInputEventArgs怎么用?C# PInputEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PInputEventArgs类属于UMD.HCIL.Piccolo.Event命名空间,在下文中一共展示了PInputEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnKeyDown
/// <summary>
/// When the user presses a key, handle it appropriately
/// </summary>
/// <param Name="sender">The object that fired the event</param>
/// <param Name="e">The key press</param>
public override void OnKeyDown(object sender, PInputEventArgs e)
{
base.OnKeyDown(sender, e);
char c = (char)e.KeyCode;
//Keydown seems to assume they're all caps
//All lower case looks better than all caps
//So we'll force them to lower case
if (c >= 'A' && c <= 'Z')
{
c = (char)(c + 32);
}
//If it's a letter or a number, add it to the text
if ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) { Owner.Entry.Text += c; }
else
{
//Deal with control characters
switch (c)
{
case (char)Keys.Back: //Backspace
Owner.Entry.Text = Owner.Entry.Text.Substring(0, Owner.Entry.Text.Length - 1);
break;
case ' ': //Space
Owner.Entry.Text += ' ';
break;
}
}
//Update the Width of the entry box
UpdateWidth();
}
示例2: OnMouseDrag
/// <summary>
/// When the user drags with both mouse actual, move the document
/// </summary>
public override void OnMouseDrag(object sender, PInputEventArgs e)
{
PNode aNode = (PNode)sender;
SizeF delta = e.GetDeltaRelativeTo(aNode);
aNode.TranslateBy(delta.Width, delta.Height);
aNode.MoveToFront();
}
示例3: aNode_MouseDrag
protected void aNode_MouseDrag(object sender, PInputEventArgs e) {
PNode aNode = (PNode)sender;
SizeF delta = e.GetDeltaRelativeTo(aNode);
aNode.TranslateBy(delta.Width, delta.Height);
PrintEventCoords(e);
e.Handled = true;
}
示例4: Camera_MouseDown
protected void Camera_MouseDown(object sender, PInputEventArgs e) {
if (e.PickedNode is PCamera) {
} else {
e.Handled = true;
Canvas.Camera.AnimateViewToPanToBounds(e.PickedNode.GlobalFullBounds, 500);
}
}
示例5: OnStartDrag
protected override void OnStartDrag(object sender, PInputEventArgs e) {
base.OnStartDrag (sender, e);
squiggle = new PPath();
lastPoint = e.Position;
squiggle.Pen = new Pen(Brushes.Black, (float)(1/ e.Camera.ViewScale));
layer.AddChild(squiggle);
}
示例6: OnStartDrag
/// <summary>
/// When the drag is started, record the location it started at
/// </summary>
/// <param name="sender"></param>
/// <param name="end"></param>
protected override void OnStartDrag(object sender, PInputEventArgs e)
{
base.OnStartDrag(sender, e);
if (sender is PStyledText)
{
DragStart = e.Position;
CurrentSelection = null;
}
}
示例7: DoesAcceptEvent
/// <summary>
/// Whether the handler fires for a specific event
/// </summary>
/// <param Name="e">The event to test</param>
/// <returns>Whether it fires</returns>
public override bool DoesAcceptEvent(PInputEventArgs e)
{
//If either the user presses escape, or the interface will accept the event, accept the event
if ((Interface.Accepts(e) || (e.IsKeyEvent && e.KeyCode == Keys.Escape)) && base.DoesAcceptEvent(e))
{
e.Handled = true;
return true;
}
return false;
}
示例8: ResizeHandle_MouseDown
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected override void ResizeHandle_MouseDown(object sender, PInputEventArgs e)
{
// If selected system overlaps another, reset system region.
if (m_canvas.DoesSystemOverlaps((PPathwaySystem)m_obj) || !m_obj.Offset.IsEmpty)
{
ResetSystemResize();
return;
}
base.ResizeHandle_MouseDown(sender, e);
}
示例9: DoesAcceptEvent
/// <summary>
/// Accept only unhandled mouse events that invlove the left mouse button
/// </summary>
/// <param name="end"></param>
/// <returns></returns>
public override bool DoesAcceptEvent(PInputEventArgs e)
{
if (base.DoesAcceptEvent(e) && !e.Handled && e.IsMouseEvent && e.Button == MouseButtons.Left)
{
e.Handled = true;
return true;
}
return false;
}
示例10: UpdateToolTip
public void UpdateToolTip(PInputEventArgs e) {
PNode n = e.InputManager.MouseOver.PickedNode;
String tooltipString = (String) n.Tag;
PointF p = e.CanvasPosition;
p = e.Path.CanvasToLocal(p, Canvas.Camera);
tooltipNode.Text = tooltipString;
tooltipNode.SetOffset(p.X + 8, p.Y - 8);
}
示例11: OnMouseDown
public override void OnMouseDown(object sender, PInputEventArgs e) {
if (lastEditedControl != null) lastEditedControl.Editing = false;
PNode node = e.PickedNode;
if (node is PControl) {
e.Handled = true;
base.OnMouseDown (sender, e);
lastEditedControl = (PControl)node;
}
}
示例12: DoesAcceptEvent
/// <summary>
/// Overridden. Accepts left mouse button events and non-mouse events.
/// </summary>
/// <param name="e">A PInputEventArgs that contains the event data.</param>
/// <returns>
/// True if the event is a left mouse button event or non-mouse event; otherwise,
/// false.
/// </returns>
public override bool DoesAcceptEvent(PInputEventArgs e) {
if (base.DoesAcceptEvent (e)) {
if (e.IsMouseEvent) {
if (e.Button == MouseButtons.Left) {
return true;
}
}
else return true;
}
return false;
}
示例13: MasterLayer_OnMouseDown
public void MasterLayer_OnMouseDown(object sender, PInputEventArgs e)
{
if (e.PickedNode.Tag.GetType().ToString().Contains("SectorSprite"))
{
setOriginalText(pSelectedNode);
SectorSprite tmp2 = (SectorSprite)e.PickedNode.Tag;
PText pnameNew = tmp2.getText();
pnameNew.TextBrush = Brushes.Red;
}
pSelectedNode = e.PickedNode;
}
示例14: OnMouseDown
public override void OnMouseDown(object sender, PInputEventArgs e) {
base.OnMouseDown (sender, e);
if (lastEditedControl != null) lastEditedControl.Editing = false;
PNode node = e.PickedNode;
if (node is PControl) {
e.Handled = true;
DirectCameraViewToFocus(e.Camera, node, e.Path, 300);
lastEditedControl = (PControl)node;
}
}
示例15: ZoomTo
/// <summary>
/// Animates the camera's view, panning and scaling when necessary, to fully fit the
/// bounds of the picked node into the camera's view bounds.
/// </summary>
/// <param name="e">A PInputEventArgs that contains the event data.</param>
protected virtual void ZoomTo(PInputEventArgs e) {
RectangleF zoomToBounds;
PNode picked = e.PickedNode;
if (picked is PCamera) {
PCamera c = (PCamera) picked;
zoomToBounds = c.UnionOfLayerFullBounds;
} else {
zoomToBounds = picked.GlobalFullBounds;
}
e.Camera.AnimateViewToCenterBounds(zoomToBounds, true, 500);
}