Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Simple Bouncy-Ball Application

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 10-12-2006   #1 (permalink)
ben174@gmail.com
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 SpecsSystem Spec
Old 10-12-2006   #2 (permalink)
ben174@gmail.com
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 SpecsSystem Spec
Old 10-13-2006   #3 (permalink)
Marcus
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 SpecsSystem Spec
Closed Thread

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


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51