GetBuffer().Defragment();
GetBuffer().UpdateRanges(); // If items were deleted, ranges need recalculation
GetBuffer().Layout(dc, availableSpace, flags);
GetBuffer().SetDirty(false);
GetBuffer().Defragment();
GetBuffer().UpdateRanges(); // If items were deleted, ranges need recalculation
GetBuffer().Layout(dc, availableSpace, flags);
GetBuffer().SetDirty(false);