473,466 Members | 1,381 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Form looses graphics after loosing focus

Hello.
I am using vb.net.

On a form i have a picture box and i draw points, lines, arcs etc in it.

When i minimize the form and then maximize it again or if the form looses
the focus for any reason
all graphics are gone and i have to redraw them.

Is there a way to make my application to display the graphics all the time?

Thank you
Vasilis
Nov 21 '05 #1
2 1679
Hi,

I would either draw on the picturebox in its paint event or draw on
a bitmap and set the pictureboxes image to the bitmap.

Dim bm As New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim g As Graphics = Graphics.FromImage(bm)

' clear the image with controls background color
g.Clear(SystemColors.Control)

g.DrawLine(Pens.Red, 5, 5, 25, 25)
g.FillEllipse(Brushes.Blue, 30, 10, 10, 10)

PictureBox1.Image = bm
g.Dispose()
Ken
-----------------------
"Vasilis X" <so*****@somewhere.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hello.
I am using vb.net.

On a form i have a picture box and i draw points, lines, arcs etc in it.

When i minimize the form and then maximize it again or if the form looses
the focus for any reason
all graphics are gone and i have to redraw them.

Is there a way to make my application to display the graphics all the
time?

Thank you
Vasilis

Nov 21 '05 #2
The simple answer is that a PictureBox is designed to show and image.
It is not meant to be a canvas on which to draw things. Check out this
article which should give you some ideas:

http://www.bobpowell.net/picturebox.htm

Much of the code is in C# but I think there is some VB there too. You
should be able to figure out what is going on though.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MarsVoyager | last post by:
Hi, I want to change the value of a submit button when the onChange event is fired by a Radio Input. Problem is, it seems the value is modified in the gui only when the Radio Input looses focus,...
13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
1
by: Franz Gsell | last post by:
Hi together, I have got a "sliding" form which becomes active when a user clicks on a button in another form. In my function which starts the "sliding" mechanism is a call to this.Show() to make...
6
by: sandy_pt_in | last post by:
Hi, I have modal form which I am showing with some fading effect... (it is like balloon that comes when you receive a mail in the outlook.) But when I show this form, Owner form looses focus. I...
0
by: =?Utf-8?B?TWljaGFlbA==?= | last post by:
Hi Everyone, I have an issue thats bugging me some. I have a search form that I created to search for clients in the database from the Client form. User selects the client from a list and the...
0
by: ARC | last post by:
I posted this before, but no response. Hopefully the MVP folks will know the answer. I'm not sure how other's are using the new split form, but what I like about it is I can design the header...
19
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But...
1
by: sconard | last post by:
When you create a form based on a table via access 2007 wizard, form will update when moving from field that has changed to another field within form. Each loss of focus in "changed" fields causes...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.