G'day everyone,
I'm fairly new to Windows Forms applications in C# so I apologise for what will undoubtably be a trivial question, however I two questions I was hoping someone may be able to help me with
(1) Consider a Window's Application, with a main Form that contains a picture box and another form used as a pseudo OpenFileDialog box with a simple text box and command button, if I add the pseudo OpenFileDialog form as an attribute to the Main form, how am I able to set things up so that when the button is clicked the information is sent to the main form ??
I.e. the user clicks File --> New ( then the pseudo OpenFileDialog is initiated) the user enters the path and clicks the button, which I then want sent back to the Main form to open a picture in the Picture Box in the Main Form
(2) Is it better to do this sort of thing as an MDI and if so how??
Any help would be greatly appreciated,
David
Loading
Bechir BejaouiPosted Dec 8, 2008, 6:39 AM
create a class with static fields
public class Dimensions
{
static public Size oSize;
}
in the child form do as follow
int x = convert.ToInt32(text1.text);
int y = convert.ToInt32(text2.text);
Dimensions.oSize = new Size(x,y);
in the MDI form
pictureBox.Size = Dimensions.oSize;
with this manner you can intercommunicate between forms
Bechir BejaouiPosted Dec 8, 2008, 8:57 AM
David GaleaPosted Dec 8, 2008, 7:48 AM
Thank you very much for your help, that makes perfect sense now!
Once again, thanks for your assistance and guidance!
Regards,
David
ps - I am in the process of developing reusable Maths libraries for various applications and uses - do you know if there is a specific area on this site to survey any possible requests?
David GaleaPosted Dec 7, 2008, 8:57 PM
hey mate,
no, sorry I must have worded it incorrect, basically I have a windows form
(which is a child form) that has two text buttons and one command button, the user enters in values into both text boxes and then once the user clicks the command button, I want to know those values to resize a picture box which is on its parent form (I used a pseudo OpenFileDialog as an example of the sort of thing I'm trying to do)
Sorry for the confusion,
Thanks for your help,
David
Bechir BejaouiPosted Dec 7, 2008, 4:22 PM