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 frmViewer : Form
{
public frmViewer()
{
InitializeComponent();
} private void fimviewer_Load(object sender, EventArgs e)
{ } private void btnselectpicture_Click(object sender, EventArgs e)
{
//show the open file dialog box.
if(ofdSelectPicture.ShowDialog()==DialogResult.OK)
{
//Load the picture into the picture box.
picShowPicture.Image=Image.FromFile(ofdSelectPicture.FileName);
//show the name of the file in the form's caption.
this.Text=string.Concat("Picture View("+ofdSelectPicture.FileName+")");
}
}
} private void btnquit_Click(object sender, EventArgs e)
{
//close window and exit the application
this.Close();
}
}
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 frmViewer : Form
{
public frmViewer()
{
InitializeComponent();
} private void fimviewer_Load(object sender, EventArgs e)
{ } private void btnselectpicture_Click(object sender, EventArgs e)
{
//show the open file dialog box.
if(ofdSelectPicture.ShowDialog()==DialogResult.OK)
{
//Load the picture into the picture box.
picShowPicture.Image=Image.FromFile(ofdSelectPicture.FileName);
//show the name of the file in the form's caption.
this.Text=string.Concat("Picture View("+ofdSelectPicture.FileName+")");
}
}
} private void btnquit_Click(object sender, EventArgs e)
{
//close window and exit the application
this.Close();
}
}
解决方案 »
- 如何使窗体水平翻转(镜像)显示呢
- vs2012 中为什么没找到添加“ADO.NET实体数据模型”的地方?
- 查找xml数据里的值,并将其存入数组
- sql2000数据类型(新手提问)
- 枚举类型(困惑)
- Visual C# 2005 Express有没有人用过啊,碰到n多问题,各位进来看看啊.
- 新成员提出的问题:网络版软件开发中ID号怎么处理?
- 关于override和new不太理解
- 请问用Matrix 的Scale执行缩放与Graphics的SScaleTransform有什么区别么,是不是可以实现相同的功能
- 如何将传来的参数Request.QueryString [0]在代码中传会
- 局域网中的主算机如何取外网IP地址
- oldb读取多个txt文件
{
//close window and exit the application
this.Close();
}这个方法你粘贴错位置了。需要放在类里,你贴到类外面了。
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 frmViewer : Form
{
public frmViewer()
{
InitializeComponent();
} private void fimviewer_Load(object sender, EventArgs e)
{ } private void btnselectpicture_Click(object sender, EventArgs e)
{
//show the open file dialog box.
if (ofdSelectPicture.ShowDialog() == DialogResult.OK)
{
//Load the picture into the picture box.
picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName);
//show the name of the file in the form's caption.
this.Text = string.Concat("Picture View(" + ofdSelectPicture.FileName + ")");
}
}
private void btnquit_Click(object sender, EventArgs e)
{
//close window and exit the application
this.Close();
}
}
}
这样就对了。
你的那个大括号括错了!!!
private void btnquit_Click(object sender, EventArgs e)
{
//close window and exit the application
this.Close();
}
应该放里面的!!
这块多了个},删一个掉
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 frmViewer : Form
{
public frmViewer()
{
InitializeComponent();
} private void fimviewer_Load(object sender, EventArgs e)
{ } private void btnselectpicture_Click(object sender, EventArgs e)
{
//show the open file dialog box.
if(ofdSelectPicture.ShowDialog()==DialogResult.OK)
{
//Load the picture into the picture box.
picShowPicture.Image=Image.FromFile(ofdSelectPicture.FileName);
//show the name of the file in the form's caption.
this.Text=string.Concat("Picture View("+ofdSelectPicture.FileName+")");
}
}
//}多了一个大括号 private void btnquit_Click(object sender, EventArgs e)
{
//close window and exit the application
this.Close();
}
}
}//少了一个大括号