当前位置: 首页>>代码示例>>C#>>正文


C# InputBox类代码示例

本文整理汇总了C#中InputBox的典型用法代码示例。如果您正苦于以下问题:C# InputBox类的具体用法?C# InputBox怎么用?C# InputBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InputBox类属于命名空间,在下文中一共展示了InputBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Show

 public static DialogResult Show(string title, string prompt, out string result)
 {
     InputBox input = new InputBox(title, prompt);
     DialogResult retval = input.ShowDialog();
     result = input.textInput.Text;
     return retval;
 }
开发者ID:garyjohnson,项目名称:Remotive,代码行数:7,代码来源:InputBox.cs

示例2: Show

 public static bool Show(string title, string caption, ref string value, Predicate<string> predicate = null)
 {
     using (var inputBox = new InputBox())
     {
         inputBox.Text = title;
         inputBox.lciText.Text = caption;
         inputBox.lciMemo.Visibility = LayoutVisibility.Never;
         inputBox._predicate = predicate;
         inputBox.Height = 140;
         inputBox.txtMessage.EditValue = value ?? string.Empty;
         var dr = inputBox.ShowDialog();
         if (dr == DialogResult.OK)
         {
             value = inputBox.txtMessage.EditValue.ToStringEx();
             inputBox._predicate = null;
             return true;
         }
         else
         {
             value = string.Empty;
             inputBox._predicate = null;
             return false;
         }
     }
 }
开发者ID:JodenSoft,项目名称:JodenSoft,代码行数:25,代码来源:InputBox.cs

示例3: AskValue

        public static string AskValue(IWin32Window owner, string caption = "InputBox", string description = "Insert a new value.", string value = "")
        {
            InputBox input = new InputBox();
            string ret = "";

            try
            {
                input.Text = caption;

                input.lbDescription.Text = description;
                input.txValue.Text = value;

                input.ShowDialog(owner);
                if (input.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    ret = input.txValue.Text;
                }
                input.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().FullName, ex.Message);
            }

            return ret;
        }
开发者ID:fabriceleal,项目名称:ImageProcessing,代码行数:26,代码来源:InputBox.cs

示例4: gridMain_CellDoubleClick

		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			InputBox editWord=new InputBox("Edit word");
			DictCustom origWord=DictCustoms.Listt[e.Row];
			editWord.textResult.Text=origWord.WordText;
			if(editWord.ShowDialog()!=DialogResult.OK) {
				return;
			}
			if(editWord.textResult.Text==origWord.WordText) {
				return;
			}
			if(editWord.textResult.Text=="") {
				DictCustoms.Delete(origWord.DictCustomNum);
				DataValid.SetInvalid(InvalidType.DictCustoms);
				FillGrid();
				return;
			}
			string newWord=Regex.Replace(editWord.textResult.Text,"[\\s]|[\\p{P}\\p{S}-['-]]","");//don't allow words with spaces or punctuation except ' and - in them
			for(int i=0;i<DictCustoms.Listt.Count;i++) {//Make sure it's not already in the custom list
				if(DictCustoms.Listt[i].WordText==newWord) {
					MsgBox.Show(this,"The word "+newWord+" is already in the custom word list.");
					editWord.textResult.Text=origWord.WordText;
					return;
				}
			}
			origWord.WordText=newWord;
			DictCustoms.Update(origWord);
			DataValid.SetInvalid(InvalidType.DictCustoms);
			FillGrid();
		}
开发者ID:mnisl,项目名称:OD,代码行数:29,代码来源:FormSpellCheck.cs

示例5: butAdd_Click

		private void butAdd_Click(object sender,EventArgs e) {
			if(!Security.IsAuthorized(Permissions.WikiListSetup)) {
				return;
			}
			InputBox inputListName = new InputBox("New List Name");
			inputListName.ShowDialog();
			if(inputListName.DialogResult!=DialogResult.OK) {
				return;
			}
			//Format input as it would be saved in the database--------------------------------------------
			inputListName.textResult.Text=inputListName.textResult.Text.ToLower().Replace(" ","");
			//Validate list name---------------------------------------------------------------------------
			if(DbHelper.isMySQLReservedWord(inputListName.textResult.Text)) {
				//Can become an issue when retrieving column header names.
				MsgBox.Show(this,"List name is a reserved word in MySQL.");
				return;
			}
			if(inputListName.textResult.Text=="") {
				MsgBox.Show(this,"List name cannot be blank.");
				return;
			}
			if(WikiLists.CheckExists(inputListName.textResult.Text)) {
				if(!MsgBox.Show(this,MsgBoxButtons.YesNo,"List already exists with that name. Would you like to edit existing list?")) {
					return;
				}
			}
			FormWikiListEdit FormWLE = new FormWikiListEdit();
			FormWLE.WikiListCurName = inputListName.textResult.Text;
			//FormWLE.IsNew=true;//set within the form.
			FormWLE.ShowDialog();
			FillList();
		}
开发者ID:romeroyonatan,项目名称:opendental,代码行数:32,代码来源:FormWikiLists.cs

示例6: CallIBox

        /* Brings up the Input Box with the arguments of a */
        public Form1.IBArg[] CallIBox(Form1.IBArg[] a)
        {
            InputBox ib = new InputBox();

            ib.Arg = a;
            ib.fmHeight = this.Height;
            ib.fmWidth = this.Width;
            ib.fmLeft = this.Left;
            ib.fmTop = this.Top;
            ib.TopMost = true;
            ib.BackColor = Form1.ncBackColor;
            ib.ForeColor = Form1.ncForeColor;
            ib.Show();

            while (ib.ret == 0)
            {
                a = ib.Arg;
                Application.DoEvents();
            }
            a = ib.Arg;

            if (ib.ret == 1)
                return a;
            else if (ib.ret == 2)
                return null;

            return null;
        }
开发者ID:Jassemm,项目名称:NetCheatPS3,代码行数:29,代码来源:OptionForm.cs

示例7: Run

 public override void Run()
 {
     if (this.IsEnabled)
     {
         InputBox box = new InputBox("请输入使用的远程服务自动升级对象地址:", "提示:", "http://127.0.0.1:7502/RemoteUpdate");
         string result = string.Empty;
         if (box.ShowDialog(WorkbenchSingleton.MainForm) == DialogResult.OK)
         {
             result = box.Result;
             if (string.IsNullOrEmpty(result))
             {
                 MessageHelper.ShowInfo("没有输入远程对象地址");
             }
             else
             {
                 try
                 {
                     string remoteLog = (Activator.GetObject(typeof(IRemoteUpdate), result) as IRemoteUpdate).GetRemoteLog();
                     string path = Path.GetTempFileName() + ".txt";
                     File.WriteAllText(path, remoteLog);
                     Process.Start(path);
                 }
                 catch (Exception exception)
                 {
                     MessageHelper.ShowError("远程服务执行升级操作发生错误", exception);
                     LoggingService.Error(exception);
                 }
             }
         }
     }
 }
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:31,代码来源:ViewRemoteLogCommand.cs

示例8: LoadContent

        /// <summary>
        /// Load initial game data and assets once.
        /// </summary>
        public override void LoadContent()
        {
            //TODO: Offload to initialize
            ScreenManager.Game.IsMouseVisible = true;
            spriteBatch = ScreenManager.SpriteBatch;
            content = new ContentManager(ScreenManager.Game.Services, "Content");
            //Load banner Image

            //Load Instruction text (also error text)
            textMessage = new TextBox(message,
                new Vector2(this.ScreenManager.GraphicsDevice.Viewport.Width/2, 290), Color.Black);
            textMessage.LoadContent(spriteBatch, ScreenManager.GraphicsDevice,
                content);
            //Load Input box
            inputBox = new InputBox(new Vector2(390, 390), Color.Orange, 10);
            inputBox.LoadContent(spriteBatch, ScreenManager.GraphicsDevice, content);
            //Load Login Button
            loginButton = new Button("Login", new Vector2(390, 500), Color.Aqua);
            loginButton.LoadContent(spriteBatch, ScreenManager.GraphicsDevice,
                content);
            exitButton = new Button("Exit", new Vector2(510, 500), Color.PaleVioletRed);
            exitButton.LoadContent(spriteBatch, ScreenManager.GraphicsDevice,
                content);
            //Load Exit Button
        }
开发者ID:tjw0051,项目名称:MGSE-Project,代码行数:28,代码来源:LoginScreen.cs

示例9: dataGridView1_CellContentClick

 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1 && e.RowIndex < dataGridView1.Rows.Count - 1)
     {
         int.TryParse(dataGridView1.Rows[e.RowIndex].Cells["id"].Value.ToString(), out id);
         string imeColumne = dataGridView1.Columns[e.ColumnIndex].Name;
         if (imeColumne == "obrisi")
         {
             if (PrijavljenJe && PristupJe)
             {
                 InputBox frm = new InputBox();
                 DialogResult rez = frm.ShowDialog();
                 if (rez == DialogResult.OK)
                 {
                     osvjezi = ObrisiMobitel();
                     GetMobiteli();
                 }
             }
         }
         else if (imeColumne == "azuriraj")
         {
             txtImeMobitela.Text = dataGridView1.Rows[e.RowIndex].Cells["ime"].Value.ToString();
             tabControl1.SelectedIndex = 1;
         }
     }
 }
开发者ID:dmarijanovic,项目名称:mobilis-manager,代码行数:26,代码来源:Mobiteli.cs

示例10: Execute

        public void Execute(ICSharpCode.TreeView.SharpTreeNode[] selectedNodes)
        {
            //Member
            var member = (IMemberDefinition)((IMemberTreeNode)selectedNodes[0]).Member;
            var rename = GetObjectsToRename(member).ToArray();

            //Content of the input box
            var content = new StackPanel();
            content.Children.Add(new TextBlock() { Inlines = { new Run() { Text = "Insert new name for " }, new Run() { Text = member.Name, FontWeight = System.Windows.FontWeights.Bold }, new Run() { Text = "." } } });
            if (rename.Length > 1)
            {
                content.Children.Add(new TextBlock() { Text = "This action will automatically update the following members:", Margin = new System.Windows.Thickness(0, 3, 0, 0) });
                foreach (var x in rename.Skip(1))
                    content.Children.Add(new TextBlock() { Text = x.Key.Name, FontWeight = System.Windows.FontWeights.Bold, Margin = new System.Windows.Thickness(0, 3, 0, 0) });
            }

            //Asks for the new name and performs the renaming
            var input = new InputBox("New name", content);
            if (input.ShowDialog().GetValueOrDefault(false) && !string.IsNullOrEmpty(input.Value))
            {
                //Performs renaming
                foreach (var x in rename)
                    x.Key.Name = string.Format(x.Value, input.Value);

                //Refreshes the view
                MainWindow.Instance.RefreshDecompiledView();
                selectedNodes[0].Foreground = ILEdit.GlobalContainer.NewNodesBrush;
                MainWindow.Instance.RefreshTreeViewFilter();
            }
        }
开发者ID:95ulisse,项目名称:ILEdit,代码行数:30,代码来源:RenameEntry.cs

示例11: archiveMonthToolStripMenuItem_Click

        private void archiveMonthToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var input = new InputBox("Enter a Month", "Please enter the month you are archiving"))
            {
                string inputtxt;
                if (input.ShowDialog() == DialogResult.OK)
                    inputtxt = input.InputText.ToUpper();
                else
                    return;

                ReadArchives();
                var exists = _archived.Where(item => String.Compare(item.MonthName.ToUpper(), inputtxt, StringComparison.Ordinal) == 0);

                if (!exists.Any())
                {
                    double projTotal = _projData.Sum();
                    double currTotal = _currData.Sum();
                    _archived.Add(new ArchiveMonth(input.InputText, _projData, projTotal, _listFinances, currTotal));
                    WriteArchives();

                    UIHelper.ClearList(lstItems);
                    _listFinances = new List<FinanceEntry>();
                    _currData = new List<double>();
                    InitProjectionData();
                    Utilities.LoadID(_listFinances);
                    WriteXML();
                    Recalculate();
                    MessageBox.Show("Your total spending for the month left you with: " + (projTotal - currTotal).ToString(Formats.MoneyFormat), "Monthly Total");
                }
                else
                    MessageBox.Show("Error: There is already an entry with the same name","Error");
                _archived = null;
            }
        }
开发者ID:kjrcda,项目名称:FinanceTracker,代码行数:34,代码来源:MainForm.cs

示例12: Run

 public override void Run()
 {
     IWfBox owner = this.Owner as IWfBox;
     if (owner != null)
     {
         InputBox box2 = new InputBox("请输入使用的远程DAO对象地址:", "提示", "http://127.0.0.1:7502/DBDAO");
         if (box2.ShowDialog(WorkbenchSingleton.MainForm) == DialogResult.OK)
         {
             string result = box2.Result;
             if (!string.IsNullOrEmpty(result))
             {
                 WaitDialogHelper.Show();
                 try
                 {
                     (owner as WfBox).SaveAsProinsts(result);
                 }
                 catch (Exception exception)
                 {
                     MessageHelper.ShowInfo("发生错误:{0}", exception.Message);
                     LoggingService.Error(exception);
                 }
                 finally
                 {
                     WaitDialogHelper.Close();
                 }
             }
         }
     }
 }
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:29,代码来源:SaveAsProinstCommand.cs

示例13: Show

        /// <summary>
        /// Displays a prompt in a dialog box, waits for the user to input text or click a button.
        /// </summary>
        /// <param name="prompt">String expression displayed as the message in the dialog box</param>
        /// <param name="title">String expression displayed in the title bar of the dialog box</param>
        /// <param name="defaultResponse">String expression displayed in the text box as the default response</param>
        /// <param name="validator">Delegate used to validate the text</param>
        /// <param name="keyPressHandler">Delete used to handle keypress events of the textbox</param>
        /// <param name="xpos">Numeric expression that specifies the distance of the left edge of the dialog box from the left edge of the screen.</param>
        /// <param name="ypos">Numeric expression that specifies the distance of the upper edge of the dialog box from the top of the screen</param>
        /// <returns>An InputBoxResult object with the Text and the OK property set to true when OK was clicked.</returns>
        public static InputBoxResult Show(string prompt, string title, string defaultResponse, InputBoxValidatingHandler validator, KeyPressEventHandler keyPressHandler, int xpos, int ypos)
        {
            using (InputBox form = new InputBox())
            {
                form.label.Text = prompt;
                form.Text = title;
                form.textBox.Text = defaultResponse;
                if (xpos >= 0 && ypos >= 0)
                {
                    form.StartPosition = FormStartPosition.Manual;
                    form.Left = xpos;
                    form.Top = ypos;
                }

                form.Validator = validator;
                form.KeyPressed = keyPressHandler;

                DialogResult result = form.ShowDialog();

                InputBoxResult retval = new InputBoxResult();
                if (result == DialogResult.OK)
                {
                    retval.Text = form.textBox.Text;
                    retval.OK = true;
                }

                return retval;
            }
        }
开发者ID:hoeness2,项目名称:mcebuddy2,代码行数:40,代码来源:InputBox.cs

示例14: AddButton_Click

        private void AddButton_Click(object sender, EventArgs e)
        {
            var input = new InputBox("请输入一个名字:", "新增操作者", "");
            var result = input.ShowDialog(this);
            if (result == DialogResult.OK)
            {
                var name = input.InputResult.Trim();
                bool nameExists = false;
                foreach (string n in OperatorsListBox.Items) {
                    if (n == name)
                    {
                        nameExists = true;
                        break;
                    }
                }

                if (!nameExists)
                {
                    var db = new DataProcess();
                    db.addOperator(name);
                    OperatorsListBox.Items.Add(name);
                }
                else
                {
                    MessageBox.Show(this, "名字已存在,请勿重复添加。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }
开发者ID:venj,项目名称:Welding-Recorder,代码行数:28,代码来源:OperatorsForm.cs

示例15: Run

 public override void Run()
 {
     if (this.IsEnabled)
     {
         InputBox box = new InputBox("请输入使用的远程服务自动升级对象地址:", "提示:", "http://127.0.0.1:7502/RemoteUpdate");
         string result = string.Empty;
         if (box.ShowDialog(WorkbenchSingleton.MainForm) == DialogResult.OK)
         {
             result = box.Result;
             if (string.IsNullOrEmpty(result))
             {
                 MessageHelper.ShowInfo("没有输入远程对象地址");
             }
             else
             {
                 try
                 {
                     (Activator.GetObject(typeof(IRemoteUpdate), result) as IRemoteUpdate).Execute();
                     MessageHelper.ShowInfo("远程服务执行升级操作成功!");
                 }
                 catch (Exception exception)
                 {
                     MessageHelper.ShowError("远程服务执行升级操作发生错误", exception);
                     LoggingService.Error(exception);
                 }
             }
         }
     }
 }
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:29,代码来源:RemoteAutoUpdateServerCommand.cs


注:本文中的InputBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。