ARTICLE

Joystick Control in VB.NET

Posted by Brad Patterson Articles | Visual Basic 2010 May 13, 2005
In this article and the attached source code project written in C# and Windows Forms, the author shows how to build a Joystick control that allows an object to move via the joystick control.
Download Files:
 
Reader Level:

Hello everyone. Here is my joystick control to allow an object to move via the joystick control that is contained herein. Below is an except code snippet.

Private Sub OnMouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
If isActive
Then
MouseAt = New
Point(e.X, e.Y)
PolarAtOld = MakeGrid(MouseAt)
magnitude = MagnitudeFromCenter()
GetCompassDirection()
OnPolarMouse(
Me.Magnitude, Me
.CompassPoint)
End
If
End
Sub
<BrowsableAttribute(True
), CategoryAttribute("Joystick"), DescriptionAttribute("Magnitude of the crosshair from the center")> _
Public ReadOnly Property Magnitude() As
Double
Get
Return
magnitude
End
Get
End
Property

As you can see that there is Designer support added so that the joystick is configurable.

share this article :
post comment
 

Would this code work with any Joystick or specific one . and wud it workd with usb joystick or game port joysticks ???


Thanks for the help :)

Posted by Aamir Zafar Mar 15, 2010

ok. thankyuo

Posted by jose puello Nov 15, 2009
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Become a Sponsor