如标题:
运行程序而不显示主窗体。。即主窗体visable=false,问题是主窗体没这个属性

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows.Forms;namespace 值传递 {
    static class Program {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() {
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    //Application.Run(new Form1());
    Application.Run(new MyClass);
    }
    }
    }
      

  2.   

    //Application.Run(new Form1()); 
    Application.Run(new MyClass()); // 少了
      

  3.   

    在Program.cs中using System;
    using System.Collections.Generic;
    using System.Windows.Forms;namespace WindowsApplication1
    {
        static class Program
        {
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Form1  f = new Form1();
                f.Visible = false;

                Application.Run();
                f.Close();
            }
        }
    }
      

  4.   

    我在说详细点。。是这样的。我在主窗体里加入了MS Agent(AgentObjects)控件运行后会出现个类似office助手的小精灵,但是主窗体也会出现,目标是只让小精灵出现,而不显示主窗体,而上面的方法我试试什么都不会出现了。
      

  5.   


    5楼的你试了吗? 把那段代码放到 Program.cs下.Form1.cs :
    using System;
    using System.Windows.Forms;
    using AgentObjects;
    namespace WindowsApplication1 
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                axAgent1.Characters.Load("Merlin", (object)@"E:\WindowsApplication1\bin\Debug\Merlin.acs");  //加载Agent形象
                IAgentCtlCharacterEx Character = axAgent1.Characters["Merlin"];
                Character.Show(null);//显示精灵 
                Character.Speak("是我!!!!!!!!!!!!!!!", null);
            }    }
    }运行,屏幕上就是只显示精灵啊 .(修改一下加载精灵的文件路进)
      

  6.   

    多谢9楼的兄弟提醒哦,刚刚试5楼的方法时把AgentShow();放到form1_load里面了。。
    感谢5楼提供方法。。