Panel drawing problems.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leif Eirik Olsen

    #1

    Panel drawing problems.

    Hi,

    I have some code I'm using in a CompactFramewor k 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(DrawPane l.Width, DrawPanel.Heigh t);
    DrawGrapics = Graphics.FromIm age(DrawBitMap) ;
    */

    internal void DrawAdvancedMod e(int sample)
    {
    int h = DrawPanel.Heigh t;
    int w = DrawPanel.Width - 1;
    DrawGrapics.Dra wImage(DrawBitM ap, -1, 0); // scroll left. I think this
    where the problem is*******
    DrawGrapics.Fil lRegion(WhiteBr ush, 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.Dra wLine(BluePen, x, y, LastPoint.X, LastPoint.Y);
    DrawPanel.Inval idate();
    LastPoint.X = x;
    LastPoint.Y = y;
    LastPoint.X -= 1;
    }

    Thanks for reading.

    regards,
    Leo


  • Leif Eirik Olsen

    #2
    Additional information.

    Hi again,

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

    /*from constructor
    DrawPanel.Paint += new PaintEventHandl er(PaintPanelSi gnal);
    */

    internal void PaintPanelSigna l(object sender,
    System.Windows. Forms.PaintEven tArgs e)
    {
    e.Graphics.Draw Image(DrawBitMa p, 0, 0);
    }


    regards,
    Leo


    Comment

    • Leif Eirik Olsen

      #3
      Re: Panel drawing problems.

      Me again:)

      I just noticed the group 'dotnet.framewo rk.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


      Comment

      Working...