Abstract
This sample generates 6 random numbers and display them on an image in a WebForm.
Background
Mark Six is the official lottery game in Hong Kong. You can choose any six numbers from 1 to 47. The core of this code sample is the Dice Class, which is from Mr. John O'Donnell's Lottery article, many thanks to Mr. O'Donnell.
The Code
This sample contains 4 files.
Dice.cs is the Class file for the Dice class. It has only one method called RollDice(), which analogues to throwing a dice with 47 faces. Please refer to Mr. O'Donnell's article for more description about the Random and Stack Class.
MarkSixBall.cs exposes a method called Draw(), which puts the number on a circle that in turn lies on a 30*30 bitmap and return the bitmap.
// MarkSixBall.cs
// ImgMarkSix.aspx.cs
Conclusion
In this sample, I demonstrated some simple usage of GDI+ functionalities on a WebForm, and how a WebForm can be called directly as an Image. If you have any comments or questions please feel free to drop an email at [email protected] .
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: