Calling a method on another form in C#

前端 未结 3 1960
清歌不尽
清歌不尽 2021-01-23 14:15

I am building a basic Image editor. In my app, if the user wants to resize the image a new form pops up and asks the user to input an new width and height for the image.

<
3条回答
  •  一生所求
    2021-01-23 15:01

    Add properties to your resize form that your main form can interrogate after the resize form is closed, like ...

    DialogResult dr = resizeForm.ShowDialog();
    
    if( dr != DialogResult.Cancel )
    {
      var newH = resizeForm.Height;
      var newW = resizeForm.Width;
    
      // do something with new vals.
    }
    

提交回复
热议问题