The icon width and text offset are subtracted from the dialog max width and the result is then used for the expando button text rect calculation. When it's done, the expando button width should be the text width + icon width + text offset, not just the text width.

Test program: [test_taskdialog.zip](/uploads/0f710d99f9cfe8eb6a52645310cb1f53/test_taskdialog.zip)