You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB

using Apewer.Surface;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Apewer.Tray
{
class MainForm : Form
{
private void InitializeComponent()
{
SuspendLayout();
AutoScaleMode = AutoScaleMode.None;
StartPosition = FormStartPosition.CenterScreen;
ClientSize = new Size(900, 600);
Font = FormsUtility.DefaultFont;
Text = "MainForm";
ResumeLayout(false);
}
public MainForm()
{
Load += (s, e) => Init();
}
ListBox _listbox;
void Init()
{
Padding = new Padding(30, 30, 30, 30);
_listbox = new ListBox();
_listbox.Dock = DockStyle.Fill;
Controls.Add(_listbox);
Resize += (s, e) => Log(nameof(Resize), Width, Height);
ResizeBegin += (s, e) => Log(nameof(ResizeBegin), Width, Height);
ResizeEnd += (s, e) => Log(nameof(ResizeEnd), Width, Height);
Paint += (s, e) => Log(nameof(ResizeBegin), $"X={e.ClipRectangle.X}", $"Y={e.ClipRectangle.Y}", $"Width={e.ClipRectangle.Width}", $"X={e.ClipRectangle.Height}");
}
void Log(params object[] segs)
{
var text = TextUtility.Join("|", segs);
Logger.Write(text);
if (_listbox != null)
{
_listbox.Items.Add(text);
_listbox.TopIndex = _listbox.Items.Count - (int)(_listbox.Height / _listbox.ItemHeight);
}
}
}
}