Click here to Skip to main content
15,889,651 members
Home / Discussions / C#
   

C#

 
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 
Hi Roger,

I'm into nested UserControls. I'll assume that what I say here is easily "tranposed" from WinForms to WPF, while being not entirely sure that's true.

The case of 90 UserControls (80 tile controls, and, in this case, ten "row of tiles" containers) would not worry me the least bit in terms of performance ... in WinForms.

I'd start with your basic Usercontrol, 'TheTile,' and make it expose public properties such as its (invariant) unique number, a boolean for its current "state:" selected or unselected.

Inside TheTile, I'd use a a Label control, rather than a button, which would contain the number, and I'd create Public get/set properties to set the number.

I'd then build a 'RowOfTiles' UserControl each of which would contain ten instances of the 'TheTile:' in the 'Load event of RowOfTiles, and add them to the RowOfTiles instance Control Collection: by setting the Dock property of TheTile to Dock.Right, you get automatic proper horizontal alignment/order.

Then in the Form/Window Load event, I'd for-loop instantiate ten instances of the RowOfTiles control, and add them to the Control collection of the Panel container on the Form. Again, using Dock set to Dock.Bottom will give you automatic proper vertical alignment/order.

On a "global level" I'd create a collection of type TheTile to hold the currently selected tiles. Something like: List<TheTile>.

And I'd create a master collection of the form:

List<RowOfTiles> to facilitate rapid enumeration of the whole collection and manipulation of it. Or maybe just a "flat list" of type List<TheTile> to hold all the Tiles.

It took me less than ten minutes to implement a simple working prototype of this grid of "nested" UserControls in WinForms, all properly labeled from #1~80, and which switched tile colors (switched the background color of the Label enclosed in the TheTile UserControl) as clikcing (the Label)toggled TheTile between 'Selected and 'Unselected states, and updated the master (global static, on the Main Form) collection of "SelectedTiles."

Screen shot here:[^]

While I could not find any clear description of "Cleopatra Keno" on the web, I was baffled enough reading the WikiP entry on Keno itself Smile | :)

What really puzzles me in your description of Cleopatra flavor Keno is the implication that the user can do something while the game is in progress, if I interpret what you say in the words: "Hit during game play" correctly, but, please, don't feel you need to educate me on this, because I guarantee you I'll never play Keno Smile | :) : I gamble with my life everyday riding a bicycle in the northern Thailand anarchy known as "traffic," actually a major form of birth control, as well as a major factor in culling out the wick and sick from the population Sigh | :sigh:

Thanks for the impetus to actually write some code for the first time in three months ! Smile | :)

best, Bill

p.s. pm me if you want the source for the C# WinForms quick prototype.
"Humans are amphibians ... half spirit and half animal ... as spirits they belong to the eternal world, but as animals they inhabit time. This means that while their spirit can be directed to an eternal object, their bodies, passions, and imaginations are in continual change, for to be in time, means to change. Their nearest approach to constancy, therefore, is undulation: the repeated return to a level from which they repeatedly fall back, a series of troughs and peaks.” C.S. Lewis

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 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright23-May-12 20:11
professionalRoger Wright23-May-12 20:11 
AnswerRe: A Layout Question, And A Bit More Pin
Gerry Schmitz21-May-12 13:12
mveGerry Schmitz21-May-12 13:12 
GeneralRe: A Layout Question, And A Bit More Pin
BillWoodruff21-May-12 17:42
professionalBillWoodruff21-May-12 17:42 
GeneralRe: A Layout Question, And A Bit More Pin
Gerry Schmitz21-May-12 21:02
mveGerry Schmitz21-May-12 21:02 
GeneralRe: A Layout Question, And A Bit More Pin
Roger Wright23-May-12 20:13
professionalRoger Wright23-May-12 20:13 
QuestionRow Not Found Or Changed Pin
Kevin Marois17-May-12 10:10
professionalKevin Marois17-May-12 10:10 
AnswerRe: Row Not Found Or Changed Pin
VJ Reddy17-May-12 21:22
VJ Reddy17-May-12 21:22 
Generalneed help Pin
Kurac117-May-12 9:09
Kurac117-May-12 9:09 
GeneralRe: need help Pin
Pete O'Hanlon17-May-12 9:13
mvePete O'Hanlon17-May-12 9:13 
GeneralRe: need help Pin
Kurac117-May-12 9:16
Kurac117-May-12 9:16 
GeneralRe: need help Pin
Pete O'Hanlon17-May-12 9:22
mvePete O'Hanlon17-May-12 9:22 
AnswerRe: need help Pin
Luc Pattyn17-May-12 11:57
sitebuilderLuc Pattyn17-May-12 11:57 
GeneralRe: need help Pin
fjdiewornncalwe17-May-12 11:16
professionalfjdiewornncalwe17-May-12 11:16 
QuestionNumericUpDown control increment value change Pin
Blubbo17-May-12 7:38
Blubbo17-May-12 7:38 

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.