Jump to content





* * * - - 1 votes

Some Fun Code

By APsit190, 09 January 2014 · 1,442 views

One of the things I like about programming is making the computer do things that are really fun, and where one can enjoy a bit of a laugh and a joke that goes along with it. We come along crazy bit of software that really have no value in them at all, insofar as all they are there for is just a bit of amusement. And this code is just one of those kinds of things.

The code is for making a Windows form do a bit of a jiggle. You know, a bit of a shake, rattle, and roll. I don't know so much about the roll bit, but there you are. The code is written in C# (C Sharp).

public void Jiggle()
{

//Variables for locations and Random event

int X=this.Location.X;

int Y=this.Location.Y;

Random r=new Random();

int JiggleCount=0

int Z=15;


//Loop the jiggles

while(JiggleCount<1000) //or whatever value you may wish to give

{

this.Location=new Point(r.Next(X-Z, X+Z),r.Next(Y-Z, Y+Z));

JiggleCount++;

}

JiggleCount=0;

this.Location=new Point(X,Y);

}

I haven't tested to see if the code actually works, and so its up there for you to use and have a bit of fun with it.

The above code I've sauced from "Visual C# Kicks."

Blessings,




My Picture

August 2019

S M T W T F S
    123
45678910
11121314151617
18 19 2021222324
25262728293031

My Other Blog Pages

Feel free to visit my other Blog Pages here, and comment on any of the entries you read.

Recent Comments