473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems WIth Graphics - VB Assignement

HI I am using the Graphics to paint to a a picture box but if i minimise my screen the picture disappears is there anyway i can fix this?? Please Help!! here is my code:
PLease Help me it will be deeply appreciated!!
Dim g As Graphics = Me.PictureBox3.CreateGraphics()
g.Clear(Me.PictureBox3.BackColor)

Dim curImage As Image = Drawing.Image.FromFile(Application.StartupPath + "\Resources\South1.png")
g.DrawImage(curImage, 0, 0, curImage.Width, curImage.Height)

Dim i As Integer

For i = 0 To Rds.Tables(0).Rows.Count - 1
Dim ave As Double
Dim x, y, w, h As Integer
Dim faultcounts As Integer

faultcounts = Convert.ToInt64(Rds.Tables(0).Rows.Item(i)("Expr1" ))
ave = (faultcounts / totals)
x = Rds.Tables(0).Rows.Item(i)("XCoordinate")
y = Rds.Tables(0).Rows.Item(i)("YCoordinate")
w = Rds.Tables(0).Rows.Item(i)("WidthHM")
h = Rds.Tables(0).Rows.Item(i)("HeightHM")

If (ave > 0.25) Then
Dim rectan As New Rectangle(x, y, w, h)
g.FillRectangle(New SolidBrush(Color.FromArgb(140, 255, 0, 0)), rectan)
rectan.Y += 60

ElseIf (ave < 0.25 And ave > 0.1) Then
Dim rectan1 As New Rectangle(x, y, w, h)
g.FillRectangle(New SolidBrush(Color.FromArgb(140, 255, 255, 0)), rectan1)
rectan1.Y += 60
ElseIf (ave < 0.1 Or ave = Nothing) Then
Dim rectan2 As New Rectangle(x, y, w, h)
g.FillRectangle(New SolidBrush(Color.FromArgb(140, 0, 0, 255)), rectan2)
rectan2.Y += 60
End If

Next

g.Dispose()
End Sub
Oct 10 '06 #1
1 1385
Killer42
8,435 Expert 8TB
Sorry, I haven't taken the time to read your code, but there's one thing you should try - check that wherever you are drawing your graphics has AutoRedraw = True before you start drawing.
Oct 19 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: yuraukar | last post by:
I am trying to create a garbage collection class in C++ to collect instances of a specific class (so no general gc). The approach is to use smart pointers and a mark and a simple sweep gc. ...
3
by: sushant | last post by:
hi all, whats the difference between assignement and initialisation in C. is assignement related with scanf() and initialisation with (int x=10;) sushant
3
by: Bill C. | last post by:
Hello, I know this has been discussed a lot already because I've been searching around for information the last few weeks. I'm trying to implement a DataGridComboBoxColumn class. I've found...
1
by: redneon | last post by:
I'm trying to add another button to a window's title bar to use as a "keep this window on top" button. I've managed to draw the button using the code below (C#) but I'm having a couple of other...
1
by: nate axtell | last post by:
In VB .Net I made a custom CheckBox column style (for the Datagrid control) that maps to two DataTable columns , one it uses for the Checked status and the other it uses for the Enabled status. I am...
2
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
6
by: saunderl | last post by:
Hello Everyone, I'm trying to just play with managed VC++. I just want to draw a box on the form when it is clicked. Here is my click event handler System::Void Test_Click(System::Object^ ...
0
by: gopal28 | last post by:
HI I am using the Graphics to paint to a a picture box but if i minimise my screen the picture disappears is there anyway i can fix this?? Please Help!! here is my code: PLease Help me it will be...
17
by: Alexander Eisenhuth | last post by:
Hello, is there a assignement operator, that i can overwrite? class MyInt: def __init__(self, val): assert(isinstance(val, int)) self._val = val a = MyInt(10)
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.