add resize
This commit is contained in:
@@ -304,6 +304,38 @@ namespace Main
|
||||
}
|
||||
}
|
||||
|
||||
private void ClickResizeSelected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fig = GetSelectedFigureOrThrow();
|
||||
|
||||
if (!TryReadInt(ResizeW.Text, "W", 1, CanvasW, out int newW)) return;
|
||||
if (!TryReadInt(ResizeH.Text, "H", 1, CanvasH, out int newH)) return;
|
||||
|
||||
if (fig is SquareFigure || fig is CircleFigure)
|
||||
{
|
||||
if (newW != newH)
|
||||
{
|
||||
MessageBox.Show("Для квадрата/круга W должен быть равен H.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fig.ResizeToChecked(newW, newH))
|
||||
{
|
||||
MessageBox.Show("Фигура не помещается в область рисования.");
|
||||
return;
|
||||
}
|
||||
|
||||
Redraw();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Reference in New Issue
Block a user