![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Simple Bouncy-Ball Application Hello. I'm trying to create a simple application in XAML with a little circle that follows the mouse cursor around (just to learn). I created a System.Windows.Shapes.Ellipse and I want its location to be whereever the mouse is. So I figured I could just go: private void window_mousemove(object sender, System.Windows.Input.MouseEventArgs e) { Ball.Top = e.GetPosition(this).Y; Ball.Left = e.GetPosition(this).X; } Problem is, there's no Top and Left property for Ball (System.Windows.Shapes.Ellipse). There's a Height and Width, but no Top and Left. There's no Move(x, y) method, or Position property. Surely I'm missing something. Thanks! Ben |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Simple Bouncy-Ball Application Figured it out.... I used: Canvas.SetTop(Ball,e.GetPosition(this).Y); Odd... - Ben Friedland ben174@gmail.com wrote: > Hello. I'm trying to create a simple application in XAML with a little > circle that follows the mouse cursor around (just to learn). I created > a System.Windows.Shapes.Ellipse and I want its location to be whereever > the mouse is. So I figured I could just go: > > private void window_mousemove(object sender, > System.Windows.Input.MouseEventArgs e) { > Ball.Top = e.GetPosition(this).Y; > Ball.Left = e.GetPosition(this).X; > } > > Problem is, there's no Top and Left property for Ball > (System.Windows.Shapes.Ellipse). There's a Height and Width, but no Top > and Left. There's no Move(x, y) method, or Position property. Surely > I'm missing something. > > Thanks! > Ben |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Simple Bouncy-Ball Application Alternately, I've you were not using "Canvas" as the layouting panel/control, you could have used the Margin property, which would have "offset" the Ellipse by the specified factor... ben174@gmail.com wrote: > Figured it out.... I used: Canvas.SetTop(Ball,e.GetPosition(this).Y); > > Odd... > > - Ben Friedland > > ben174@gmail.com wrote: > > Hello. I'm trying to create a simple application in XAML with a little > > circle that follows the mouse cursor around (just to learn). I created > > a System.Windows.Shapes.Ellipse and I want its location to be whereever > > the mouse is. So I figured I could just go: > > > > private void window_mousemove(object sender, > > System.Windows.Input.MouseEventArgs e) { > > Ball.Top = e.GetPosition(this).Y; > > Ball.Left = e.GetPosition(this).X; > > } > > > > Problem is, there's no Top and Left property for Ball > > (System.Windows.Shapes.Ellipse). There's a Height and Width, but no Top > > and Left. There's no Move(x, y) method, or Position property. Surely > > I'm missing something. > > > > Thanks! > > Ben |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Track Ball Mouse | Gaming | |||
| tenon ball | Vista Games | |||
| Running of a simple socket application on vista | Network & Sharing | |||
| Strike Ball 2 and Windows Vista | Vista Games | |||