当前位置: 首页>>代码示例>>C#>>正文


C# MouseButtonEventArgs.Location方法代码示例

本文整理汇总了C#中SFML.Window.MouseButtonEventArgs.Location方法的典型用法代码示例。如果您正苦于以下问题:C# MouseButtonEventArgs.Location方法的具体用法?C# MouseButtonEventArgs.Location怎么用?C# MouseButtonEventArgs.Location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SFML.Window.MouseButtonEventArgs的用法示例。


在下文中一共展示了MouseButtonEventArgs.Location方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnMouseDown

        /// <summary>
        /// Handles when a mouse button has been pressed down on this <see cref="Control"/>.
        /// This is called immediately before <see cref="Control.OnMouseDown"/>.
        /// Override this method instead of using an event hook on <see cref="Control.MouseDown"/> when possible.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected virtual void OnMouseDown(MouseButtonEventArgs e)
        {
            // Give the control the focus
            if ((CanFocus || CanDrag) && GetChild(e.Location(), true) == null)
            {
                GUIManager.FocusedControl = this;

                // Drag the control if possible
                if (CanDrag)
                {
                    _dragOffset = e.Location() - Position;
                    if (!_isDragging)
                    {
                        _isDragging = true;
                        InvokeBeginDrag();
                    }
                }
            }
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:25,代码来源:Control.cs

示例2: OnClick

        /// <summary>
        /// Handles when this <see cref="Control"/> was clicked.
        /// This is called immediately before <see cref="Control.OnClick"/>.
        /// Override this method instead of using an event hook on <see cref="Control.OnClick"/> when possible.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected override void OnClick(MouseButtonEventArgs e)
        {
            base.OnClick(e);

            if (!IsEnabled || !IsVisible)
                return;

            int lineIndex;
            int lineCharIndex;
            GetCharacterAtPoint(e.Location(), out lineIndex, out lineCharIndex);

            _lines.MoveTo(lineIndex);
            CursorLinePosition = lineCharIndex;
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:20,代码来源:TextBox.cs


注:本文中的SFML.Window.MouseButtonEventArgs.Location方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。