Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
QuestionShowing an icon in a gridview (WPF) Pin
Johan Lombaard26-Jul-07 22:51
Johan Lombaard26-Jul-07 22:51 
AnswerRe: Showing an icon in a gridview (WPF) Pin
kubben27-Jul-07 1:42
kubben27-Jul-07 1:42 
Questionconvert to ASCII Pin
Sunshine Always26-Jul-07 22:47
Sunshine Always26-Jul-07 22:47 
AnswerRe: convert to ASCII Pin
Christian Graus26-Jul-07 23:07
protectorChristian Graus26-Jul-07 23:07 
AnswerRe: convert to ASCII Pin
Hari Om Prakash Sharma26-Jul-07 23:09
Hari Om Prakash Sharma26-Jul-07 23:09 
GeneralRe: convert to ASCII Pin
Christian Graus26-Jul-07 23:25
protectorChristian Graus26-Jul-07 23:25 
QuestionEventhandler in C# - How to send parameter Pin
Vikas K.26-Jul-07 22:14
Vikas K.26-Jul-07 22:14 
AnswerRe: Eventhandler in C# - How to send parameter [modified] Pin
Martin#26-Jul-07 22:38
Martin#26-Jul-07 22:38 
Hello,

I think what you want to do is only possible with an Inherited class and the usage of Custom Eventargs.

1) Inherit a class from PictureBox
public class SpecialPictureBox : System.Windows.Forms.PictureBox

2) Add a string property FilePath
private string _filepath = "";
[System.ComponentModel.DefaultValue("")]
public string FilePath
{
    get
    {
	return _filepath;
    }
    set
    {
	_filepath = value;
    }
}

3)Inherit a class from System.EventArgs with a string member
public class SpecialEventArgs : System.EventArgs
{
    public string filepath;
 
    public SpecialEventArgs(string _filepath)
    {
	filepath= _filepath;
    }
}

4)Create a delegate for your special event in your SpecialPictureBox class, which uses the SpecialEventArgs.
public delegate void SpecialEvent(object sender, SpecialEventArgs specialEA);

5)Create an event which uses the delegate
public event SpecialEvent SpecialChanged;

6)override the OnClick event of your PictureBox and fire the event, with the Filepath property.
if(SpecialChanged!=null)
{
    SpecialChanged(this, new SpecialEventArgs(this.FilePath));
}

7)In your Form Handle the SpecialChanged event and set the FilePath property
yourSpecialPictureBox.FilePath = "yourpath";
yourSpecialPictureBox.SpecialChanged+= new YourNamespace.SpecialEvent(yourSpecialPictureBox_SpecialChanged);
 
private void yourSpecialPictureBox_SpecialChanged(object sender, SpecialEventArgs specialEA)
{
    //specialEA.filepath
}


Hope it helps!

-- modified at 5:35 Friday 27th July, 2007


All the best,

Martin

GeneralRe: Eventhandler in C# - How to send parameter Pin
Vikas K.26-Jul-07 23:17
Vikas K.26-Jul-07 23:17 
GeneralRe: Eventhandler in C# - How to send parameter Pin
Martin#26-Jul-07 23:19
Martin#26-Jul-07 23:19 
GeneralRe: Eventhandler in C# - How to send parameter Pin
Mike Dimmick27-Jul-07 2:26
Mike Dimmick27-Jul-07 2:26 
GeneralRe: Eventhandler in C# - How to send parameter Pin
Martin#27-Jul-07 2:46
Martin#27-Jul-07 2:46 
GeneralRe: Eventhandler in C# - How to send parameter Pin
Vikas K.31-Jul-07 1:55
Vikas K.31-Jul-07 1:55 
GeneralRe: Eventhandler in C# - How to send parameter Pin
Martin#31-Jul-07 2:05
Martin#31-Jul-07 2:05 
QuestionHow Can use Matlab Files in Visual Studio C# .Net? Pin
zeeShan anSari26-Jul-07 21:38
zeeShan anSari26-Jul-07 21:38 
AnswerRe: How Can use Matlab Files in Visual Studio C# .Net? Pin
Christian Graus26-Jul-07 21:39
protectorChristian Graus26-Jul-07 21:39 
AnswerRe: How Can use Matlab Files in Visual Studio C# .Net? Pin
Murali Babu26-Jul-07 23:00
professionalMurali Babu26-Jul-07 23:00 
QuestionDirectX in C# Pin
legolass26-Jul-07 21:36
legolass26-Jul-07 21:36 
AnswerRe: DirectX in C# Pin
Christian Graus26-Jul-07 21:40
protectorChristian Graus26-Jul-07 21:40 
QuestionSome Basic Question Related To Image Processing…(C# .Net) Pin
zeeShan anSari26-Jul-07 21:30
zeeShan anSari26-Jul-07 21:30 
AnswerRe: Some Basic Question Related To Image Processing…(C# .Net) Pin
Christian Graus26-Jul-07 21:42
protectorChristian Graus26-Jul-07 21:42 
QuestionHow to convert Struct to array Pin
Morad Kobi26-Jul-07 21:30
Morad Kobi26-Jul-07 21:30 
AnswerRe: How to convert Struct to array Pin
Malcolm Smart26-Jul-07 21:35
Malcolm Smart26-Jul-07 21:35 
AnswerRe: How to convert Struct to array Pin
Christian Graus26-Jul-07 21:38
protectorChristian Graus26-Jul-07 21:38 
QuestionCLR-Trigger coded in c# (Express Edition 2005) Pin
jacklynn_mei26-Jul-07 21:25
jacklynn_mei26-Jul-07 21:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.