public SettingForm(IMEStatusMonitor monitor, Settings settings) { InitializeComponent(); _settings = settings; _monitor = monitor; // デザイナでレイアウトするとなぜかぶっ壊されるので自力で配置する Control parent = lblImeOff.Parent; int left = lblImeOff.Right + 5; int width = parent.ClientRectangle.Right - left - 10; ImeOffBorderStylePanel.SetBounds(left, lblImeOff.Top - 25, width, 45); ImeOnBorderStylePanel.SetBounds(left, lblImeOn.Top - 25, width, 45); parent.Controls.Add(ImeOffBorderStylePanel); parent.Controls.Add(ImeOnBorderStylePanel); ImeOffBorderStylePanel.StyleObject = _settings.ImeOffBorderStyle; ImeOnBorderStylePanel.StyleObject = _settings.ImeOnBorderStyle; IgnoreList.Text = string.Join("\r\n", _settings.IgnoreList); lblProductName.Text = Application.ProductName; lblVersion.Text = "Version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; lblCopyright.Text = ((System.Reflection.AssemblyCopyrightAttribute) Attribute.GetCustomAttribute( System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyCopyrightAttribute))).Copyright; this.FormClosed += SettingForm_FormClosed; _monitor.Updated += _monitor_Updated; }
public MainForm() { InitializeComponent(); loadSettings(); this.Text = Application.ProductName; this.Load += MainForm_Load; this.FormClosed += MainForm_FormClosed; _timer = new Timer(); _timer.Interval = 1000; _timer.Start(); _timer.Tick += _timer_Tick; _trayIcon = new NotifyIcon(); _trayIcon.Icon = this.Icon; _trayIcon.ContextMenuStrip = trayMenu; _trayIcon.Visible = true; _monitor = new IMEStatusMonitor(_settings); _monitor.EventThreadForm = this; _monitor.Updated += _monitor_Updated; }