Preview:
private DialogResultT<XXX> ShowForm()
{
    XXX model = null;

    var res = new FormEx<XXX>()
        .LoadForm(form =>
        {
            form.btnSave.Click += (s, e) =>
            {
                model = new XXX();
                form.CloseResultYes();
            };

            form.btnClose.Click += (s,e) => form.CloseResultCancel();
        })
        .ShowDialog();

    return new DialogResultT<XXX>(model, res.form.DialogResult);
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter