Click here to Skip to main content
15,888,454 members
Home / Discussions / C#
   

C#

 
SuggestionRe: Show panel after a job is completed Pin
Sascha Lefèvre29-Feb-16 7:48
professionalSascha Lefèvre29-Feb-16 7:48 
GeneralRe: Show panel after a job is completed Pin
Pablo Bozzolo29-Feb-16 8:07
Pablo Bozzolo29-Feb-16 8:07 
GeneralRe: Show panel after a job is completed Pin
Sascha Lefèvre29-Feb-16 8:21
professionalSascha Lefèvre29-Feb-16 8:21 
GeneralRe: Show panel after a job is completed Pin
Pablo Bozzolo29-Feb-16 9:16
Pablo Bozzolo29-Feb-16 9:16 
GeneralRe: Show panel after a job is completed Pin
Mycroft Holmes29-Feb-16 11:56
professionalMycroft Holmes29-Feb-16 11:56 
GeneralRe: Show panel after a job is completed Pin
Richard MacCutchan29-Feb-16 10:42
mveRichard MacCutchan29-Feb-16 10:42 
AnswerRe: Show panel after a job is completed Pin
Luc Pattyn29-Feb-16 17:30
sitebuilderLuc Pattyn29-Feb-16 17:30 
AnswerRe: Show panel after a job is completed Pin
BillWoodruff1-Mar-16 1:00
professionalBillWoodruff1-Mar-16 1:00 
There are several things you could do to make your existing code run a bit faster, but I'm going to join the choir here singing that 3500 Labels are too much, and you need to change horses.

I think you will be surprised, as I was, how much you can do with making a grid by painting on a Panel; here's a screenshot from a 15x10 grid that I draw on a Panel: [^].

The "highlighted cell" you see is the result of a click on the Panel: that's a Label, sized to the cell-size in this example, that pops-up directly over the "cell" clicked; it presents information about the row,column address, and the cell id number.

The color scheme is generated algorithmically, stored in a data structure, and then mapped to the cells in the Paint EventHandler; this data is also computed in advance: the set of Rectangles of all cells in the grid; the set of strings painted into each cell. Of course, all brushes and pens are created outside the Paint EventHandler. The idea ... an obvious one ... is to get all possible computation, and whatever-creation, out of the Paint EventHandler.

Hit detection is very easy:
C#
// note this (working) code obviously relies on variables which are not shown here
// hopefully the names of those variables are so mnemonic that it will be
// clear what is going on
private void Grid1_MouseDown(object sender, MouseEventArgs e)
{
    currentRow = e.Y/rowHeight;
    currentColumn = e.X/columnWidth;

    cellId = currentRow*columnCount + currentColumn;

    PopLabel.Text = string.Format("{0},{1} {2}", currentRow, currentColumn, cellId);

    PopUPPanel.Location = new Point(currentColumn*columnWidth, currentRow*rowHeight);
}
I did try cranking up this prototype to 50 rows of 70 columns, and it drew very quickly (i7-4970k machine, Win 8.1, 8 gigs memory at present for testing purposes). But, I have no idea what to do with 3500 cells Smile | :)
«In art as in science there is no delight without the detail ... Let me repeat that unless these are thoroughly understood and remembered, all “general ideas” (so easily acquired, so profitably resold) must necessarily remain but worn passports allowing their bearers short cuts from one area of ignorance to another.» Vladimir Nabokov, commentary on translation of “Eugene Onegin.”

QuestionConditional Mathematical Statements Pin
Member 1226553728-Feb-16 21:39
Member 1226553728-Feb-16 21:39 
AnswerRe: Conditional Mathematical Statements Pin
Pete O'Hanlon28-Feb-16 22:08
mvePete O'Hanlon28-Feb-16 22:08 
AnswerRe: Conditional Mathematical Statements Pin
Sascha Lefèvre28-Feb-16 22:09
professionalSascha Lefèvre28-Feb-16 22:09 
Questionicon/image in datagridview Pin
Any_name_at_all28-Feb-16 1:52
Any_name_at_all28-Feb-16 1:52 
AnswerRe: icon/image in datagridview Pin
Dave Kreskowiak28-Feb-16 4:25
mveDave Kreskowiak28-Feb-16 4:25 
GeneralRe: icon/image in datagridview Pin
Any_name_at_all28-Feb-16 5:52
Any_name_at_all28-Feb-16 5:52 
QuestionHow does Observable.Join work? Pin
Kenneth Haugland27-Feb-16 18:38
mvaKenneth Haugland27-Feb-16 18:38 
AnswerRe: How does Observable.Join work? Pin
Kenneth Haugland28-Feb-16 12:15
mvaKenneth Haugland28-Feb-16 12:15 
SuggestionRe: How does Observable.Join work? Pin
John Torjo28-Feb-16 18:44
professionalJohn Torjo28-Feb-16 18:44 
GeneralRe: How does Observable.Join work? Pin
Kenneth Haugland28-Feb-16 19:13
mvaKenneth Haugland28-Feb-16 19:13 
GeneralRe: How does Observable.Join work? Pin
John Torjo28-Feb-16 19:17
professionalJohn Torjo28-Feb-16 19:17 
GeneralRe: How does Observable.Join work? Pin
Kenneth Haugland29-Feb-16 18:40
mvaKenneth Haugland29-Feb-16 18:40 
GeneralRe: How does Observable.Join work? Pin
John Torjo29-Feb-16 19:40
professionalJohn Torjo29-Feb-16 19:40 
QuestionGrid View Filtering Pin
Member 1235559027-Feb-16 3:07
Member 1235559027-Feb-16 3:07 
AnswerRe: Grid View Filtering Pin
Afzaal Ahmad Zeeshan27-Feb-16 4:09
professionalAfzaal Ahmad Zeeshan27-Feb-16 4:09 
Questionwhy password is not decrypting Pin
Veena Hosur25-Feb-16 23:13
Veena Hosur25-Feb-16 23:13 
AnswerRe: why password is not decrypting Pin
Richard MacCutchan26-Feb-16 0:20
mveRichard MacCutchan26-Feb-16 0:20 

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.