473,790 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems WIth Graphics - VB Assignement

2 New Member
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.Pict ureBox3.BackCol or)

Dim curImage As Image = Drawing.Image.F romFile(Applica tion.StartupPat h + "\Resources\Sou th1.png")
g.DrawImage(cur Image, 0, 0, curImage.Width, curImage.Height )

Dim i As Integer

For i = 0 To Rds.Tables(0).R ows.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)("E xpr1"))
ave = (faultcounts / totals)
x = Rds.Tables(0).R ows.Item(i)("XC oordinate")
y = Rds.Tables(0).R ows.Item(i)("YC oordinate")
w = Rds.Tables(0).R ows.Item(i)("Wi dthHM")
h = Rds.Tables(0).R ows.Item(i)("He ightHM")

If (ave > 0.25) Then
Dim rectan As New Rectangle(x, y, w, h)
g.FillRectangle (New SolidBrush(Colo r.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(Colo r.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(Colo r.FromArgb(140, 0, 0, 255)), rectan2)
rectan2.Y += 60
End If

Next

g.Dispose()
End Sub
Oct 10 '06 #1
1 1407
Killer42
8,435 Recognized Expert Expert
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
1642
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. smartptr<B> pB; pB = new B(args); The constructor of B has been adjusted to register new instances with the garbage collector. The constructor of smartptr has also been adjusted to register new instances of smart pointers with the garbage
3
1500
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
4273
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 several examples on the web. They all seem to have problems, though that I've been unable to resolve. The most promising example I have found is at:
1
5094
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 problems... .... private bool buttonChecked = false; private int buttonSize = 16; private int buttonX = 226; private int buttonY = 6;
1
3598
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 having a couple problems so far. 1. with the way the Paint method works: When I scroll to the right, the custom column gets Drawn on top of the left-most "Selecting" column (the one where the green arrows are displayed). How can I possibly modify...
2
3138
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 get all kinds of screen artifacts and weirdness. My general goal is: list item with a few areas for text, every other item shaded a light color for readability, font color changes with selection. The listbox is populated with custom structurs...
6
3932
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^ sender, System::EventArgs^ e) { // Create a Graphics object for the Control. Graphics* g = this->CreateGraphics() ;
0
1007
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 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,...
17
1477
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
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10413
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10145
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7530
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.