我有一个对话框,为用户提供 3 个选项,是、否、取消 ..
我将是、否更改为新标题武器 1 和武器 2。我还更改按钮的宽度以匹配新标题的宽度. 但是如果新的标题太长,按钮就会重叠。我该如何解决这个问题?
Weapon1 := FMyPlayers.player[FGamePlay.chartoattackwith].Values['Attack1'];
Range1 := FMyPlayers.player[FGamePlay.chartoattackwith].Values['Range1'];
Weapon2 := FMyPlayers.player[FGamePlay.chartoattackwith].Values['Attack2'];
Range2 := FMyPlayers.player[FGamePlay.chartoattackwith].Values['Range2'];
with CreateMessageDialog('Please pick a weapon:', mtConfirmation, mbYesNoCancel) do
try
TButton(findcomponent('Yes')).Width := self.Canvas.TextWidth(' '+Weapon1+':'+range1+' ');
TButton(findcomponent('No')).Width := self.Canvas.TextWidth(' '+Weapon2+':'+range2+' ');
TButton(FindComponent('Yes')).Caption := Weapon1+':'+range1;
TButton(FindComponent('No')).Caption := Weapon2+':'+range2;
case ShowModal of
mrYes: AttackValue := '1';
mrNo: AttackValue := '2';
mrCancel: exit;
end;
finally
Free;
end;