I have a problem when trying to draw to a panel immediatly after calling a panel.Update(); Here's the code:
public void AddAndDraw(double X, double Y){
AddPoint (X, Y);
bool invalidated = false;
if (X > _master.xMaxRange) {
_master.Update ();
invalidated = true;
}
if (Y > _master.yMaxRange) {
_master.Update ();
invalidated = true;
}
if (!invalidated) {
_master.UpdateGraph (this);
} else {
_master.PaintContent ();
}
}
When running this problem I only see the cleared panel and not he content I'm trying to paint in the .PaintContent()-method. I've already tried using .Invalidate() and .Refresh() on the panel instead of .Update()
Any suggestions on how to fix this?
It seems your situation calls for a
PictureBox
.PBs
are interesting here because they have three layers they can display:BackgroundImage
propertyImage
propertyPaint
eventAs you need a fixed axis, and graph that is not changing all the time and a point you want to update often
PB
seems to be made for you!Call the functions as needed and when the point has changed call
Invalidate()
on yourPictureBox
!