D Paste by Anonymous
Description: None
Hide line numbers

Create new paste
Post a reply
View replies

Paste:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
private import    dfl.all;


int main()
{
  try
  {
      Application.run(new GraphTest);
  } 
  catch(Object o)
  {
      msgBox(o.toString(), "Fatal Error" , MsgBoxButtons.OK , MsgBoxIcon.ERROR);
      return 1;
  }
  return 1;
}

class GraphTest: Form
{

    
    this()
    {
        text = "MemoryGraphics";        
                
        Panel panGraphic = new MemDrawer(2000,2000);
        panGraphic.backColor = Color(0,0,0);
        
        panGraphic.dock( DockStyle.FILL );
        this.controls.add(panGraphic);
    }
}

class MemDrawer:Panel
{
    private MemoryGraphics memGraph;
    
    this(int w,int h)
    {        
        memGraph = new MemoryGraphics(w,h);
        
        ubyte r = 0 ;
        for (int i=0;i<w;i++)
        {
            r += 10;
            if (r>255) r=0;
            memGraph.drawLine(new Pen(Color(r,255,255)), i,0,i,h);
        }
    }
    
    protected override void onPaint(PaintEventArgs ea)
    {
        memGraph.copyTo(createGraphics,0,0,memGraph.width,memGraph.height);
    }
}

Replies:
Reply by gLueIdHRIUGcankFPl
Thank you so much for this arltcie, it saved me time!

    (some replies deleted)