C# 令人困惑的)巧合的是,它们最终的名称相同。您引用的是一篇根本不使用.NET的文章。因此,对于.NET约定来说,这并不是一个很好的指南。它也是事件处理程序方法,而不是引发事件的事件和方法。您已经知道正确的MSDN页面,第一个链接,所以只需使用它。 void
C# 令人困惑的)巧合的是,它们最终的名称相同。您引用的是一篇根本不使用.NET的文章。因此,对于.NET约定来说,这并不是一个很好的指南。它也是事件处理程序方法,而不是引发事件的事件和方法。您已经知道正确的MSDN页面,第一个链接,所以只需使用它。 void ,c#,events,event-handling,coding-style,msdn,C#,Events,Event Handling,Coding Style,Msdn,令人困惑的)巧合的是,它们最终的名称相同。您引用的是一篇根本不使用.NET的文章。因此,对于.NET约定来说,这并不是一个很好的指南。它也是事件处理程序方法,而不是引发事件的事件和方法。您已经知道正确的MSDN页面,第一个链接,所以只需使用它。 void MoveLookController::OnPointerPressed( _In_ CoreWindow^ sender, _In_ PointerEventArgs^ args) { // Get the current point
令人困惑的)巧合的是,它们最终的名称相同。您引用的是一篇根本不使用.NET的文章。因此,对于.NET约定来说,这并不是一个很好的指南。它也是事件处理程序方法,而不是引发事件的事件和方法。您已经知道正确的MSDN页面,第一个链接,所以只需使用它。
void MoveLookController::OnPointerPressed(
_In_ CoreWindow^ sender,
_In_ PointerEventArgs^ args)
{
// Get the current pointer position.
uint32 pointerID = args->CurrentPoint->PointerId;
DirectX::XMFLOAT2 position = DirectX::XMFLOAT2( args->CurrentPoint->Position.X, args->CurrentPoint->Position.Y );
auto device = args->CurrentPoint->PointerDevice;
auto deviceType = device->PointerDeviceType;
if ( deviceType == PointerDeviceType::Mouse )
{
// Action, Jump, or Fire
}
// Check if this pointer is in the move control.
// Change the values to percentages of the preferred screen resolution.
// You can set the x value to <preferred resolution> * <percentage of width>
// for example, ( position.x < (screenResolution.x * 0.15) ).
if (( position.x < 300 && position.y > 380 ) && ( deviceType != PointerDeviceType::Mouse ))
{
if ( !m_moveInUse ) // if no pointer is in this control yet
{
// Process a DPad touch down event.
m_moveFirstDown = position; // Save the location of the initial contact.
m_movePointerPosition = position;
m_movePointerID = pointerID; // Store the id of the pointer using this control.
m_moveInUse = TRUE;
}
}
else // This pointer must be in the look control.
{
if ( !m_lookInUse ) // If no pointer is in this control yet...
{
m_lookLastPoint = position; // save the point for later move
m_lookPointerID = args->CurrentPoint->PointerId; // store the id of pointer using this control
m_lookLastDelta.x = m_lookLastDelta.y = 0; // these are for smoothing
m_lookInUse = TRUE;
}
}
}