Exemple #1
0
        public static Form_Search Show(Action <string, ESerchDirection> onsearch, Form onform)
        {
            if (onsearch == null || onform == null)
            {
                throw new ArgumentNullException();
            }
            bool setpos = false;

            if (Instance == null)
            {
                Instance = new Form_Search();
                setpos   = true;
            }
            Instance.OnSearch = onsearch;
            Instance.OnForm   = onform;
            Instance.Owner    = onform;
            Instance.Show();
            if (setpos && !onform.IsDisposed && onform.Visible)
            {
                var r = onform.RectangleToScreen(onform.ClientRectangle);
                int x = r.Left + r.Width / 2 - Instance.Width / 2;
                int y = r.Top + r.Height / 2 - Instance.Height / 2;
                Instance.Left = x;
                Instance.Top  = y;
            }
            Instance.tbText.Select();
            return(Instance);
        }
Exemple #2
0
 private void Form_Search_FormClosed(object sender, FormClosedEventArgs e)
 {
     _onForm  = null;
     OnSearch = null;
     Instance = null;
 }