WarcraftPlayer
MIS
How do i pass a parameter to a custom control?
I have a custom viewer control when the viewer loads I want it to display whatever image is passed to it. Right now I have it working where when the control is loaded a default image is displayed.
This is a code block from my control
And this is from the form that has the name of the image I want to pass to my control. It is hardcoded because I am still learning how to do it but eventually it will be dynamic.
Ive tried both these ways
Right now it works. So my guess is I am not understanding how to use my public GetFile to set the image or the placement of it.
/cry
/help
LVL 60 ROGUE
I have a custom viewer control when the viewer loads I want it to display whatever image is passed to it. Right now I have it working where when the control is loaded a default image is displayed.
This is a code block from my control
Code:
GetFile();
SetImage();
InitializeComponent();
...
private void GetFile()
{
FileName = "Y:\\KalimdorLoading.jpg";
}
public void GetFile(string ExternalFileName)
{
FileName = ExternalFileName;
}
And this is from the form that has the name of the image I want to pass to my control. It is hardcoded because I am still learning how to do it but eventually it will be dynamic.
Ive tried both these ways
Code:
public Form1()
{
InitializeComponent();
ViewerControl ImageFileName = new ViewerControl();
ImageFileName.GetFile("Y:\\SCAN_21040_03-18-2005_SCS56371993.tif");
}
Code:
public Form1()
{
ViewerControl ImageFileName = new ViewerControl(); ImageFileName.GetFile("Y:\\SCAN_21040_03-18-2005_SCS56371993.tif");
InitializeComponent();
}
Right now it works. So my guess is I am not understanding how to use my public GetFile to set the image or the placement of it.
/cry
/help
LVL 60 ROGUE