![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | 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) |
| Guest | 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) |
| Guest | 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 | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Track Ball Mouse | Johannes | Gaming | 18 | 07-24-2008 12:03 AM |
| tenon ball | Vista Games | 1 | 04-06-2008 04:54 AM | |
| Running of a simple socket application on vista | mayank07in | Network & Internet | 0 | 01-15-2008 07:11 AM |
| My experience and suggestions and a crystal ball | FileConflict | Live Folder Share | 3 | 11-21-2007 09:07 PM |
| Strike Ball 2 and Windows Vista | Joanne Stewart | Vista Games | 3 | 07-30-2007 04:56 PM |