Skip to content

Commit

Permalink
Fixed an exception crash in KryptonTreeView
Browse files Browse the repository at this point in the history
  • Loading branch information
Cocotteseb committed Nov 1, 2015
1 parent 7adde64 commit 8d529d7
Showing 1 changed file with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1984,27 +1984,30 @@ protected override Size DefaultSize
#region Implementation
private void UpdateItemHeight()
{
UpdateContentFromNode(null);

// Ask the view element to layout in given space, needs this before a render call
using (ViewLayoutContext context = new ViewLayoutContext(this, Renderer))
if (!IsDisposed && !Disposing)
{
// For calculating the item height we always assume normal state
_drawButton.ElementState = PaletteState.Normal;
UpdateContentFromNode(null);

// Find required size to show a node (only interested in the height)
Size size = _drawButton.GetPreferredSize(context);
size.Height = size.Height + 1;
// Ask the view element to layout in given space, needs this before a render call
using (ViewLayoutContext context = new ViewLayoutContext(this, Renderer))
{
// For calculating the item height we always assume normal state
_drawButton.ElementState = PaletteState.Normal;

// If we have images defined then adjust to reflect image height
if (ImageList != null)
size.Height = Math.Max(size.Height, ImageList.ImageSize.Height);
// Find required size to show a node (only interested in the height)
Size size = _drawButton.GetPreferredSize(context);
size.Height = size.Height + 1;

// Update the item height to match height of a single node
if (size.Height != ItemHeight)
{
if (_itemHeightDefault)
_treeView.ItemHeight = size.Height;
// If we have images defined then adjust to reflect image height
if (ImageList != null)
size.Height = Math.Max(size.Height, ImageList.ImageSize.Height);

// Update the item height to match height of a single node
if (size.Height != ItemHeight)
{
if (_itemHeightDefault)
_treeView.ItemHeight = size.Height;
}
}
}
}
Expand Down

0 comments on commit 8d529d7

Please sign in to comment.