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? 15 1771
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?
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
"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/>
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
"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/>
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?!
> 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
"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/>
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
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
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
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
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
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
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?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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?
|
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)
...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |