Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. This Stupid Little Red Ball...

This Stupid Little Red Ball...

Scheduled Pinned Locked Moved The Lounge
comquestion
25 Posts 6 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Ian Shlasko

    Something tells me that wouldn't go over very well at the office... Nah, I just used four lines of XAML to make a red ball... Well... A circle with a gradient fill... But pretend it's a ball. And it's still bouncing... bouncing... bouncing...

    Proud to have finally moved to the A-Ark. Which one are you in?
    Author of the Guardians Saga (Sci-Fi/Fantasy novels)

    S Offline
    S Offline
    Single Step Debugger
    wrote on last edited by
    #11

    Call the support and told him some frickin’ red ball is jumping in your monitors, probably a virus?

    There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

    I 1 Reply Last reply
    0
    • I Ian Shlasko

      ...has been bouncing back and forth across my three monitors for hours now... It's vaguely hypnotic... Bounce... bounce... bounce... bounce... I'm not sure why I wasted five minutes coding it... But it just keeps... bouncing... bounce... bounce... bounce... It's almost exactly as pointless as this thread. :)

      Proud to have finally moved to the A-Ark. Which one are you in?
      Author of the Guardians Saga (Sci-Fi/Fantasy novels)

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #12

      I have the same problem, but my balls are black.

      Somebody in an online forum wrote:

      INTJs never really joke. They make a point. The joke is just a gift wrapper.

      I 1 Reply Last reply
      0
      • A Agecanonix

        Ian Shlasko wrote:

        creating a point

        Or a mini black hole and we'd all go woosh.

        I Offline
        I Offline
        Ian Shlasko
        wrote on last edited by
        #13

        Hmm... If we accidentally destroyed the solar system... I wouldn't have to go to work anymore... Where do we begin?

        Proud to have finally moved to the A-Ark. Which one are you in?
        Author of the Guardians Saga (Sci-Fi/Fantasy novels)

        A 1 Reply Last reply
        0
        • S Single Step Debugger

          Call the support and told him some frickin’ red ball is jumping in your monitors, probably a virus?

          There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

          I Offline
          I Offline
          Ian Shlasko
          wrote on last edited by
          #14

          But... it's so... bouncy... must... watch... ball... bounce... I think I'm going to keep this... Maybe I'll add a couple lines of code and make it change colors too.

          Proud to have finally moved to the A-Ark. Which one are you in?
          Author of the Guardians Saga (Sci-Fi/Fantasy novels)

          N 1 Reply Last reply
          0
          • A AspDotNetDev

            I have the same problem, but my balls are black.

            Somebody in an online forum wrote:

            INTJs never really joke. They make a point. The joke is just a gift wrapper.

            I Offline
            I Offline
            Ian Shlasko
            wrote on last edited by
            #15

            :thumbsup: Looks cool, but I think that would obstruct too much of the screen. This is just a little 50x50 circle... Ok, technically, it's a borderless window with a transparent background, set to topmost.

            Proud to have finally moved to the A-Ark. Which one are you in?
            Author of the Guardians Saga (Sci-Fi/Fantasy novels)

            1 Reply Last reply
            0
            • I Ian Shlasko

              But... it's so... bouncy... must... watch... ball... bounce... I think I'm going to keep this... Maybe I'll add a couple lines of code and make it change colors too.

              Proud to have finally moved to the A-Ark. Which one are you in?
              Author of the Guardians Saga (Sci-Fi/Fantasy novels)

              N Offline
              N Offline
              Nish Nishant
              wrote on last edited by
              #16

              WPF, SL, or WinRT?

              Regards, Nish


              My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

              S I 2 Replies Last reply
              0
              • I Ian Shlasko

                ...has been bouncing back and forth across my three monitors for hours now... It's vaguely hypnotic... Bounce... bounce... bounce... bounce... I'm not sure why I wasted five minutes coding it... But it just keeps... bouncing... bounce... bounce... bounce... It's almost exactly as pointless as this thread. :)

                Proud to have finally moved to the A-Ark. Which one are you in?
                Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                N Offline
                N Offline
                Nagy Vilmos
                wrote on last edited by
                #17

                Send. Code. Now!


                Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                A 1 Reply Last reply
                0
                • N Nagy Vilmos

                  Send. Code. Now!


                  Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                  A Offline
                  A Offline
                  AspDotNetDev
                  wrote on last edited by
                  #18

                  Indeed. We can haz tip/trick plz?

                  Somebody in an online forum wrote:

                  INTJs never really joke. They make a point. The joke is just a gift wrapper.

                  I 1 Reply Last reply
                  0
                  • I Ian Shlasko

                    Hmm... If we accidentally destroyed the solar system... I wouldn't have to go to work anymore... Where do we begin?

                    Proud to have finally moved to the A-Ark. Which one are you in?
                    Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                    A Offline
                    A Offline
                    Agecanonix
                    wrote on last edited by
                    #19

                    Ian Shlasko wrote:

                    Where do we begin?

                    That's uncertain.

                    I 1 Reply Last reply
                    0
                    • N Nish Nishant

                      WPF, SL, or WinRT?

                      Regards, Nish


                      My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                      S Offline
                      S Offline
                      Single Step Debugger
                      wrote on last edited by
                      #20

                      You programmers are so boring in moments! :-D

                      There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                      N 1 Reply Last reply
                      0
                      • S Single Step Debugger

                        You programmers are so boring in moments! :-D

                        There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                        N Offline
                        N Offline
                        Nish Nishant
                        wrote on last edited by
                        #21

                        :laugh:

                        Regards, Nish


                        My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                        1 Reply Last reply
                        0
                        • N Nish Nishant

                          WPF, SL, or WinRT?

                          Regards, Nish


                          My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                          I Offline
                          I Offline
                          Ian Shlasko
                          wrote on last edited by
                          #22

                          WPF :)

                          <Ellipse Stroke="Black" StrokeThickness="1" >
                          <Ellipse.Fill>
                          <RadialGradientBrush GradientOrigin="0.5,0.5">
                          <GradientStop Offset="0" Color="Red"/>
                          <GradientStop Offset="1" Color="DarkRed"/>
                          </RadialGradientBrush>
                          </Ellipse.Fill>
                          </Ellipse>

                          Proud to have finally moved to the A-Ark. Which one are you in?
                          Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                          N 1 Reply Last reply
                          0
                          • I Ian Shlasko

                            WPF :)

                            <Ellipse Stroke="Black" StrokeThickness="1" >
                            <Ellipse.Fill>
                            <RadialGradientBrush GradientOrigin="0.5,0.5">
                            <GradientStop Offset="0" Color="Red"/>
                            <GradientStop Offset="1" Color="DarkRed"/>
                            </RadialGradientBrush>
                            </Ellipse.Fill>
                            </Ellipse>

                            Proud to have finally moved to the A-Ark. Which one are you in?
                            Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                            N Offline
                            N Offline
                            Nish Nishant
                            wrote on last edited by
                            #23

                            Ah ok.

                            Regards, Nish


                            My technology blog: voidnish.wordpress.com Part 2 in my WinRT/C++ series : Visual C++ and WinRT/Metro - Databinding Basics

                            1 Reply Last reply
                            0
                            • A AspDotNetDev

                              Indeed. We can haz tip/trick plz?

                              Somebody in an online forum wrote:

                              INTJs never really joke. They make a point. The joke is just a gift wrapper.

                              I Offline
                              I Offline
                              Ian Shlasko
                              wrote on last edited by
                              #24

                              I'm far too lazy to format out a Tip/Trick... Besides, I did it the lazy way, so it's not well-designed or anything... XAML:

                              <Window x:Class="BlahBlah.MainWindow"
                              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                              IsHitTestVisible="False" WindowStyle="None" AllowsTransparency="True" Background="Transparent"
                              Topmost="True" Width="50" Height="50" Left="{Binding X}" Top="{Binding Y}">
                              <Ellipse Stroke="Black" StrokeThickness="1" >
                              <Ellipse.Fill>
                              <RadialGradientBrush GradientOrigin="0.5,0.5">
                              <GradientStop Offset="0" Color="Red"/>
                              <GradientStop Offset="1" Color="DarkRed"/>
                              </RadialGradientBrush>
                              </Ellipse.Fill>
                              </Ellipse>
                              </Window>

                              Then just make a couple properties for X and Y, wire 'em up, set the DataContext, and make a 10ms DispatcherTimer:

                              private Vector Heading = new Vector(8, 0);
                              private Size ObjectSize;

                              void tmr_Tick(object sender, EventArgs e)
                              {
                              if (ObjectSize.Width == 0 && RenderSize.Width > 0)
                              ObjectSize = RenderSize;

                              double x = X += Heading.X;
                              double y = Y += Heading.Y;
                              
                              Heading.Y += 1;
                              Heading.Y = Math.Max(-40, Math.Min(40, Heading.Y));
                              
                              if (y + ObjectSize.Height > SystemParameters.VirtualScreenHeight)
                                  Heading.Y = -Math.Abs(Heading.Y);
                              else if (y < 0)
                                  Heading.Y = Math.Abs(Heading.Y);
                              
                              if (x + ObjectSize.Width > SystemParameters.VirtualScreenWidth)
                                  Heading.X = -Math.Abs(Heading.X);
                              else if (x < 0)
                                  Heading.X = Math.Abs(Heading.X);
                              

                              }

                              Kiddie stuff... Took five minutes, but then I spent another five tweaking it to make it look a bit better.

                              Proud to have finally moved to the A-Ark. Which one are you in?
                              Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                              1 Reply Last reply
                              0
                              • A Agecanonix

                                Ian Shlasko wrote:

                                Where do we begin?

                                That's uncertain.

                                I Offline
                                I Offline
                                Ian Shlasko
                                wrote on last edited by
                                #25

                                Well then how are we going to accidentally destroy the universe? Seriously, you need to think these things through :-D

                                Proud to have finally moved to the A-Ark. Which one are you in?
                                Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups