Example #1
0
        public virtual void ShowChart(bool show, int l = -1, int t = -1, int w = -1, int h = -1)
        {
            if (show)
            {
                _form.InvokeIfRequired(c => c.Show());
                if (l != -1 && t != -1 && w != -1 && h != -1)
                {
                    WindowMove.SetWindowPosition(_form.Handle, l, t, w, h);
                }
                else if (l != -1 && t != -1)
                {
                    WindowMove.SetWindowPosition(_form.Handle, l, t, -1, -1, WindowMove.SWP_NOSIZE);
                }

                //disable the Close button, such that we cannot manually cose the chart
                _form.InvokeIfRequired(c =>
                {
                    IntPtr hSystemMenu = UnsafeNativeMethods.GetSystemMenu(_form.Handle, false);
                    UnsafeNativeMethods.RemoveMenu(hSystemMenu, UnsafeNativeMethods.SC_CLOSE, UnsafeNativeMethods.MF_BYCOMMAND);      //remove the "X". both work and we need only one.
                });
            }
            else
            {
                _form.InvokeIfRequired(c => c.Hide());
            }

            _bShowChart = show;
        }