public NppDockableDialog(EmptyForm formToCover) { // register to Npp FormIntegration.RegisterToNpp(Handle); FormBorderStyle = FormBorderStyle.None; ControlBox = false; ShowInTaskbar = false; StartPosition = FormStartPosition.Manual; AutoScaleMode = AutoScaleMode.None; _masterForm = formToCover; Location = _masterForm.PointToScreen(Point.Empty); ClientSize = _masterForm.ClientSize; _masterForm.VisibleChanged += Cover_OnVisibleChanged; _masterForm.Closed += MasterFormOnClosed; _masterForm.ClientSizeChanged += RefreshPosAndLoc; _masterForm.LocationChanged += RefreshPosAndLoc; _masterForm.LostFocus += RefreshPosAndLoc; _masterForm.GotFocus += RefreshPosAndLoc; Show(_masterForm); // Disable Aero transitions, the plexiglass gets too visible if (Environment.OSVersion.Version.Major >= 6) { int value = 1; WinApi.DwmSetWindowAttribute(Owner.Handle, WinApi.DwmwaTransitionsForcedisabled, ref value, 4); } Plug.OnNppWindowsMove += RefreshPosAndLoc; }
/// <summary> /// Initialize the form /// </summary> private static void Init() { // register fake form to Npp FakeForm = new EmptyForm(); NppTbData nppTbData = new NppTbData { hClient = FakeForm.Handle, pszName = AssemblyInfo.AssemblyProduct + " - File explorer", dlgID = DockableCommandIndex, uMask = NppTbMsg.DWS_DF_CONT_LEFT | NppTbMsg.DWS_ICONTAB | NppTbMsg.DWS_ICONBAR, hIconTab = (uint) Utils.GetIconFromImage(ImageResources.FileExplorerLogo).Handle, pszModuleName = AssemblyInfo.AssemblyProduct }; IntPtr ptrNppTbData = Marshal.AllocHGlobal(Marshal.SizeOf(nppTbData)); Marshal.StructureToPtr(nppTbData, ptrNppTbData, false); WinApi.SendMessage(Npp.HandleNpp, NppMsg.NPPM_DMMREGASDCKDLG, 0, ptrNppTbData); Form = new FileExplorerForm(FakeForm); }
/// <summary> /// init an empty form, this gives us a Form to hook onto if we want to do stuff on the UI thread /// from a back groundthread, use : BeginInvoke() /// </summary> public static void Init() { _anchorForm = new EmptyForm { Location = new Point(-10000, -10000), Visible = false }; }