mirror of
https://github.com/fadden/6502bench.git
synced 2024-10-08 00:55:57 +00:00
Fix crash when window panel sizes are off
The code could attempt to set a negative height for the windows in the side panels. (issue #108)
This commit is contained in:
parent
f4bee76023
commit
fc5f36885a
@ -486,21 +486,25 @@ namespace SourceGen.WpfGui {
|
||||
// Thanks: https://stackoverflow.com/q/35000893/294248
|
||||
double totalHeight = leftPanel.RowDefinitions[0].ActualHeight +
|
||||
leftPanel.RowDefinitions[2].ActualHeight;
|
||||
if (totalHeight > value) {
|
||||
leftPanel.RowDefinitions[0].Height = new GridLength(value, GridUnitType.Star);
|
||||
leftPanel.RowDefinitions[2].Height = new GridLength(totalHeight - value,
|
||||
GridUnitType.Star);
|
||||
}
|
||||
}
|
||||
}
|
||||
public double SymbolsPanelHeight {
|
||||
get { return rightPanel.RowDefinitions[0].ActualHeight; }
|
||||
set {
|
||||
double totalHeight = rightPanel.RowDefinitions[0].ActualHeight +
|
||||
rightPanel.RowDefinitions[2].ActualHeight;
|
||||
if (totalHeight > value) {
|
||||
rightPanel.RowDefinitions[0].Height = new GridLength(value, GridUnitType.Star);
|
||||
rightPanel.RowDefinitions[2].Height = new GridLength(totalHeight - value,
|
||||
GridUnitType.Star);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateLongCommentWidth() {
|
||||
GridView gv = (GridView)(codeListView.View);
|
||||
|
Loading…
Reference in New Issue
Block a user