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

topmost求助

using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
public class Form1:Form
{
int W=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;//获取屏幕宽度
int H=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;//获取屏幕高度
public Form1()
{
InitializeComponent();
this.TopMost=true;
this.FormBorderStyle =  System.Windows.Forms.FormBorderStyle.None;
this.Size=new Size(100,100);
this.BackColor=Color.BlueViolet;
}
private void InitializeComponent()
{
this.Text="form";
}
static void Main()
{
Application.Run(new Form1());
}
}


请教怎么错了????
求分析
或修改后的源码
【用的是ppc的pocketc#】
错误信息:
>> 开始编译...
\csharp\form\form.exe: no entry point specified
nment
耗时4.126秒
>> 编译失败 --------------------编程问答-------------------- static void Main()不是一般在Program.cs文件中吗。

试一试修改项目属性中的Application 页的Startup object. 设置成你的Form1. --------------------编程问答-------------------- 找不到入口,比如winform的入口是使用[STAThread]。 --------------------编程问答-------------------- ppc的pocketc#应该和winform类似,有对应的入口标识 --------------------编程问答-------------------- 手机无力Orz... --------------------编程问答--------------------
引用 3 楼 u011303459 的回复:
ppc的pocketc#应该和winform类似,有对应的入口标识
所以应该怎么办⊙_⊙ --------------------编程问答--------------------
引用 1 楼 findcaiyzh 的回复:
static void Main()不是一般在Program.cs文件中吗。

试一试修改项目属性中的Application 页的Startup object. 设置成你的Form1.
手机无力Orz... --------------------编程问答--------------------
引用 5 楼 syhbk 的回复:
Quote: 引用 3 楼 u011303459 的回复:

ppc的pocketc#应该和winform类似,有对应的入口标识
所以应该怎么办⊙_⊙

在main函数上加上[MTAThread]试试

[MTAThread]  
static void Main()
{
Application.Run(new Form1());
}
--------------------编程问答--------------------
引用 7 楼 u011303459 的回复:
Quote: 引用 5 楼 syhbk 的回复:

Quote: 引用 3 楼 u011303459 的回复:

ppc的pocketc#应该和winform类似,有对应的入口标识
所以应该怎么办⊙_⊙

在main函数上加上[MTAThread]试试

[MTAThread]  
static void Main()
{
Application.Run(new Form1());
}

这个:>> 开始编译...
\csharp\fom\fom.exe: no entry point specified
ignment
\csharp\fom\form1.cs:22: invalid type specification `(null)' 
\csharp\fom\form1.cs:22: `int' does not inherit from `System.Attribute'
耗时3.207秒
>> 编译失败
感觉好晕 --------------------编程问答-------------------- 除 --------------------编程问答--------------------

//Form1里面
 public partial class Form1 : Form
    {
        int W = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;//获取屏幕宽度
        int H = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;//获取屏幕高度

        public Form1()
        {
            InitializeComponent();
            this.TopMost = true;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Size = new Size(100, 100);
            this.BackColor = Color.BlueViolet;
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
//Program.cs里面
static class Program
    {
        /// <summary>
        /// アプリケーションのメイン エントリ ポイントです。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
--------------------编程问答-------------------- 天知道你的这个所谓的Pocket C#有没有bug。你愿意测试这种非主流的东西只能好自为之了。
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,