Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 3 Jul 2008 09:19:39 -0700 (PDT),    group: microsoft.public.dotnet.languages.vb        back       


Drawing on top of a static image   
I am using VB.NET to draw a gauge; i.e. to repeatedly draw a needle
moving on top of a static image of the gauge background whenever the
value changes.

Each time the value changes, I can clear the current graphics to some
color, redraw the gauge background picture with Graphics.DrawImage and
then the needle on top of it with Graphics.DrawPolygon & FillPolygon,
but this seems very wateful as the background never changes.

If I set the control's BackImage as my image and then only draw the
needle though, the last few spots the needle was still show it there
so it looks like there are many needles.  These all get cleaned up
periodically when OnPaint is called but only when called by the system
(when I trigger OnPaint no cleanup occurs).

What is the right way to do this?

Thanks,
Jo
date: Thu, 3 Jul 2008 09:19:39 -0700 (PDT)   author:   unknown

RE: Drawing on top of a static image   
Can you draw the needle on a separate transparent control that overlaps the 
background image?

-- 
David Streeter
Synchrotech Software
Sydney Australia


"JMecc0@gmail.com" wrote:

> I am using VB.NET to draw a gauge; i.e. to repeatedly draw a needle
> moving on top of a static image of the gauge background whenever the
> value changes.
> 
> Each time the value changes, I can clear the current graphics to some
> color, redraw the gauge background picture with Graphics.DrawImage and
> then the needle on top of it with Graphics.DrawPolygon & FillPolygon,
> but this seems very wateful as the background never changes.
> 
> If I set the control's BackImage as my image and then only draw the
> needle though, the last few spots the needle was still show it there
> so it looks like there are many needles.  These all get cleaned up
> periodically when OnPaint is called but only when called by the system
> (when I trigger OnPaint no cleanup occurs).
> 
> What is the right way to do this?
> 
> Thanks,
> Jo
>
date: Thu, 3 Jul 2008 18:12:17 -0700   author:   SurturZ am

Re: Drawing on top of a static image   
I guess I could do that too.  Thanks for the tip.

I did resolve my issue though by adding Me.Refresh() such that the old
drawings could get whisked away.

Jo
date: Mon, 7 Jul 2008 14:50:04 -0700 (PDT)   author:   unknown

RE: Drawing on top of a static image   
I can't believe I haven't noticed it before but the PictureBox control in 
VS2008 has a ".BackgroundImage" property as well as an ".Image" property.

In fact, it's a property of the Control class!!!

Maybe this will do what you need?

-- 
David Streeter
Synchrotech Software
Sydney Australia


"JMecc0@gmail.com" wrote:

> I am using VB.NET to draw a gauge; i.e. to repeatedly draw a needle
> moving on top of a static image of the gauge background whenever the
> value changes.
> 
> Each time the value changes, I can clear the current graphics to some
> color, redraw the gauge background picture with Graphics.DrawImage and
> then the needle on top of it with Graphics.DrawPolygon & FillPolygon,
> but this seems very wateful as the background never changes.
> 
> If I set the control's BackImage as my image and then only draw the
> needle though, the last few spots the needle was still show it there
> so it looks like there are many needles.  These all get cleaned up
> periodically when OnPaint is called but only when called by the system
> (when I trigger OnPaint no cleanup occurs).
> 
> What is the right way to do this?
> 
> Thanks,
> Jo
>
date: Mon, 14 Jul 2008 23:06:02 -0700   author:   SurturZ am

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us