PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
e.Graphics.DrawImage don't redraws
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
e.Graphics.DrawImage don't redraws
![]() |
e.Graphics.DrawImage don't redraws |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I'm develloping a c# wm5.0 app. and run into some graphics problem,
which I can't figure out. Hopefully somebody can help me. I draw an image on a tabpage, this image contains several ellipses on different locations. However there's also a combox in the tabpage, which takes care of the selection of ellipses on the tabpage. The problem is that the first drawing of ellipses if done well, however after another selection there must be ellipses drawn on different locations. This doesn't work. The old ellipses are still in place and no new ones are drawn. private Image _image; private Graphics _graphics; In the constructor I load the background image where the ellipses must be placed on: _image = new System.Drawing.Bitmap(PDAback.gif"); after the (combobox) selection: _graphics = Graphics.FromImage(_image); foreach ellipse: _graphics.FillEllipse(new SolidBrush(Color.Red), xPosPix, yPosPix, 10, 10); and finally the overrided paint: private void tabPageOverzicht_Paint(object sender, PaintEventArgs e) { // Draw image to screen. e.Graphics.DrawImage(_image, 0, 0); // Dispose of graphics object. if (_graphics != null) _graphics.Dispose(); } So the problem is that the _graphics.FillEllipse() method the second time, fills new (different) ellipses, but the old ones are still shown, and the new ones not. Thnx |
|
|
|
#2 |
|
Guest
Posts: n/a
|
A selection of the combobox item I believe does not cause a WM_PAINT message
to be generated, so you will explicitly need to call the Refresh() method after the combo selection. Regards Simon. "Bram Hoefnagel" <bhoefnagel@actemium.nl> wrote in message news:1158159799.591995.323790@e3g2000cwe.googlegroups.com... > I'm develloping a c# wm5.0 app. and run into some graphics problem, > which I can't figure out. Hopefully somebody can help me. > > I draw an image on a tabpage, this image contains several ellipses on > different locations. > However there's also a combox in the tabpage, which takes care of the > selection of ellipses on the tabpage. > > The problem is that the first drawing of ellipses if done well, however > after another selection there must be ellipses drawn on different > locations. This doesn't work. The old ellipses are still in place and > no new ones are drawn. > > private Image _image; > private Graphics _graphics; > > In the constructor I load the background image where the ellipses must > be placed on: > _image = new System.Drawing.Bitmap(PDAback.gif"); > > after the (combobox) selection: > _graphics = Graphics.FromImage(_image); > foreach ellipse: > _graphics.FillEllipse(new SolidBrush(Color.Red), xPosPix, yPosPix, 10, > 10); > > and finally the overrided paint: > private void tabPageOverzicht_Paint(object sender, PaintEventArgs e) > { > // Draw image to screen. > e.Graphics.DrawImage(_image, 0, 0); > // Dispose of graphics object. > if (_graphics != null) > _graphics.Dispose(); > } > > So the problem is that the _graphics.FillEllipse() method the second > time, fills new (different) ellipses, but the old ones are still shown, > and the new ones not. > > Thnx > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

