-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStatusBarChild.cs
More file actions
62 lines (56 loc) · 1.88 KB
/
StatusBarChild.cs
File metadata and controls
62 lines (56 loc) · 1.88 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Decompiled with JetBrains decompiler
// Type: SC4Tool.StatusBarChild
// Assembly: SC4Tool, Version=2.2.7.0, Culture=neutral, PublicKeyToken=null
// MVID: 69A50BC4-87A5-4C5E-BEFC-08274BC6D498
// Assembly location: C:\Program Files (x86)\SC4 Utilities\SC4Tool\SC4Tool.exe
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace SC4Tool
{
internal class StatusBarChild
{
public Control ChildControl;
public StatusBar StatusBar;
public short Panel;
public int Margin;
public const long WM_USER = 1024;
public const long SB_GETRECT = 1034;
[DllImport("user32", EntryPoint = "SendMessageA", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern long SendMessage(
int hwnd,
int msg,
int wParam,
ref StatusBarChild.RECT lParam);
public StatusBarChild(
ref Control obj,
ref StatusBar sb,
ref short intPanelNumber = 0,
int intMargin = 2)
{
this.ChildControl = obj;
this.StatusBar = sb;
this.Panel = intPanelNumber;
this.Margin = intMargin;
this.ChildControl.Parent = (Control) this.StatusBar;
this.Resize();
this.ChildControl.Visible = true;
}
public void Resize()
{
StatusBarChild.RECT lParam;
StatusBarChild.SendMessage(this.StatusBar.Handle.ToInt32(), 1034, (int) this.Panel, ref lParam);
Control childControl = this.ChildControl;
childControl.Left = checked (lParam.Left + this.Margin);
childControl.Top = checked (lParam.Top + this.Margin);
childControl.Height = checked (lParam.Bottom - lParam.Top - 2 * this.Margin);
childControl.Width = checked (lParam.Right - lParam.Left - 2 * this.Margin);
}
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
}
}