Click here to Skip to main content
15,904,153 members
Home / Discussions / C#
   

C#

 
QuestionVery strange "out of memory" exception Pin
softwarejaeger1-Sep-08 20:49
softwarejaeger1-Sep-08 20:49 
AnswerRe: Very strange "out of memory" exception Pin
AhsanS1-Sep-08 20:59
AhsanS1-Sep-08 20:59 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger1-Sep-08 21:32
softwarejaeger1-Sep-08 21:32 
AnswerRe: Very strange "out of memory" exception Pin
Guffa1-Sep-08 22:00
Guffa1-Sep-08 22:00 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger1-Sep-08 22:11
softwarejaeger1-Sep-08 22:11 
GeneralRe: Very strange "out of memory" exception Pin
Manas Bhardwaj1-Sep-08 22:14
professionalManas Bhardwaj1-Sep-08 22:14 
GeneralRe: Very strange "out of memory" exception Pin
Mycroft Holmes1-Sep-08 22:39
professionalMycroft Holmes1-Sep-08 22:39 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger1-Sep-08 23:00
softwarejaeger1-Sep-08 23:00 
GeneralRe: Very strange "out of memory" exception Pin
leppie1-Sep-08 23:06
leppie1-Sep-08 23:06 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger1-Sep-08 23:12
softwarejaeger1-Sep-08 23:12 
GeneralRe: Very strange "out of memory" exception Pin
leppie2-Sep-08 0:27
leppie2-Sep-08 0:27 
GeneralRe: Very strange "out of memory" exception Pin
Guffa2-Sep-08 0:43
Guffa2-Sep-08 0:43 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger2-Sep-08 1:05
softwarejaeger2-Sep-08 1:05 
GeneralRe: Very strange "out of memory" exception Pin
leppie2-Sep-08 1:57
leppie2-Sep-08 1:57 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger2-Sep-08 2:17
softwarejaeger2-Sep-08 2:17 
GeneralRe: Very strange "out of memory" exception Pin
leppie2-Sep-08 2:28
leppie2-Sep-08 2:28 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger2-Sep-08 2:51
softwarejaeger2-Sep-08 2:51 
GeneralRe: Very strange "out of memory" exception Pin
Daniel Grunwald2-Sep-08 2:04
Daniel Grunwald2-Sep-08 2:04 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger2-Sep-08 2:53
softwarejaeger2-Sep-08 2:53 
GeneralRe: Very strange "out of memory" exception Pin
Daniel Grunwald2-Sep-08 2:57
Daniel Grunwald2-Sep-08 2:57 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger2-Sep-08 3:03
softwarejaeger2-Sep-08 3:03 
GeneralRe: Very strange "out of memory" exception Pin
Daniel Grunwald2-Sep-08 3:17
Daniel Grunwald2-Sep-08 3:17 
You have to do it manually. Whenever the user scrolls, dispose the controls going out of view and create new controls for the items coming into view.

Or, the alternative solution (IMHO better):
Use the Paint event of the control and draw using the e.Graphics object.

Something like this:
// in the table control:
protected override void OnPaint(PaintEventArgs e) {
  base.OnPaint(e);
  foreach (Cell c in cells) {
    c.Paint(e.Graphics, new Rectangle(...)); // tell the cell to draw itself
  }
}
// the cell:
class Cell { // no control!
  public void Paint(Graphics g, Rectangle r) {
    // drawing code
  }
}

You'll have to write the code to manage the cells and their drawing positions.
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger2-Sep-08 3:31
softwarejaeger2-Sep-08 3:31 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger2-Sep-08 20:08
softwarejaeger2-Sep-08 20:08 
GeneralRe: Very strange "out of memory" exception Pin
softwarejaeger3-Sep-08 3:37
softwarejaeger3-Sep-08 3:37 

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.