9/19第一週 初次認識C# & Unity
利用工具箱,點選button,建立兩個按鈕
表單進入button1,輸入MessageBox.Show("你好嗎?");
執行時可跳出對話視窗
表單進入button2,輸入button1.Location = new Point(150, 150);
執行時可讓button1位置改變使之移動
Ex:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("你好嗎?");
}
private void button2_Click(object sender, EventArgs e)
{
button1.Location = new Point(150, 150);
}
}
}
沒有留言:
張貼留言