Click here to Skip to main content
15,880,854 members
Home / Discussions / C#
   

C#

 
QuestionDoes This Only Happen To Me? Pin
Roger Wright18-May-12 18:53
professionalRoger Wright18-May-12 18:53 
AnswerRe: Does This Only Happen To Me? Pin
OriginalGriff18-May-12 20:58
mveOriginalGriff18-May-12 20:58 
GeneralRe: Does This Only Happen To Me? Pin
Pete O'Hanlon18-May-12 22:42
mvePete O'Hanlon18-May-12 22:42 
GeneralRe: Does This Only Happen To Me? Pin
OriginalGriff18-May-12 22:47
mveOriginalGriff18-May-12 22:47 
GeneralRe: Does This Only Happen To Me? Pin
Pete O'Hanlon19-May-12 2:10
mvePete O'Hanlon19-May-12 2:10 
GeneralRe: Does This Only Happen To Me? Pin
OriginalGriff19-May-12 2:20
mveOriginalGriff19-May-12 2:20 
GeneralRe: Does This Only Happen To Me? Pin
BillW3319-May-12 7:05
professionalBillW3319-May-12 7:05 
QuestionA Layout Question, And A Bit More Pin
Roger Wright17-May-12 19:47
professionalRoger Wright17-May-12 19:47 
Background:

My lady loves the game of Keno, specifically Cleopatra Keno. Her birthday is in 4 weeks, and I have 3 weeks relatively free until classes start again. I'd like to make a Windows version of the game for her to play at home for her birthday. Not only would she love it, but it would save me a ton of money if I could get her used to playing at home instead of a casino. The logic of the game is trivial. The player selects 3 to 10 numbers from a field of 80, places a bet, and presses Go to run a game.In Cleopatra Keno, if the run is a winner, and the last number drawn is one selected by the player, the game awards 12 free runs with doubled payouts. Each run draws 20 numbers from the field. The overall payout is only 90.1%, so it's a lousy money maker, but I have to admit that it's fun when a game starts hitting these bonus rounds over and over... it does happen.

So, I've created a Keno tile class as a user control. It has a button overlaid on a UserControl background with a Text member that represents the number of the tile, set in the constructor for each instance. A Tile contains methods to set and reset states of Selected by the player, Hit during game play, Last hit in a run, et cetera. These are all self-contained functions to control the colors displayed to the user. But how do I lay them out in a rectangular grid, and what's the best way to handle interactions between the game and the user? I think that having the individual tiles raise an event when the user makes a change makes sense, but during the game run, what should control?

The layout question is really the top priority right now. I have to instantiate 80 separate controls and make them display in a grid of 8 rows of 10 columns, and I'm not sure of the most efficient way to accomplish that. I could calculate the XY coordinates for each top left corner and render them that way, but that seems awfully ugly. Is there a better way?
Will Rogers never met me.

AnswerRe: A Layout Question, And A Bit More Pin
Pete O'Hanlon17-May-12 23:19
mvePete O'Hanlon17-May-12 23:19 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright18-May-12 11:35
professionalRoger Wright18-May-12 11:35 
GeneralRe: A Layout Question, And A Bit More Pin
Pete O'Hanlon18-May-12 22:38
mvePete O'Hanlon18-May-12 22:38 
GeneralRe: A Layout Question, And A Bit More Pin
GuyThiebaut21-May-12 1:39
professionalGuyThiebaut21-May-12 1:39 
GeneralRe: A Layout Question, And A Bit More Pin
Pete O'Hanlon21-May-12 2:02
mvePete O'Hanlon21-May-12 2:02 
AnswerRe: A Layout Question, And A Bit More Pin
PIEBALDconsult18-May-12 5:18
mvePIEBALDconsult18-May-12 5:18 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright18-May-12 8:47
professionalRoger Wright18-May-12 8:47 
GeneralRe: A Layout Question, And A Bit More Pin
PIEBALDconsult18-May-12 9:12
mvePIEBALDconsult18-May-12 9:12 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright18-May-12 9:51
professionalRoger Wright18-May-12 9:51 
GeneralRe: A Layout Question, And A Bit More Pin
PIEBALDconsult18-May-12 11:16
mvePIEBALDconsult18-May-12 11:16 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright18-May-12 11:31
professionalRoger Wright18-May-12 11:31 
AnswerRe: A Layout Question, And A Bit More Pin
Ennis Ray Lynch, Jr.18-May-12 5:44
Ennis Ray Lynch, Jr.18-May-12 5:44 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright18-May-12 19:50
professionalRoger Wright18-May-12 19:50 
AnswerRe: A Layout Question, And A Bit More Pin
BillWoodruff20-May-12 17:54
professionalBillWoodruff20-May-12 17:54 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright20-May-12 20:34
professionalRoger Wright20-May-12 20:34 
GeneralRe: A Layout Question, And A Bit More Pin
BillWoodruff21-May-12 18:10
professionalBillWoodruff21-May-12 18:10 
GeneralRe: A Layout Question, And A Bit More Pin
BillWoodruff22-May-12 3:47
professionalBillWoodruff22-May-12 3:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.