-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGLScrolledControl.cs
More file actions
34 lines (29 loc) · 1003 Bytes
/
GLScrolledControl.cs
File metadata and controls
34 lines (29 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.Drawing;
using System.Linq;
namespace GLGUI
{
internal class GLScrolledControl : GLControl
{
public Size TotalSize;
public GLScrolledControl(GLGui gui) : base(gui)
{
AutoSize = true;
HandleMouseEvents = false;
}
protected override void UpdateLayout()
{
outer.Width = Math.Min(Math.Max(outer.Width, sizeMin.Width), sizeMax.Width);
outer.Height = Math.Min(Math.Max(outer.Height, sizeMin.Height), sizeMax.Height);
Inner = new Rectangle(0, 0, outer.Width, outer.Height);
TotalSize = new Size(0, 0);
if (Controls.Any())
{
TotalSize.Width = Controls.Max(c => c.Outer.Right);
TotalSize.Height = Controls.Max(c => c.Outer.Bottom);
}
if (Parent != null && !Parent.AutoSize) // avoid repeated calls if autosize is true
Parent.Invalidate();
}
}
}