| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1261 人关注过本帖
标题:本人初学者,为什么会出现下面的问题?求大神赐教。。
只看楼主 加入收藏
锋100
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-2-26
结帖率:0
收藏
已结贴  问题点数:20 回复次数:4 
本人初学者,为什么会出现下面的问题?求大神赐教。。
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication4
{
    public partial class ViewerForm1 : Form
    {
        public ViewerForm1()
        {
            InitializeComponent();
        }

        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 the window and the application
            this .Close();
        }
}

警告    1    文件“D:\新建文件夹 (1)\WindowsFormsApplication3\WindowsFormsApplication3\ViewerForm.cs”不支持代码分析或生成,因为它未包含在支持代码的项目中。        0    0   

错误    2    应输入 class、delegate、enum、interface 或 struct    D:\新建文件夹 (1)\WindowsFormsApplication4\WindowsFormsApplication4\ViewerForm1.cs    32    17    WindowsFormsApplication4
搜索更多相关主题的帖子: private public file 
2014-02-26 12:42
wyc199288
Rank: 2
等 级:论坛游民
帖 子:17
专家分:15
注 册:2014-1-4
收藏
得分:7 
private void btnQuit_Click(object sender, EventArgs e)
这个按钮事件应该放在你的ViewerForm1类里,不能放在类外。
2014-02-26 14:36
wangnannan
Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18
等 级:贵宾
威 望:87
帖 子:2546
专家分:9359
注 册:2007-11-3
收藏
得分:7 
方法必须包含在类里 作用域问题不解释

出来混,谁不都要拼命的嘛。 。拼不赢?那就看谁倒霉了。 。有机会也要看谁下手快,快的就能赢,慢。 。狗屎你都抢不到。 。还说什么拼命?
2014-02-27 08:59
做好每一天
Rank: 2
等 级:论坛游民
威 望:3
帖 子:25
专家分:37
注 册:2014-2-19
收藏
得分:7 
namespace WindowsFormsApplication4
 {
     public partial class ViewerForm1 : Form
     {
         public ViewerForm1()
         {
             InitializeComponent();
         }
         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 the window and the application
             this .Close();
         }
     }         
 }
这样就对了。。。。。
2014-02-27 16:08
做好每一天
Rank: 2
等 级:论坛游民
威 望:3
帖 子:25
专家分:37
注 册:2014-2-19
收藏
得分:0 
namespace WindowsFormsApplication4
 {
     public partial class ViewerForm1 : Form
     {
         public ViewerForm1()
         {
             InitializeComponent();
         }
         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 the window and the application
             this .Close();
         }
     }         
 }
这样就对了。。。。。
2014-02-27 16:08
快速回复:本人初学者,为什么会出现下面的问题?求大神赐教。。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014819 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved