473,488 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Is there an event for image change for a PictureBox Control? please help.

Hi! Can u please tech me a way to know if the image in the picturebox has
changed? what event should i catch the chage?
Nov 21 '05 #1
21 8842
There is no event for this.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Jose Michael Meo R. Barrido" <mi**@rdmsinc.net> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl...
Hi! Can u please tech me a way to know if the image in the picturebox has
changed? what event should i catch the chage?

Nov 21 '05 #2
There is no event for this.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Jose Michael Meo R. Barrido" <mi**@rdmsinc.net> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl...
Hi! Can u please tech me a way to know if the image in the picturebox has
changed? what event should i catch the chage?

Nov 21 '05 #3
Jose,
Hi! Can u please tech me a way to know if the image in the picturebox has
changed? what event should i catch the chage?


By what (how) is the change done?

Cor
Nov 21 '05 #4
Jose,
Hi! Can u please tech me a way to know if the image in the picturebox has
changed? what event should i catch the chage?


By what (how) is the change done?

Cor
Nov 21 '05 #5
"Jose Michael Meo R. Barrido" <mi**@rdmsinc.net> schrieb:
Hi! Can u please tech me a way to know if the image in the picturebox has
changed? what event should i catch the chage?


As the developer you should know yourself when you change the image ;-). In
other words: No, there is no such event.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6
"Jose Michael Meo R. Barrido" <mi**@rdmsinc.net> schrieb:
Hi! Can u please tech me a way to know if the image in the picturebox has
changed? what event should i catch the chage?


As the developer you should know yourself when you change the image ;-). In
other words: No, there is no such event.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7
Hefried,
As the developer you should know yourself when you change the image ;-).
In other words: No, there is no such event.


Again, please do not answer questions which I ask to an OP, wherefore
probably (not always for sure) the answer is obvious.

Cor
Nov 21 '05 #8
Hefried,
As the developer you should know yourself when you change the image ;-).
In other words: No, there is no such event.


Again, please do not answer questions which I ask to an OP, wherefore
probably (not always for sure) the answer is obvious.

Cor
Nov 21 '05 #9
"Cor Ligthert" <no************@planet.nl> schrieb:
As the developer you should know yourself when you change the image ;-).
In other words: No, there is no such event.


Again, please do not answer questions which I ask to an OP, wherefore
probably (not always for sure) the answer is obvious.


Huh?!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #10
"Cor Ligthert" <no************@planet.nl> schrieb:
As the developer you should know yourself when you change the image ;-).
In other words: No, there is no such event.


Again, please do not answer questions which I ask to an OP, wherefore
probably (not always for sure) the answer is obvious.


Huh?!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #11
me 2 ;-)

Herfried K. Wagner [MVP] wrote:
"Cor Ligthert" <no************@planet.nl> schrieb:
As the developer you should know yourself when you change the image
;-). In other words: No, there is no such event.

Again, please do not answer questions which I ask to an OP, wherefore
probably (not always for sure) the answer is obvious.

Huh?!


Nov 21 '05 #12
> me 2 ;-)

Has to do with politness, I am sorry that you did not understand it.

When the OP ask something what is for you strange because the answer is
obvious, than you can give an answer, however you can as well do what I did
and ask what he means with his question, although you know almost for sure
your answer.

When than somebody else give in a (in my opinion kind of rude way) that
answer I am not happy.
In that way the OP will probably never ask a question here again.

I can than write nothing or ask to do it not again the next time.

Clear?

Cor
Nov 21 '05 #13
"Cor Ligthert" <no************@planet.nl> schrieb:
When than somebody else give in a (in my opinion kind of rude way) that
answer I am not happy.


My reply was /not/ rude. Period.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #14
Herfried,
My reply was /not/ rude. Period


I know it is not meant as that by you, however could be read like that.

The same way as you write that "Period".

Cor
Nov 21 '05 #15
I would like to help. Indeed the PictureBox control has no event associated
with the change of an image. But I can see no problem in creating your own
picturebox control, inheriting from the system PictureBox. In your control
you may add your own event capturing an image change. This is only a
suggestion, I have no code,
I'll try it myself.
"Cor Ligthert" wrote:
me 2 ;-)

Has to do with politness, I am sorry that you did not understand it.

When the OP ask something what is for you strange because the answer is
obvious, than you can give an answer, however you can as well do what I did
and ask what he means with his question, although you know almost for sure
your answer.

When than somebody else give in a (in my opinion kind of rude way) that
answer I am not happy.
In that way the OP will probably never ask a question here again.

I can than write nothing or ask to do it not again the next time.

Clear?

Cor

Nov 21 '05 #16
Hi,
Here is a Picture box control with two extra events , before image changed
and after image changed...

Imports System
Imports System.Windows.Forms
Imports System.Drawing.Drawing2D
Imports System.Drawing
<ToolboxBitmap(GetType(PictureBox))> _
Public Class adxPictureControl
Inherits PictureBox
Private _image As System.Drawing.Image
Event ImageBeforeChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)
Event ImageAfterChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)

Public Shadows Property Image() As Image
Get
Return _image
End Get
Set(ByVal Value As Image)

If Not Value Is _image Then
If Me.DesignMode Then
MyBase.Image = Value
_image = Value
Else
Dim ea As New EventArgsImageChanged
If Not _image Is Nothing Then
RaiseEvent ImageBeforeChanged(Me, ea)
If ea.Cancel = True Then
Exit Property
End If
End If
MyBase.Image = Value
_image = Value
RaiseEvent ImageAfterChanged(Me, ea)
End If
End If
End Set
End Property

End Class
Public Class EventArgsImageChanged
Inherits EventArgs
Private _cancel As Boolean = False
Public Property Cancel() As Boolean
Get
Return _cancel
End Get
Set(ByVal Value As Boolean)
_cancel = Value
End Set
End Property
End Class
"Cor Ligthert" wrote:
me 2 ;-)

Has to do with politness, I am sorry that you did not understand it.

When the OP ask something what is for you strange because the answer is
obvious, than you can give an answer, however you can as well do what I did
and ask what he means with his question, although you know almost for sure
your answer.

When than somebody else give in a (in my opinion kind of rude way) that
answer I am not happy.
In that way the OP will probably never ask a question here again.

I can than write nothing or ask to do it not again the next time.

Clear?

Cor

Nov 21 '05 #17
hi, try this one:

Imports System
Imports System.Windows.Forms
Imports System.Drawing.Drawing2D
Imports System.Drawing
<ToolboxBitmap(GetType(PictureBox))> _
Public Class adxPictureControl
Inherits PictureBox
Private _image As System.Drawing.Image
Event ImageBeforeChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)
Event ImageAfterChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)

Public Shadows Property Image() As Image
Get
Return _image
End Get
Set(ByVal Value As Image)

If Not Value Is _image Then
If Me.DesignMode Then
MyBase.Image = Value
_image = Value
Else
Dim ea As New EventArgsImageChanged
If Not _image Is Nothing Then
RaiseEvent ImageBeforeChanged(Me, ea)
If ea.Cancel = True Then
Exit Property
End If
End If
MyBase.Image = Value
_image = Value
RaiseEvent ImageAfterChanged(Me, ea)
End If
End If
End Set
End Property

End Class
Public Class EventArgsImageChanged
Inherits EventArgs
Private _cancel As Boolean = False
Public Property Cancel() As Boolean
Get
Return _cancel
End Get
Set(ByVal Value As Boolean)
_cancel = Value
End Set
End Property
End Class
"Cor Ligthert" wrote:
me 2 ;-)

Has to do with politness, I am sorry that you did not understand it.

When the OP ask something what is for you strange because the answer is
obvious, than you can give an answer, however you can as well do what I did
and ask what he means with his question, although you know almost for sure
your answer.

When than somebody else give in a (in my opinion kind of rude way) that
answer I am not happy.
In that way the OP will probably never ask a question here again.

I can than write nothing or ask to do it not again the next time.

Clear?

Cor

Nov 21 '05 #18
Here is a control you can use:
Imports System
Imports System.Windows.Forms
Imports System.Drawing.Drawing2D
Imports System.Drawing
<ToolboxBitmap(GetType(PictureBox))> _
Public Class adxPictureControl
Inherits PictureBox
Private _image As System.Drawing.Image
Event ImageBeforeChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)
Event ImageAfterChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)
'Avi D. New York, NY 2004
Public Shadows Property Image() As Image
Get
Return _image
End Get
Set(ByVal Value As Image)

If Not Value Is _image Then
If Me.DesignMode Then
MyBase.Image = Value
_image = Value
Else
Dim ea As New EventArgsImageChanged
If Not _image Is Nothing Then
RaiseEvent ImageBeforeChanged(Me, ea)
If ea.Cancel = True Then
Exit Property
End If
End If
MyBase.Image = Value
_image = Value
RaiseEvent ImageAfterChanged(Me, ea)
End If
End If
End Set
End Property

End Class
Public Class EventArgsImageChanged
Inherits EventArgs
Private _cancel As Boolean = False
Public Property Cancel() As Boolean
Get
Return _cancel
End Get
Set(ByVal Value As Boolean)
_cancel = Value
End Set
End Property
End Class

"Cor Ligthert" wrote:
me 2 ;-)

Has to do with politness, I am sorry that you did not understand it.

When the OP ask something what is for you strange because the answer is
obvious, than you can give an answer, however you can as well do what I did
and ask what he means with his question, although you know almost for sure
your answer.

When than somebody else give in a (in my opinion kind of rude way) that
answer I am not happy.
In that way the OP will probably never ask a question here again.

I can than write nothing or ask to do it not again the next time.

Clear?

Cor

Nov 21 '05 #19
AviD,
Event ImageBeforeChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)
Event ImageAfterChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)
Rather then ImageBeforeChanged & ImageAfterChanged you might consider naming
the events ImageChanging & ImageChanged which is the normal convention for
..NET.

http://msdn.microsoft.com/library/de...Guidelines.asp

http://msdn.microsoft.com/library/de...Guidelines.asp
Public Class EventArgsImageChanged
Inherits EventArgs
Private _cancel As Boolean = False Rather then define a class with a Cancel Property you can simply use
System.ComponentModel.CancelEventArgs or inherit from it.

http://msdn.microsoft.com/library/de...classtopic.asp
Public Class adxPictureControl
Inherits PictureBox
Public Event ImageChanging As System.ComponentModel.CancelEventHandler
Public Event ImageChanged As System.Event Handler

...
End Class

Hope this helps
Jay

"AviD" <av*@newsgroup.nospam> wrote in message
news:A1**********************************@microsof t.com... hi, try this one:

Imports System
Imports System.Windows.Forms
Imports System.Drawing.Drawing2D
Imports System.Drawing
<ToolboxBitmap(GetType(PictureBox))> _
Public Class adxPictureControl
Inherits PictureBox
Private _image As System.Drawing.Image
Event ImageBeforeChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)
Event ImageAfterChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)

Public Shadows Property Image() As Image
Get
Return _image
End Get
Set(ByVal Value As Image)

If Not Value Is _image Then
If Me.DesignMode Then
MyBase.Image = Value
_image = Value
Else
Dim ea As New EventArgsImageChanged
If Not _image Is Nothing Then
RaiseEvent ImageBeforeChanged(Me, ea)
If ea.Cancel = True Then
Exit Property
End If
End If
MyBase.Image = Value
_image = Value
RaiseEvent ImageAfterChanged(Me, ea)
End If
End If
End Set
End Property

End Class
Public Class EventArgsImageChanged
Inherits EventArgs
Private _cancel As Boolean = False
Public Property Cancel() As Boolean
Get
Return _cancel
End Get
Set(ByVal Value As Boolean)
_cancel = Value
End Set
End Property
End Class
"Cor Ligthert" wrote:
> me 2 ;-)
>

Has to do with politness, I am sorry that you did not understand it.

When the OP ask something what is for you strange because the answer is
obvious, than you can give an answer, however you can as well do what I
did
and ask what he means with his question, although you know almost for
sure
your answer.

When than somebody else give in a (in my opinion kind of rude way) that
answer I am not happy.
In that way the OP will probably never ask a question here again.

I can than write nothing or ask to do it not again the next time.

Clear?

Cor

Nov 21 '05 #20
Hi Jay
Advice well taken!
AviD.
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ei**************@tk2msftngp13.phx.gbl...
AviD,
Event ImageBeforeChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)
Event ImageAfterChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)


Rather then ImageBeforeChanged & ImageAfterChanged you might consider
naming the events ImageChanging & ImageChanged which is the normal
convention for .NET.

http://msdn.microsoft.com/library/de...Guidelines.asp

http://msdn.microsoft.com/library/de...Guidelines.asp
Public Class EventArgsImageChanged
Inherits EventArgs
Private _cancel As Boolean = False

Rather then define a class with a Cancel Property you can simply use
System.ComponentModel.CancelEventArgs or inherit from it.

http://msdn.microsoft.com/library/de...classtopic.asp
Public Class adxPictureControl
Inherits PictureBox


Public Event ImageChanging As System.ComponentModel.CancelEventHandler
Public Event ImageChanged As System.Event Handler

...
End Class

Hope this helps
Jay

"AviD" <av*@newsgroup.nospam> wrote in message
news:A1**********************************@microsof t.com...
hi, try this one:

Imports System
Imports System.Windows.Forms
Imports System.Drawing.Drawing2D
Imports System.Drawing
<ToolboxBitmap(GetType(PictureBox))> _
Public Class adxPictureControl
Inherits PictureBox
Private _image As System.Drawing.Image
Event ImageBeforeChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)
Event ImageAfterChanged(ByVal sender As Object, ByVal e As
EventArgsImageChanged)

Public Shadows Property Image() As Image
Get
Return _image
End Get
Set(ByVal Value As Image)

If Not Value Is _image Then
If Me.DesignMode Then
MyBase.Image = Value
_image = Value
Else
Dim ea As New EventArgsImageChanged
If Not _image Is Nothing Then
RaiseEvent ImageBeforeChanged(Me, ea)
If ea.Cancel = True Then
Exit Property
End If
End If
MyBase.Image = Value
_image = Value
RaiseEvent ImageAfterChanged(Me, ea)
End If
End If
End Set
End Property

End Class
Public Class EventArgsImageChanged
Inherits EventArgs
Private _cancel As Boolean = False
Public Property Cancel() As Boolean
Get
Return _cancel
End Get
Set(ByVal Value As Boolean)
_cancel = Value
End Set
End Property
End Class
"Cor Ligthert" wrote:
> me 2 ;-)
>
Has to do with politness, I am sorry that you did not understand it.

When the OP ask something what is for you strange because the answer is
obvious, than you can give an answer, however you can as well do what I
did
and ask what he means with his question, although you know almost for
sure
your answer.

When than somebody else give in a (in my opinion kind of rude way) that
answer I am not happy.
In that way the OP will probably never ask a question here again.

I can than write nothing or ask to do it not again the next time.

Clear?

Cor


Nov 21 '05 #21
The only solution I can think of, is to Inherit from a PictureBox, and
override (or shadow, for that matter) the Image property. I needed to do
that to make a PictureBox that supported "DBNull" values, and it worked
Ok... Then you can call MyBase.Image to set or get the PictureBox's real
values.
Hope this helps.
VBen.

"Jose Michael Meo R. Barrido" <mi**@rdmsinc.net> escribió en el mensaje
news:uq**************@TK2MSFTNGP09.phx.gbl...
Hi! Can u please tech me a way to know if the image in the picturebox has
changed? what event should i catch the chage?

Nov 21 '05 #22

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

Similar topics

15
1776
by: Jose Michael Meo R. Barrido | last post by:
Hi! Can u please tech me a way to know if the image in the picturebox has changed? what event should i catch the chage?
5
4870
by: BrianW | last post by:
I am working on a program that has multiple picturebox controls that a user is allowed to move around which are contained within a panel control for visual placement. In my mousedown event, I set...
38
2983
by: johnb41 | last post by:
I have a Picturebox that has an image displayed inside. Through code, I was able to have the "whole image" display in it without distortion. (Like a "Fit All" in most any image viewer program) ...
4
5379
by: Rich | last post by:
Hello, I create multiple pictureboxe controls on a form in a For Loop and display thumbnail pictures. I need to add a Click event to these pictureboxes. Here is the routine that creates the...
1
2473
by: euroluxantiques | last post by:
Hi All, Using VB.Net with SQL Server. I have a form that I create a number of Picture Boxes on dynamically, based on a stored procedure that retrieves a listing of images available for a...
0
7108
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
6967
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
7352
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...
1
4875
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
3078
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?
0
1383
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 ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
272
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.