Skip to content

Commit 8ded595

Browse files
committed
Should fix the scrolling issue. (#164)
1 parent dc72370 commit 8ded595

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ReClass.NET/UI/MemoryViewControl.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,12 @@ protected override void OnPaint(PaintEventArgs e)
135135
MultipleNodesSelected = selectedNodes.Count > 1
136136
};
137137

138+
var scrollPosition = AutoScrollPosition;
139+
138140
var drawnSize = args.Node.Draw(
139141
view,
140-
AutoScrollPosition.X,
141-
AutoScrollPosition.Y
142+
scrollPosition.X,
143+
scrollPosition.Y
142144
);
143145
drawnSize.Width += 10;
144146

@@ -148,6 +150,9 @@ protected override void OnPaint(PaintEventArgs e)
148150
}*/
149151

150152
AutoScrollMinSize = new Size(Math.Max(drawnSize.Width, ClientSize.Width), Math.Max(drawnSize.Height, ClientSize.Height));
153+
154+
// Sometimes setting AutoScrollMinSize resets AutoScrollPosition. This restores the original position.
155+
AutoScrollPosition = new Point(-scrollPosition.X, -scrollPosition.Y);
151156
}
152157

153158
private void OnSelectionChanged()

0 commit comments

Comments
 (0)