コード例 #1
0
        private static string InternalShow(IWin32Window owner, string title, string message, string prompt = "", string okText = "O&k", string cancelText = "&Cancel", bool passwordEnabled = false, FormStartPosition startPosition = FormStartPosition.WindowsDefaultLocation)
        {
            IWin32Window showOwner = owner ?? FromHandle(PI.GetActiveWindow());

            using (KryptonInputBox kib = new KryptonInputBox(title, message, prompt, okText, cancelText, passwordEnabled, startPosition))
            {
                kib.StartPosition = showOwner == null ? startPosition : startPosition;

                return(kib.ShowDialog(showOwner) == DialogResult.OK ? kib.GetUserResponse() : string.Empty);
            }
        }
コード例 #2
0
        private static string InternalShow(IWin32Window owner,
                                           string prompt,
                                           string caption,
                                           string defaultResponse)
        {
            // If do not have an owner passed in then get the active window and use that instead
            IWin32Window showOwner = owner ?? FromHandle(PI.GetActiveWindow());

            // Show input box window as a modal dialog and then dispose of it afterwards
            using (KryptonInputBox ib = new KryptonInputBox(prompt, caption, defaultResponse))
            {
                ib.StartPosition = showOwner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent;

                return(ib.ShowDialog(showOwner) == DialogResult.OK ? ib.InputResponse : string.Empty);
            }
        }
コード例 #3
0
ファイル: KryptonInputBox.cs プロジェクト: Cocotteseb/Krypton
        private static string InternalShow(IWin32Window owner,
                                           string prompt, 
                                           string caption,
                                           string defaultResponse)
        {
            IWin32Window showOwner = null;

            // If do not have an owner passed in then get the active window and use that instead
            if (owner == null)
                showOwner = Control.FromHandle(PI.GetActiveWindow());
            else
                showOwner = owner;

            // Show input box window as a modal dialog and then dispose of it afterwards
            using (KryptonInputBox ib = new KryptonInputBox(prompt, caption, defaultResponse))
            {
                if (showOwner == null)
                    ib.StartPosition = FormStartPosition.CenterScreen;
                else
                    ib.StartPosition = FormStartPosition.CenterParent;

                if (ib.ShowDialog(showOwner) == DialogResult.OK)
                    return ib.InputResponse;
                else
                    return string.Empty;
            }
        }