How to create start or splash page in Windows Form C#
  • Hello
    Please tell me how can i create a start or splash page in C#.
  • 2 Comments sorted by
  • First you should create a form with or without Border (border-less is preferred for these things)



    <span class="kwd">public</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">SplashForm</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> </span><span class="typ">Form</span><span class="pln">
    </span><span class="pun">{</span><span class="pln">
    </span><span class="typ">Form</span><span class="pln"> </span><span class="typ">_Parent</span><span class="pun">;</span><span class="pln">
    </span><span class="typ">BackgroundWorker</span><span class="pln"> worker</span><span class="pun">;</span><span class="pln">
    </span><span class="kwd">public</span><span class="pln"> </span><span class="typ">SplashForm</span><span class="pun">(</span><span class="typ">Form</span><span class="pln"> parent</span><span class="pun">)</span><span class="pln">
    </span><span class="pun">{</span><span class="pln">
    </span><span class="typ">InitializeComponent</span><span class="pun">();</span><span class="pln">
    </span><span class="typ">BackgroundWorker</span><span class="pln"> worker </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">BackgroundWorker</span><span class="pun">();</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">worker</span><span class="pun">.</span><span class="typ">DoWork</span><span class="pln"> </span><span class="pun">+=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">System</span><span class="pun">.</span><span class="typ">ComponentModel</span><span class="pun">.</span><span class="typ">DoWorkEventHandler</span><span class="pun">(</span><span class="kwd">this</span><span class="pun">.</span><span class="pln">worker </span><span class="typ">_DoWork</span><span class="pun">);</span><span class="pln">
    backgroundWorker1</span><span class="pun">.</span><span class="typ">RunWorkerAsync</span><span class="pun">();</span><span class="pln">
    </span><span class="typ">_Parent</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> parent</span><span class="pun">;</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
    </span><span class="kwd">private</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> worker </span><span class="typ">_DoWork</span><span class="pun">(</span><span class="kwd">object</span><span class="pln"> sender</span><span class="pun">,</span><span class="pln"> </span><span class="typ">DoWorkEventArgs</span><span class="pln"> e</span><span class="pun">)</span><span class="pln">
    </span><span class="pun">{</span><span class="pln">
    </span><span class="typ">Thread</span><span class="pun">.</span><span class="pln">sleep</span><span class="pun">(</span><span class="lit">500</span><span class="pun">);</span><span class="pln">
    </span><span class="kwd">this</span><span class="pun">.</span><span class="pln">hide</span><span class="pun">();</span><span class="pln">
    </span><span class="typ">_Parent</span><span class="pun">.</span><span class="pln">show</span><span class="pun">();</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
    </span><span class="pun">}<br><br></span>

    At Main you should use that



    <span class="pln"> </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">class</span><span class="pln"> </span><span class="typ">Program</span><span class="pln">
    </span><span class="pun">{</span><span class="pln">
    </span><span class="pun">[</span><span class="typ">STAThread</span><span class="pun">]</span><span class="pln">
    </span><span class="kwd">static</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> </span><span class="typ">Main</span><span class="pun">()</span><span class="pln">
    </span><span class="pun">{</span><span class="pln">
    </span><span class="typ">Application</span><span class="pun">.</span><span class="typ">EnableVisualStyles</span><span class="pun">();</span><span class="pln">
    </span><span class="typ">Application</span><span class="pun">.</span><span class="typ">SetCompatibleTextRenderingDefault</span><span class="pun">(</span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
    </span><span class="typ">Application</span><span class="pun">.</span><span class="typ">Run</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">SplashForm</span><span class="pun">());</span><span class="pln">
    </span><span class="pun">}</span><span class="pln">
    </span><span class="pun">}</span>

  • Vote Up0Vote Down Jaguar777Jaguar777
    51.00 Karma Accepted Answer
    See attachment
    see.txt
    1007B

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

    Optimum Creative