//
弹出窗口
MessageBox.Show (String) // 更多方法请参考MessageBox类
// 退出程序
Application.Exit();
// 弹出打开文件对话框
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = " 选择图片 " ;
fdlg.InitialDirectory = " c:";
// 文件过滤类型
fdlg.Filter = " All files (*.*)|*.*|Image files (*.jpg, *.bmp, *.gif)|*.jpg; *.bmp; *.gif " ;
// 缺省过滤文件类型
fdlg.FilterIndex = 1 ;
if (fdlg.ShowDialog() == DialogResult.OK)
... {
......
}
// Form尺寸
int Height = Form.ActiveForm.Size.Height;
int Width = Form.ActiveForm.Size.Width;
String size = Form.ActiveForm.Size.ToString();
MessageBox.Show(size);
// 手动改变控件位置
m_myBtn.Left = 200 ;
m_myBtn.Top = 200 ;
// 改变控件的Text
m_myBtn.Text = " 改变 " ;
// 改变背景色
this .BackColor = Color.Red;
// 弹出窗口
About myAbout = new About(); // About 是一个窗口类
myAbout.ShowDialog();
// 取得时间
public string GetTime()
... {
int hour = DateTime.Now.Hour;
int min = DateTime.Now.Minute;
int sec = DateTime.Now.Second;
string time_str = "";
time_str = (hour < 10) ? "0" + hour.ToString() : hour.ToString();
time_str += ":" + ((min < 10) ? "0" + min.ToString() : min.ToString());
time_str += ":" + ((sec < 10) ? "0" + sec.ToString() : sec.ToString());
return time_str;
}
// 键盘回车响应事件
private void MyKeyDown( object sender, KeyEventArgs e) // MyKeyDown这个名称是自己定义
... {
if (e.KeyCode == System.Windows.Forms.Keys.Enter) //VC中,需要将"."替换成"::"
...{
MessageBox.Show("Hi,it's me!");
}
}
MessageBox.Show (String) // 更多方法请参考MessageBox类
// 退出程序
Application.Exit();
// 弹出打开文件对话框
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.Title = " 选择图片 " ;
fdlg.InitialDirectory = " c:";
// 文件过滤类型
fdlg.Filter = " All files (*.*)|*.*|Image files (*.jpg, *.bmp, *.gif)|*.jpg; *.bmp; *.gif " ;
// 缺省过滤文件类型
fdlg.FilterIndex = 1 ;
if (fdlg.ShowDialog() == DialogResult.OK)
... {
......
}
// Form尺寸
int Height = Form.ActiveForm.Size.Height;
int Width = Form.ActiveForm.Size.Width;
String size = Form.ActiveForm.Size.ToString();
MessageBox.Show(size);
// 手动改变控件位置
m_myBtn.Left = 200 ;
m_myBtn.Top = 200 ;
// 改变控件的Text
m_myBtn.Text = " 改变 " ;
// 改变背景色
this .BackColor = Color.Red;
// 弹出窗口
About myAbout = new About(); // About 是一个窗口类
myAbout.ShowDialog();
// 取得时间
public string GetTime()
... {
int hour = DateTime.Now.Hour;
int min = DateTime.Now.Minute;
int sec = DateTime.Now.Second;
string time_str = "";
time_str = (hour < 10) ? "0" + hour.ToString() : hour.ToString();
time_str += ":" + ((min < 10) ? "0" + min.ToString() : min.ToString());
time_str += ":" + ((sec < 10) ? "0" + sec.ToString() : sec.ToString());
return time_str;
}
// 键盘回车响应事件
private void MyKeyDown( object sender, KeyEventArgs e) // MyKeyDown这个名称是自己定义
... {
if (e.KeyCode == System.Windows.Forms.Keys.Enter) //VC中,需要将"."替换成"::"
...{
MessageBox.Show("Hi,it's me!");
}
}