using Remontor.Connector; using Remontor.History; using Remontor.Setting; using Remontor.Words; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using static Remontor.Setting.SettingWordsControl; using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Remontor { public partial class Form1 : Form { private const int SWP_NOOWNERZORDER = 0x200; private const int SWP_NOREDRAW = 0x8; private const int SWP_NOZORDER = 0x4; private const int SWP_SHOWWINDOW = 0x0040; private const int WS_EX_MDICHILD = 0x40; private const int SWP_FRAMECHANGED = 0x20; private const int SWP_NOACTIVATE = 0x10; private const int SWP_ASYNCWINDOWPOS = 0x4000; private const int SWP_NOMOVE = 0x2; private const int SWP_NOSIZE = 0x1; private const int GWL_STYLE = (-16); private const int WS_VISIBLE = 0x10000000; private const int WM_CLOSE = 0x10; private const int WS_CHILD = 0x40000000; Process p1; Process p; public Form1() { SGlobalSetting.LoadSetting(); //WordsList.MainCategory = SGlobalSetting.LoadWords(); InitializeComponent(); barSessionControl1.hideTab += flowContainer1.HideBar; barSessionControl1.hideTab += flowContainerWords1.HideBar; barSessionControl1.hideTab += flowConteinerSetting1.HideBar; SConnector.Panel = this.panel3; SConnector.FormMain = this; flowConteinerSetting1.settingWordsControl1.UpdateTree = flowContainerWords1.UpdateTree; this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //p1 = Process.Start("notepad"); ////Thread.Sleep(500); // Allow the process to open it's window //p1.WaitForInputIdle(); //SetParent(p1.MainWindowHandle, panel1.Handle); //SetWindowLong(p1.MainWindowHandle, GWL_STYLE, WS_VISIBLE); //MoveWindow(p1.MainWindowHandle, panel1.Bounds.X, panel1.Bounds.Y - 24, panel1.Bounds.Width, panel1.Bounds.Height, true); //p = Process.Start("notepad"); //Thread.Sleep(500); // Allow the process to open it's window //p.WaitForInputIdle(); //SetParent(p.MainWindowHandle, panel3.Handle); //SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_VISIBLE); //MoveWindow(p.MainWindowHandle, panel3.Bounds.X, panel3.Bounds.Y, panel3.Bounds.Width, panel3.Bounds.Height, true); } private void button1_Click(object sender, EventArgs e) { // panel1.Visible =! panel1.Visible; } private void button2_Click(object sender, EventArgs e) { panel3.Visible =! panel3.Visible; } [DllImport("user32.dll")] static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); [DllImport("user32.dll")] static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); [DllImport("user32.dll")] static extern bool MoveWindow(IntPtr Handle, int x, int y, int w, int h, bool repaint); private void tabControl1_SizeChanged(object sender, EventArgs e) { SConnector.ResizeActiv(); //MoveWindow(p1.MainWindowHandle, panel1.Bounds.X, panel1.Bounds.Y - 24, panel1.Bounds.Width, panel1.Bounds.Height, true); //MoveWindow(p.MainWindowHandle, panel3.Bounds.X, panel3.Bounds.Y, panel3.Bounds.Width, panel3.Bounds.Height, true); } protected override void WndProc(ref Message m) { if ((m.Msg == 0x210 && m.WParam.ToInt32() == 513) || m.Msg == 0x201) { Point clickPoint = this.PointToClient(Cursor.Position); if (!flowContainer1.Bounds.Contains(clickPoint)) { barSessionControl1.ShowBarSet(BarShow.HideBar); } } base.WndProc(ref m); } private void Form1_Load(object sender, EventArgs e) { } private void barSessionControl1_Load(object sender, EventArgs e) { } private void Form1_Deactivate(object sender, EventArgs e) { barSessionControl1.ShowBarSet(BarShow.HideBar); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { flowContainerWords1.Save(); SGlobalSetting.SaveSettig(); } } }