Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
halgab committed Nov 13, 2023
1 parent 3d4b770 commit 5aee892
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class TableLayoutPanelBehavior : Behavior
private TableLayoutPanel table;
private StyleHelper rightStyle;
private StyleHelper leftStyle;
private List<TableLayoutStyle> _styles; //List of the styles
private List<TableLayoutStyle> _styles;
private bool currentColumnStyles; // is Styles for Columns or Rows
private static readonly TraceSwitch tlpResizeSwitch = new("TLPRESIZE", "Behavior service drag & drop messages");

Expand Down Expand Up @@ -190,20 +190,16 @@ private bool ColumnResize

private bool CanResizeStyle(int[] widths)
{
bool canStealFromRight = false;
bool canStealFromLeft = false;
int moveIndex = ((IList)_styles).IndexOf(tableGlyph.Style);
if (moveIndex > -1 && moveIndex != _styles.Count)
int moveIndex = _styles.IndexOf(tableGlyph.Style);
if (moveIndex <= -1 || moveIndex == _styles.Count)
{
canStealFromRight = IndexOfNextStealableStyle(true, moveIndex, widths) != -1;
canStealFromLeft = IndexOfNextStealableStyle(false, moveIndex, widths) != -1;
}
else
{
Debug.Fail("Can't find style " + moveIndex);
Debug.Fail($"Can't find style {moveIndex}");
return false;
}

bool canStealFromRight = IndexOfNextStealableStyle(true, moveIndex, widths) != -1;
bool canStealFromLeft = IndexOfNextStealableStyle(false, moveIndex, widths) != -1;

return canStealFromRight && canStealFromLeft;
}

Expand Down

0 comments on commit 5aee892

Please sign in to comment.