c# - Vertical space in command links in TaskDialog since v1.1 -
i have noticed large, vertical space in task dialog (the space between command links' titles , instruction texts) looks bad. started appear right after upgraded windowsapicodepack version 1.1.
here's code:
taskdialog td = new taskdialog(); var b1 = new taskdialogcommandlink("b1", "foo", "bar"); var b2 = new taskdialogcommandlink("b2", "one", "two"); td.controls.add(b1); td.controls.add(b2); td.caption = "caption"; td.instructiontext = "instructiontext"; td.text = "text"; td.show();
here's result:
before, "bar" appear right below "foo", looks if there's empty line between two. problem on end (and know might be) or guys experiencing this?
i've gotten same bug in 1.1 release. seems due taskdialogcommandlink
class's tostring
method string.format
environment.newline
, doesn't map cleanly when passed taskdialog itself.
public override string tostring() { return string.format(cultureinfo.currentculture, "{0}{1}{2}", text ?? string.empty, (!string.isnullorempty(text) && !string.isnullorempty(instruction)) ? environment.newline : string.empty, instruction ?? string.empty); }
i use implementation subclass anyway make arguments easier, , over-rode method pass string containing simple '\n', although don't need internationalize application , can things little more simply.
public override string tostring() { string str; bool nolabel = string.isnullorempty(this.text); bool noinstruction = string.isnullorempty(this.instruction); if (nolabel & noinstruction) { str = string.empty; } else if (!nolabel & noinstruction) { str = this.text; } else if (nolabel & !noinstruction) { str = base.instruction; } else { str = this.text + "\n" + this.instruction; } return str; }
Comments
Post a Comment