本文整理汇总了C#中Form2.Show方法的典型用法代码示例。如果您正苦于以下问题:C# Form2.Show方法的具体用法?C# Form2.Show怎么用?C# Form2.Show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form2
的用法示例。
在下文中一共展示了Form2.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ServerAnswer
private void ServerAnswer(int buttonNumber)
{
int i = stream.Read(bytes, 0, bytes.Length);
string Data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
string[] split = Data.Split(new Char[] { ' ' });
Form2 form2 = new Form2();
if (split[0] == "ANSWER_TYPE")
{
int[] type_num = new int[3];
type_num[0] = Convert.ToInt32(split[1]);
type_num[1] = Convert.ToInt32(split[2]);
type_num[2] = Convert.ToInt32(split[3]);
//Form2 form2 = new Form2();
form2.Show();
form2.Type(type_num, type_num.GetLength(0));
}
else if (split[0] == "ANSWER_TIME")
{
int[] time = new int[24];
for (int k = 1; k <= 24; k++)
{
time[k - 1] = Convert.ToInt32(split[k]);
}
//Form2 form2 = new Form2();
form2.Show();
form2.Time(time, time.GetLength(0));
}
else
MessageBox.Show("Неможливо отримати дані. Спробуйте ще раз пізніше.");
}
示例2: button2_Click
private void button2_Click(object sender, EventArgs e)
{
Form2 f = new Form2();
f.Show();
f.Hide();
if (checkBox1.Checked == true)
{
if (label6.Text != "<未选择>")//判断图标是否选择
f.Icon = new Icon(label6.Text);//通过label6也就是选择的文件的路径设置窗口图标
else MessageBox.Show("您还没有选择图标!");//处理错误
}
if (checkBox2.Checked == true)
{
if (label9.Text != "<未选择>")//判断图片是否选择
f.BackgroundImage = Image.FromFile(label9.Text);//通过label9也就是选择的文件的路径设置窗口背景
else MessageBox.Show("您还没有选择图片!");//处理错误
//上面更改背景///////////////////////////////下面更改样式
if (radioButton1.Checked)
f.BackgroundImageLayout = ImageLayout.None;
else if (radioButton2.Checked)
f.BackgroundImageLayout = ImageLayout.Tile;
else if (radioButton3.Checked)
f.BackgroundImageLayout = ImageLayout.Center;
else if (radioButton4.Checked)
f.BackgroundImageLayout = ImageLayout.Stretch;
else if (radioButton5.Checked)
f.BackgroundImageLayout = ImageLayout.Zoom;
}
if (checkBox3.Checked == true)
f.Text = textBox1.Text;//修改窗口标题为textbox1的文本
if (checkBox4.Checked == true)
{
try//测试是否可以转换
{
int width = int.Parse(textBox2.Text);//转换数字
int height = int.Parse(textBox3.Text);//转换数字
f.Width = width;//设置窗口宽度
f.Height = height;//设置窗口高度
}
catch
{
MessageBox.Show("请输入整数!");//处理错误
}
}
f.Show();
}
示例3: listView1_SelectedIndexChanged
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
Handler h = new Handler();
Data.Value = h.getTipByID((System.Int32.Parse(listView1.Items[listView1.SelectedIndices[0]].Name)));
Form2 detailForm = new Form2();
detailForm.Show();
}
示例4: button1_Click
private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
try
{
ExtractfileInfo();
//dataGridView1.Rows.Clear();
//dataGridView1.RowCount = ClerksList.Count;
//for (int i = 0; i < ClerksList.Count; i++)
//{
// dataGridView1.Rows[i].HeaderCell.Value = (i + 1).ToString();
// dataGridView1[0, i].Value = ClerksList[i].ID;
// dataGridView1[1, i].Value = ClerksList[i].Name;
// dataGridView1[2, i].Value = ClerksList[i].Mobile;
// dataGridView1[3, i].Value = ClerksList[i].Office;
// dataGridView1[4, i].Value = ClerksList[i].Dept;
//}
DisplayForm = new Form2(this, ClerksList, fileInfo);
DisplayForm.Show();
this.Visible = false;
}
catch(Exception ex)
{
MessageBox.Show("Excel数据导出失败,错误原因:\n" + ex.Message + "\n错误代码E014,请联系开发者,谢谢");
}
button1.Enabled = true;
}
示例5: ecranBleu
public void ecranBleu()
{
Form2 bsod = new Form2();
Cursor.Hide();
bsod.Show();
bsod.Activate();
}
示例6: sre_SpeechRecognized
// Createe a simple handler for the SpeechRecognized event.
void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
int flag=0;
if (e.Result.Text.Equals("yes"))
{
if (i == 0)
{
ob = new Form2(a);
ob.Show();
this.Hide();
i++;
}
}
else
{
if (i == 0)
{
MessageBox.Show("say YES to play");
i++;
}
else
{
flag = ob.logic(e.Result.Text);
if(flag==1)
{
ob3 = new Form3(a);
ob3.Show();
ob.Hide();
}
}
}
}
示例7: button1_Click
private void button1_Click(object sender, EventArgs e)
{
// object Form2;
// string ipath1 = "c:\\tmp1\\このみタペ.jpg";
string ipath1 = "c:\\tmp1\\ぱんちら.jpg";
/* ぱんちらに変更 */
// ファイル存在チェックして対応
if (System.IO.File.Exists(ipath1))
{
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; // 窓に大きさあわせる
pictureBox1.Load(ipath1);
/* ここから Form2生成して表示のコード試験 */
Form2 myform2 = new Form2();
myform2.Show();
myform2.pictureBoxF2.SizeMode = PictureBoxSizeMode.Zoom; // 窓に大きさあわせる
myform2.pictureBoxF2.Load(ipath1);
button1.Text = "おーーけー!";
}
else {
button1.Text = "いや ファイルがだめだ!";
}
}
示例8: button1_Click
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Elcot\Documents\data.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From login where username='" + textBox1.Text + "'and password='" + textBox2.Text + "'", con);
DataTable dt = new DataTable();
sda.Fill(dt);
try
{
if (dt.Rows[0][0].ToString() == "1" || dt.Rows[0][1].ToString() == "1")
{
this.Hide();
Form2 form2 = new Form2();
form2.Show();
}
else
{
MessageBox.Show("please enter the valid username and password");
}
}
catch
{
MessageBox.Show("please enter the id");
}
}
示例9: AddMDIChildWindow
private void AddMDIChildWindow()
{
Form2 f = new Form2();
f.Text = "Child " + (_count++).ToString();
f.MdiParent = this;
f.Show();
}
示例10: Blk_squareStopped
private void Blk_squareStopped() {
if(this.blk.Top <= 30){
timer.Stop();
timer1.Stop();
//MessageBox.Show("Игра окончена.");
Form2 form2 = new Form2();
form2.Show();
form2.Controls[2].Text = textScore.Text;
form2.Controls[0].Text = label5.Text;
this.Text = Application.ProductName + " Нажмите Ентер для старта";
GameField.Reset();
field.CreateGraphics().Clear(Color.White);
nextBlock.CreateGraphics().Clear(Color.White);
}else{
score += GameField.CheckLines()* (100 - (timer.Interval/10));
this.textScore.Text = score.ToString() + " oчков";
blk = new Block(new Point(90,GameField.FieldTopBound + (GameField.SquareSize * 5)),next.BlkType);
blk.squareStopped +=new SquareStoppedEventHandler(Blk_squareStopped);
blk.Show(field.Handle);
nextBlock.CreateGraphics().Clear(Color.White);
this.next = new Block(new Point(35,35));
next.Show(nextBlock.Handle);
}
}
示例11: Form1
public Form1()
{
InitializeComponent();
richTextBox1.Enabled = false; //блокировка интерфейса, пока клиент не подключится к серверу.
richTextBox2.Enabled = false;
button1.Enabled = false;
if (!File.Exists(path))//создание файла для сохранения истории если его еще не существует
File.Create(path);
ShowHistory();
try
{// чтение настроик соединения из файла
var sr = new StreamReader(@"Client_info/data_info.txt");
string buffer = sr.ReadToEnd();
sr.Close();
string[] connect_info = buffer.Split(':');
ip = IPAddress.Parse(connect_info[0]);
port = int.Parse(connect_info[1]);
label2.Text = "Settings: \nServer IP:" + connect_info[0] + "\nServer Port:" + connect_info[1];
}
catch (Exception ex)
{
label2.Text = "Error!\nSettings not found";
Form2 form = new Form2();
form.Show();
}
}
示例12: webBrowser1_DocumentCompleted
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (e.Url.ToString().IndexOf("access_token") != -1)
{
string accessToken = "";
int userId = 0;
string[] parts = e.Url.AbsoluteUri.Split('#');
Regex myReg = new Regex(@"(?<name>[\w\d\x5f]+)=(?<value>[^\x26\s]+)", RegexOptions.IgnoreCase | RegexOptions.Singleline);
foreach (Match m in myReg.Matches(e.Url.ToString()))
{
if (m.Groups["name"].Value == "access_token")
{
accessToken = m.Groups["value"].Value;
}
else if (m.Groups["name"].Value == "user_id")
{
userId = Convert.ToInt32(m.Groups["value"].Value);
}
}
Program.API = new file(accessToken);
Program.API = new file(userId, accessToken);
Form2 main = new Form2();
this.Hide();
main.Show();
}
}
示例13: regBTN_Click
private void regBTN_Click(object sender, EventArgs e)
{
this.Hide();
Form2 f = new Form2(); // This is bad
f.Show();
}
示例14: butShow_Click
private void butShow_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
frm.MyProperty = filePath;
if (!File.Exists(filePath)) MessageBox.Show("Jos nista nije uneseno");
else frm.Show();
}
示例15: Form1
public Form1()
{
InitializeComponent();
richTextBox1.Enabled = false; //блокируем элементы формы
richTextBox2.Enabled = false;// disable forms elements
button1.Enabled = false;
try //обработчик ошибок
{ //error handler
var sr = new StreamReader(@"Client_info/data_info.txt"); //считываем настройки из фала и передаем в программу
string buffer = sr.ReadToEnd(); //read settings from file
sr.Close();
string[] connect_info = buffer.Split(':');// парсим строку на 2 части разделителем ':'
ip = IPAddress.Parse(connect_info[0]); //parse string
port = int.Parse(connect_info[1]);
label2.Text = "Settings: \nServer IP:" + connect_info[0] + "\nServer Port:" + connect_info[1];
}
catch (Exception ex) //если файл с настройками не обнаружен
{ // if file nit found
label2.Text = "Error!\nSettings not found";
Form2 form = new Form2();// запуск формы для ввода настроек соединения
form.Show(); // run form for set settings
}
}