Click here to Skip to main content
15,895,142 members
Home / Discussions / C#
   

C#

 
GeneralRe: Word Search Style Game Pin
Jason C Bourne10-Jan-09 2:15
Jason C Bourne10-Jan-09 2:15 
GeneralRe: Word Search Style Game Pin
VinceAshbySmith10-Jan-09 2:30
VinceAshbySmith10-Jan-09 2:30 
GeneralRe: Word Search Style Game Pin
Jason C Bourne10-Jan-09 3:47
Jason C Bourne10-Jan-09 3:47 
GeneralRe: Word Search Style Game Pin
VinceAshbySmith10-Jan-09 5:01
VinceAshbySmith10-Jan-09 5:01 
GeneralRe: Word Search Style Game Pin
Jason C Bourne11-Jan-09 1:47
Jason C Bourne11-Jan-09 1:47 
GeneralRe: Word Search Style Game Pin
VinceAshbySmith11-Jan-09 10:50
VinceAshbySmith11-Jan-09 10:50 
GeneralRe: Word Search Style Game Pin
Eddy Vluggen10-Jan-09 9:23
professionalEddy Vluggen10-Jan-09 9:23 
AnswerRe: Word Search Style Game Pin
Jason C Bourne10-Jan-09 1:42
Jason C Bourne10-Jan-09 1:42 
You should try a more object-oriented approach, you are really complexifying your life. Split this code in multiple small elements responsible of a single responsibility. The rectangle that holds a letter is one object. If you make a UserControl for this simple responsibility, you can delegate the complexity of catching MouseEnter/MouseLeave/etc... events in the control itself. Via two small event handlers, you can highlight and unhighlight your control without having to determine any coordinate.

The "host" of you multiple rectangles is another UserControl. Its only responsibility is to put all the small rectangles in a bigger rectangle. Eventually, it computes the size that a single "letter rectangle" can have, as it knows it own size and the total number of smaller rectangles to put in itself.

And finally, generating letters is another responsibility. The generation of the letters occurs outside, is provided to the big UserControl, and it will instantiate the correct number of small rectanges, providing the text and the size.

Don't play with positioning that you compute yourself, use docking. All this code can be reduced to 10 lines.

Jean-Christophe Grégoire

QuestionHow ENQ command is sent to serial port Pin
Member 465172910-Jan-09 0:19
Member 465172910-Jan-09 0:19 
AnswerRe: How ENQ command is sent to serial port Pin
Luc Pattyn10-Jan-09 1:47
sitebuilderLuc Pattyn10-Jan-09 1:47 
AnswerRe: How ENQ command is sent to serial port Pin
Member 465172910-Jan-09 2:43
Member 465172910-Jan-09 2:43 
GeneralRe: How ENQ command is sent to serial port Pin
Member 465172910-Jan-09 2:57
Member 465172910-Jan-09 2:57 
GeneralRe: How ENQ command is sent to serial port Pin
Luc Pattyn10-Jan-09 3:02
sitebuilderLuc Pattyn10-Jan-09 3:02 
QuestionChange user controls in runtime using c# Pin
bensonbenadict10-Jan-09 0:11
bensonbenadict10-Jan-09 0:11 
AnswerRe: Change user controls in runtime using c# (ASP.Net Question ) Pin
Abhijit Jana10-Jan-09 0:15
professionalAbhijit Jana10-Jan-09 0:15 
GeneralRe: Change user controls in runtime using c# (ASP.Net Question ) Pin
sudhanvag10-Jan-09 4:40
sudhanvag10-Jan-09 4:40 
AnswerRe: Change user controls in runtime using c# Pin
Colin Angus Mackay10-Jan-09 0:22
Colin Angus Mackay10-Jan-09 0:22 
AnswerRe: Change user controls in runtime using c# Pin
#realJSOP11-Jan-09 0:28
mve#realJSOP11-Jan-09 0:28 
GeneralRe: Change user controls in runtime using c# Pin
bensonbenadict11-Jan-09 19:31
bensonbenadict11-Jan-09 19:31 
QuestionCreate new url type for RichTextBox [modified] Pin
ghbloos9-Jan-09 23:45
ghbloos9-Jan-09 23:45 
AnswerRe: Create new url type for RichTextBox Pin
Eddy Vluggen10-Jan-09 0:37
professionalEddy Vluggen10-Jan-09 0:37 
GeneralRe: Create new url type for RichTextBox Pin
ghbloos10-Jan-09 1:03
ghbloos10-Jan-09 1:03 
AnswerRe: Create new url type for RichTextBox Pin
mav.northwind10-Jan-09 1:17
mav.northwind10-Jan-09 1:17 
GeneralRe: Create new url type for RichTextBox Pin
ghbloos10-Jan-09 1:33
ghbloos10-Jan-09 1:33 
QuestionThread.Abort Pin
thenewbee9-Jan-09 19:42
thenewbee9-Jan-09 19:42 

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.