473,487 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Redraw/repaint a PictureBox control

Can someone tell me how you go about handling events where your window
might be obscured and then when you bring it to the foreground, you want
your picturebox control to be repainted instead of showing large,
blocked out areas created by overlapping windows.

I have seen numerous references to onpaint etc but I haven't found an
example to follow or at least my own efforts with onpaint haven't been
fruitful as yet.
Nov 20 '05 #1
3 3923
Tyson Ackland wrote:
Can someone tell me how you go about handling events where your window
might be obscured and then when you bring it to the foreground, you want
your picturebox control to be repainted instead of showing large,
blocked out areas created by overlapping windows.

I have seen numerous references to onpaint etc but I haven't found an
example to follow or at least my own efforts with onpaint haven't been
fruitful as yet.


OK I have worked out the repainting is working when resizing the window
and maximise/restoring the window. This is all happening via my Paint
handler for the PictureBox.

What is not working though is restoring from a minimised/iconified
state. The restored window does not show my PictureBox piccy. Does
anyone know what handler I need to use for this event?
Nov 20 '05 #2
Form_OnPaint()
Depending on the complexity of your drawing requirements, most repainting
can be done from the OnPaint event.
____________________________
The Grim Reaper

"Tyson Ackland" <ty*******@hotmail.com> wrote in message
news:u8**************@TK2MSFTNGP12.phx.gbl...
Tyson Ackland wrote:
Can someone tell me how you go about handling events where your window
might be obscured and then when you bring it to the foreground, you want
your picturebox control to be repainted instead of showing large,
blocked out areas created by overlapping windows.

I have seen numerous references to onpaint etc but I haven't found an
example to follow or at least my own efforts with onpaint haven't been
fruitful as yet.


OK I have worked out the repainting is working when resizing the window
and maximise/restoring the window. This is all happening via my Paint
handler for the PictureBox.

What is not working though is restoring from a minimised/iconified
state. The restored window does not show my PictureBox piccy. Does
anyone know what handler I need to use for this event?

Nov 20 '05 #3
Tyson Ackland wrote:
Tyson Ackland wrote:
Can someone tell me how you go about handling events where your window
might be obscured and then when you bring it to the foreground, you
want your picturebox control to be repainted instead of showing large,
blocked out areas created by overlapping windows.

I have seen numerous references to onpaint etc but I haven't found an
example to follow or at least my own efforts with onpaint haven't been
fruitful as yet.

OK I have worked out the repainting is working when resizing the window
and maximise/restoring the window. This is all happening via my Paint
handler for the PictureBox.

What is not working though is restoring from a minimised/iconified
state. The restored window does not show my PictureBox piccy. Does
anyone know what handler I need to use for this event?


Oops, I have fixed it now, looks like I had to use the argument in the
Pain event header rather than directly referencing my image variable.
Nov 20 '05 #4

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

Similar topics

0
1280
by: PHH | last post by:
Help me, please, When I redraw a ListviewItem in Listview (redraw items with icon and text columms). I used SetStyle(ControlStyle.UserPaint, true) function. And I redraw finish and run...
0
1887
by: WHITETIGER | last post by:
Help me, please, When I redraw a ListviewItem in Listview (redraw items with icon and text columms). I used SetStyle(ControlStyle.UserPaint, true) function. And I redraw finish and run...
2
2178
by: Jose Michael Meo R. Barrido | last post by:
I made a custom runded rectangle usercontrol. I used a function i found on the internet. the function works fine(see "GetRoundRect" below). I use the fullowing code to make my usercontrol...
2
11467
by: user | last post by:
Hello i have PictureBox p1: p1.Paint += new PaintEventHandler(MyFunction); .... public void MyFunction(Object Sender, PaintEventArgs e) and it works fine but: when i call: p1.Refresh(); ...
4
1341
by: John Baker | last post by:
I am using a Graphics object to draw on a form. If I pop up a message box, or if say the user minimizes and then restores the form, my graphics are erased (just where the box was in the former...
2
13047
by: diogoko | last post by:
I have some code like: try { someButton.disabled = true; cpuIntensiveCode(); } finally { someButton.disabled = false; } The problem is that someButton is never disabled, because the browser
3
2338
by: b747_440 | last post by:
Hello Newsgroup, I try to resize and move a picturebox. However, after each operation the picture box is being redrawn. This causes flickering. Is it possible to suppress the first redraw and draw...
0
2256
by: philaphan80 | last post by:
Is there a way to force the Visual Studio IDE (Page Control at design- time) to refresh / repaint itself upon drag & drop of *any* item from the toolbox? Perhaps a method I need to override within...
6
3274
by: Martin Slater | last post by:
Hi all, I'm using a webbrowser control within an application for the UI and want to hide the flicker and redraw when changing pages. Ideally I want to render the new page to a seperate...
0
7106
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
7137
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
7181
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...
1
6846
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
7349
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
3076
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
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.