当前位置:编程学习 > C#/ASP.NET >>

初学者的问题,求指点.......

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
namespace example1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Brush brSolid = new SolidBrush(Color.Blue);
            Brush brHatch = new HatchBrush(HatchStyle.HorizontalBrick, Color.Red, Color.Yellow);
            Brush brGradient = new LinearGradientBrush(new Rectangle(0, 0, 200, 200), Color.Black, Color.LightGray, 45, false);
            g.FillRectangle(brGradient, 10, 10, 200, 200);
            g.FillEllipse(brHatch, 200, 200, 150, 190);
            g.FillPie(brSolid, 0, 0, 300,300, 285, 75);
        }
    }
}
//这个程序总是提示“不包含适合于入口点的静态main方法” --------------------编程问答-------------------- 问题不在你贴的这段代码里,你再找找你的项目里,有没有一个Program.cs,通常VS的项目,那里才是整个程序的入口点,就是定义main函数的地方。 --------------------编程问答-------------------- 检查Program.cs文件    是否和下面的代码有出入?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace WindowsFormsApplication7
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run();
        }
    }
}
--------------------编程问答-------------------- 就是没有启动项啊,
你写个Main()方法就可以了 --------------------编程问答-------------------- 晕 贴错了  重新贴下哈 稍等 --------------------编程问答-------------------- using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace WindowsFormsApplication8
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}
--------------------编程问答-------------------- 没有静态的main函数的问题吧 --------------------编程问答-------------------- 对啊。。main()函数是程序的入口点。。要是没这个。程序是没法运行的额 --------------------编程问答-------------------- 上面说的都对,不过我更怀疑你是不是把一个form程序粘到console app工程里了,而且粘的时候还把main方法给删除了 :)
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,