Panel drawing problems.

L

Leif Eirik Olsen

Hi,

I have some code I'm using in a CompactFramework project. The code works as
expected on the CF, but when using this code on the FullFramework (FF) it
does not work the way I want. It copiles ok, but the screendrawing is not
working 100%.

What the code is supposed to do:
Draw recieved values to a panel so values are displayed countiniously as a
scrolling graph.
Too do the 'scrolling' I first copy the existing bitmap from my panel and
draw it back -1 position to the left.
Then I clear the rightmost part of the panel
and finally draw the new recieved value on the newly cleared area.

It is the 'scrolling' part that is not working on FF.

Does anyone have any hints or clues on what I'm doing wrong here ? (Please
see code below)


/*From constructor
DrawBitMap = new Bitmap(DrawPanel.Width, DrawPanel.Height);
DrawGrapics = Graphics.FromImage(DrawBitMap);
*/

internal void DrawAdvancedMode(int sample)
{
int h = DrawPanel.Height;
int w = DrawPanel.Width - 1;
DrawGrapics.DrawImage(DrawBitMap, -1, 0); // scroll left. I think this
where the problem is*******
DrawGrapics.FillRegion(WhiteBrush, new Region(new Rectangle(w - 1, 0, w,
h))); // clear plot region

int y = h-(int)((double)h * ((double)sample/MAX_SAMPLE));
int x = w - 1 + i;

// plot
DrawGrapics.DrawLine(BluePen, x, y, LastPoint.X, LastPoint.Y);
DrawPanel.Invalidate();
LastPoint.X = x;
LastPoint.Y = y;
LastPoint.X -= 1;
}

Thanks for reading.

regards,
Leo
 
L

Leif Eirik Olsen

Hi again,

Forgot to post this code, and guess it is needed :)

/*from constructor
DrawPanel.Paint += new PaintEventHandler(PaintPanelSignal);
*/

internal void PaintPanelSignal(object sender,
System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.DrawImage(DrawBitMap, 0, 0);
}


regards,
Leo
 
L

Leif Eirik Olsen

Me again:)

I just noticed the group 'dotnet.framework.drawing'. and as that looks like
a more appropriate group for my question I've asked my question there.

Subject "Scroll Panel Image"

regards,
Leo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top