Calling a method on another form in C#

前端 未结 3 1964
清歌不尽
清歌不尽 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:00

    I assume there are a number of ways to do this. I'd probably use public properties on the resizeForm and then get those when the resizeForm.ShowDialog() returns.

    if (resizeForm.ShowDialog() == DialogResult.OK) // or whatever
    {
       myVal = resizeForm.Val;
       ...
    }
    

    or something like that.

提交回复
热议问题