473,809 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ 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
21 8891
"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(Picture Box))> _
Public Class adxPictureContr ol
Inherits PictureBox
Private _image As System.Drawing. Image
Event ImageBeforeChan ged(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)
Event ImageAfterChang ed(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)

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 EventArgsImageC hanged
If Not _image Is Nothing Then
RaiseEvent ImageBeforeChan ged(Me, ea)
If ea.Cancel = True Then
Exit Property
End If
End If
MyBase.Image = Value
_image = Value
RaiseEvent ImageAfterChang ed(Me, ea)
End If
End If
End Set
End Property

End Class
Public Class EventArgsImageC hanged
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(Picture Box))> _
Public Class adxPictureContr ol
Inherits PictureBox
Private _image As System.Drawing. Image
Event ImageBeforeChan ged(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)
Event ImageAfterChang ed(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)

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 EventArgsImageC hanged
If Not _image Is Nothing Then
RaiseEvent ImageBeforeChan ged(Me, ea)
If ea.Cancel = True Then
Exit Property
End If
End If
MyBase.Image = Value
_image = Value
RaiseEvent ImageAfterChang ed(Me, ea)
End If
End If
End Set
End Property

End Class
Public Class EventArgsImageC hanged
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(Picture Box))> _
Public Class adxPictureContr ol
Inherits PictureBox
Private _image As System.Drawing. Image
Event ImageBeforeChan ged(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)
Event ImageAfterChang ed(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)
'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 EventArgsImageC hanged
If Not _image Is Nothing Then
RaiseEvent ImageBeforeChan ged(Me, ea)
If ea.Cancel = True Then
Exit Property
End If
End If
MyBase.Image = Value
_image = Value
RaiseEvent ImageAfterChang ed(Me, ea)
End If
End If
End Set
End Property

End Class
Public Class EventArgsImageC hanged
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 ImageBeforeChan ged(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)
Event ImageAfterChang ed(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)
Rather then ImageBeforeChan ged & ImageAfterChang ed 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 EventArgsImageC hanged
Inherits EventArgs
Private _cancel As Boolean = False Rather then define a class with a Cancel Property you can simply use
System.Componen tModel.CancelEv entArgs or inherit from it.

http://msdn.microsoft.com/library/de...classtopic.asp
Public Class adxPictureContr ol
Inherits PictureBox
Public Event ImageChanging As System.Componen tModel.CancelEv entHandler
Public Event ImageChanged As System.Event Handler

...
End Class

Hope this helps
Jay

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

Imports System
Imports System.Windows. Forms
Imports System.Drawing. Drawing2D
Imports System.Drawing
<ToolboxBitmap( GetType(Picture Box))> _
Public Class adxPictureContr ol
Inherits PictureBox
Private _image As System.Drawing. Image
Event ImageBeforeChan ged(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)
Event ImageAfterChang ed(ByVal sender As Object, ByVal e As
EventArgsImageC hanged)

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 EventArgsImageC hanged
If Not _image Is Nothing Then
RaiseEvent ImageBeforeChan ged(Me, ea)
If ea.Cancel = True Then
Exit Property
End If
End If
MyBase.Image = Value
_image = Value
RaiseEvent ImageAfterChang ed(Me, ea)
End If
End If
End Set
End Property

End Class
Public Class EventArgsImageC hanged
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

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

Similar topics

15
1826
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
4911
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 the picturebox control's borderstyle to Fixed3D, but upon doing so, I am not able to track the picturebox control through mousemove events (if you move the mouse off of the control too quickly, the control no longer receives mouse events). If I...
38
3035
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) Now, when the Picturebox gets resized by the user, I want the image to recalculate and display as "Fit All" again. So I have code in my SizeChanged event of the picturebox. When the "size changed", it does it's calculation, and displays properly.
4
5393
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 pictureboxes: ---------------------------------------------------------------------------- Dim MynewPos As New Point(50, 40) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
1
2495
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 particular product and populates the picture boxes using the paths found by the stored procedure. Anyway, that part works great. I have the Picture Boxes set a 231 px wide by 231 px high, and I want to resize these in a separate box when a user hovers...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10378
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
10115
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
7653
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
5550
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
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
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
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3013
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.