private void 文件前添加文字ToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = true; if (ofd.ShowDialog() == DialogResult.OK) { string content = Inputbox.SetAString("输入添加文字", "文字:", false); while (content == "") { content = Inputbox.SetAString("输入添加文字", "文字:", false); } foreach (string file in ofd.FileNames) { string name = Path.GetFileNameWithoutExtension(file); string extension = Path.GetExtension(file); string outputName = content + name + extension; string Dir = Path.GetDirectoryName(file); string outputPath = Dir + "\\" + outputName; FileInfo fi = new FileInfo(file); //xx/xx/aa.rar fi.Attributes = FileAttributes.Normal; fi.MoveTo(outputPath); //xx/xx/xx.rar } MessageBox.Show("改名结束"); } }
public static void UnsetInputboxTarget(Inputbox inputbox) { if (sInputbox != inputbox) { return; } sInputbox = null; }
private void mnuBuscar_Click(object sender, EventArgs e) { try { DataTable oRestriccion = new DataTable(); Int16 oIndice; frmAyuda oAyuda = new frmAyuda(); string oNuip = Inputbox.Show("Buqueda Placa", "Digite la placa que desea consultar.", FormStartPosition.CenterScreen); oAyuda.Informacion = oHelper.RecuperarDatosVehiculoRestriccion(oNuip); oAyuda.ColumnReturn = 0; oAyuda.ShowDialog(); if (string.IsNullOrEmpty(oAyuda.ValorRegistroSeleccionado) == false) { Vehiculo = Int64.Parse(oAyuda.RowSelect.Cells[0].Value.ToString()); lblPlaca.Text = oAyuda.RowSelect.Cells[1].Value.ToString(); lblCliente.Text = oAyuda.RowSelect.Cells[2].Value.ToString(); TabBasica(false); TabProducto(false); TabDia(false); oRestriccion = oHelper.RecuperarRestriccionesTipo(lblPlaca.Text); if (oRestriccion.Rows.Count > 0) { oIndice = Int16.Parse(oRestriccion.Rows[0][0].ToString()); switch (oIndice) { case 0: dtgHoraDia.DataSource = oRestriccion; dtgHoraDia.Columns[0].Visible = false; break; case 2: dtgDia.DataSource = oRestriccion; break; case 1: dtgHoras.DataSource = oRestriccion; break; } } } oAyuda.Close(); oAyuda.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Restricciones - Buscar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } //Inputbox.Show( }
private void btn_editar_clave_Click(object sender, EventArgs e) { String val = text_contrasena.Text; if (!String.IsNullOrEmpty(text_contrasena.Text)) { String opcion = Inputbox.Show("Confirmacion de Acceso", "Ingrese Su Contraseña ", FormStartPosition.CenterScreen); if (!String.IsNullOrEmpty(opcion)) { if (opcion.Equals(F_Login.perfil.Contrasena)) { text_contrasena.Enabled = true; } else { MessageBox.Show("Error Acceso Denegado"); } } } else { MessageBox.Show("No Posee Contraseña"); } }
private void btnStart_Click(object sender, RoutedEventArgs e) { btnStart.Visibility = Visibility.Collapsed; string input = ""; input = Inputbox.ShowInputDialog(ref input, "Podaj liczbę graczy", 500, 70); int tries = 0; while (!input.All(char.IsDigit)) { tries++; input = Inputbox.ShowInputDialog(ref input, "Coś poszło nie tak. Podaj jeszcze raz liczbę graczy", 500, 70); } int numCols = int.Parse(input); //create column for each player for (int i = 0; i < numCols; ++i) { resultTable.ColumnDefinitions.Add(new ColumnDefinition()); } //create row for each possible category for (int i = 0; i < 18; ++i) { resultTable.RowDefinitions.Add(new RowDefinition()); } //set height of each created row foreach (var g in resultTable.RowDefinitions) { g.Height = new GridLength(1, GridUnitType.Auto); } // set width of each created column foreach (var g in resultTable.ColumnDefinitions) { g.Width = new GridLength(1, GridUnitType.Star); g.MinWidth = 120; } //create label for each cell in table for (int j = 0; j < numCols; j++) { for (int i = 0; i < 18; ++i) { int idx = resultTable.Children.Add(new System.Windows.Controls.Label()); System.Windows.Controls.Label x = resultTable.Children[idx] as System.Windows.Controls.Label; x.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center; //check wheteher it is first row (names) if (i == 0) { string imie = Inputbox.ShowInputDialog(ref input, "Podaj imię gracza nr" + (j + 1), 500, 70); x.Content = imie; x.FontWeight = FontWeights.UltraBold; x.Name = "Player" + (j + 1); RegisterName(x.Name, x); } else { x.Content = string.Empty; x.FontWeight = FontWeights.Bold; x.Name = "P" + (j + 1) + "B" + i; RegisterName(x.Name, x); } x.Height = 20; x.FontSize = 18; x.Margin = new System.Windows.Thickness(5); x.Padding = new System.Windows.Thickness(1); x.SetValue(Grid.RowProperty, i); x.SetValue(Grid.ColumnProperty, j); x.SetValue(Grid.ColumnSpanProperty, 1); x.SetValue(Grid.RowSpanProperty, 1); } } ActivePlayer.PersonId = 1; ActivePlayer.NumberOfPlayers = numCols; }
public static void SetInputboxTarget(Inputbox inputbox) { sInputbox = inputbox; }
private void btnGo_Click(object sender, EventArgs e) { int casos = 0; Int32.TryParse(TxtCasos.Text, out casos); string output = string.Empty; if (casos > 0) { for (int i = 0; i < casos; i++) { string filasT = Inputbox.Show("Filas", "Ingrese el numero de Filas ", FormStartPosition.CenterScreen); string columnasT = Inputbox.Show("Columnas", "Ingrese el numero de columnas ", FormStartPosition.CenterScreen); int filas = 0; int columnas = 0; Int32.TryParse(filasT, out filas); Int32.TryParse(columnasT, out columnas); if (filas == columnas && filas > 1) { if (filas % 2 == 0) { MessageBox.Show("L"); output += "L-"; } else { MessageBox.Show("R"); output += "R-"; } } else { if (filas > columnas && columnas > 1) { if (columnas % 2 == 0) { MessageBox.Show("U"); output += "U-"; } else { MessageBox.Show("D"); output += "D-"; } } else { if (columnas > filas) { if (filas % 2 == 0) { MessageBox.Show("L"); output += "L-"; } else { MessageBox.Show("R"); output += "R-"; } } else { if (columnas == 1) { if (filas == 1) { MessageBox.Show("R"); output += "R-"; } else { MessageBox.Show("D"); output += "D-"; } } } } } } output = output.Length > 0 ? output.Substring(0, output.Length - 1) : string.Empty; label1.Text = "OUTPUT " + output; } else { MessageBox.Show("Debes escribir un número válido", "Error"); } }
public void FocusToInputBox() { Inputbox.Focus(); }
/******** Functions ********/ public LevelState(GameStateManager gameStateManager) { // Randomize using ticks. random = new Random((int)DateTime.Now.Ticks); this.gameStateManager = gameStateManager; firstBlood = false; victory = false; stopwatch = new Stopwatch(); entities = new List <Entity.Entity>(); map = new Map.Map(Program.mainForm.ClientSize.Width / 4 * 3, Program.mainForm.ClientSize.Height / 4 * 3); map.position.X = Program.mainForm.ClientSize.Width / 2 - map.size.Width; map.position.Y = Program.mainForm.ClientSize.Height / 2 - map.size.Height; layout = new Layout.Layout(); layout.backgroundBrush = Brushes.Transparent; Layout.Box statusBox = new Layout.Box("statusBox"); statusBox.percentageWidth = 10; statusBox.percentageHeight = 20; statusBox.percentageLocation = new PointF(89, 12.5f); // Redefining textbox standards. Textbox.SaveDefaultStyle(); Textbox.defaultAnchor = Anchor.Left; Textbox.defaultBorderline = Pens.Transparent; Textbox.defaultFill = Brushes.Transparent; // Labels. Textbox timerLabel = new Layout.Textbox("timerLabel"); Textbox shotCounterLabel = new Layout.Textbox("shotCounterLabel"); Textbox enemyCounterLabel = new Layout.Textbox("enemyCounterLabel"); Textbox scoreCounterLabel = new Layout.Textbox("scoreCounterLabel"); timerLabel.parent = statusBox; shotCounterLabel.parent = statusBox; enemyCounterLabel.parent = statusBox; scoreCounterLabel.parent = statusBox; timerLabel.percentageY = 5; shotCounterLabel.percentageY = 30; enemyCounterLabel.percentageY = 55; scoreCounterLabel.percentageY = 80; timerLabel.text = "Time:"; shotCounterLabel.text = "Shots:"; enemyCounterLabel.text = "Hits:"; scoreCounterLabel.text = "Score:"; // Infoboxes. Textbox.defaultAnchor = Anchor.Right; Textbox timer = new Textbox("timer"); Textbox shotCounter = new Textbox("shotCounter"); Textbox enemyCounter = new Textbox("enemyCounter"); Textbox scoreCounter = new Textbox("scoreCounter"); timer.parent = statusBox; shotCounter.parent = statusBox; enemyCounter.parent = statusBox; scoreCounter.parent = statusBox; timer.percentageY = timerLabel.percentageY; shotCounter.percentageY = shotCounterLabel.percentageY; enemyCounter.percentageY = enemyCounterLabel.percentageY; scoreCounter.percentageY = scoreCounterLabel.percentageY; Textbox.RestoreDefaultStyle(); // Adding boxes to layout. layout.AddBox(statusBox); layout.AddBox(timer); layout.AddBox(timerLabel); layout.AddBox(shotCounter); layout.AddBox(shotCounterLabel); layout.AddBox(enemyCounter); layout.AddBox(enemyCounterLabel); layout.AddBox(scoreCounter); layout.AddBox(scoreCounterLabel); // Already setting up victory dialogue. #warning You may not set the relative position after setting the anchor or every child box will not show up correctly centerBox = new Layout.Box("centerBox"); centerBox.percentageSize = new SizeF(25, 15); centerBox.anchor = Layout.Anchor.Center; centerBox.borderLine.Width = 3; centerBox.borderLine.LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel; centerBox.fill = Brushes.LightBlue; caption = new Layout.Textbox("caption"); caption.parent = centerBox; caption.text = "Please enter your name:"; caption.percentageY = 20; caption.anchor = Layout.Anchor.CenterX; inputBox = new Layout.Inputbox("inputBox"); inputBox.parent = centerBox; inputBox.percentageY = 60; inputBox.anchor = Layout.Anchor.CenterX; inputBox.text = ""; inputBox.maxLength = 15; inputBox.maxSize = true; inputBox.textAnchor = Layout.Anchor.Center; inputBox.OnDelimiterEntered += NameEntered; layout.AddBox(centerBox); layout.AddBox(caption); layout.AddBox(inputBox); }