We solve problems

  • Count on us to deliver high quality tailor-made software
  • We provide training on TDD, clean code, refactoring and JavaScript
  • We are committed consultants
  • We help teams deliver value

Splash screen in Gtk#

This sample shows how to create a splash screen using Monodelop and Gtk#. Create a new Window. Within its properties, unset the Decorator so that it won't have any title bar. Add a HBox or VBox inside the window with only one placeholder. Add a button inside and select Custom in the Button Type under the Button Properties. Add an image inside the button.
Source code that makes it work:

  1.  
  2. using System;
  3. using System.Threading;
  4.  
  5. namespace sigaDesktopClient
  6. {
  7. public partial class MainWindow : Gtk.Window
  8. {
  9.  
  10. public MainWindow() :
  11. base(Gtk.WindowType.Toplevel)
  12. {
  13. this.Build();
  14. ThreadStart tStart = new ThreadStart(this.EndSplash);
  15. Thread t = new Thread(tStart);
  16. t.Start();
  17. }
  18.  
  19. public void EndSplash()
  20. {
  21. Thread.Sleep(2000);
  22. Gtk.Application.Invoke(
  23. delegate (object sender, EventArgs args)
  24. {
  25. StartApplication();
  26. }
  27. );
  28. }
  29.  
  30. private void StartApplication()
  31. {
  32. // WRITE THE CODE TO OPEN THE MAIN GUI HERE
  33. this.Hide();
  34. }
  35.  
  36. protected virtual void OnClick (object sender, System.EventArgs e)
  37. {
  38. StartApplication();
  39. }
  40.  
  41. protected virtual void OnEntered (object sender, System.EventArgs e)
  42. {
  43. StartApplication();
  44. }
  45. }
  46. }
  47.  
Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.
  • http://www.allegro.nu Allegro Namioty

    You made some nice points there. I looked on the internet for the subject and found most guys will consent with your website.

  • brombomeopifs

    There are multitudinous reasons why you call a kitchenette slash sharpener Rotary Knife Sharpener
    If you would rather purchases a quality set of knives, you may already have blade sharpeners. There are uncountable contrary kinds, the ones with a hanker metal rod and a portfolio like ostensibly, seconded to a handle, called a honing recalcitrant

  • http://easternelegance.in/index.php?do=/lxio7ery/blog/dark-colored-10/ womens uggs sale swell

    strongzz I like the valuable info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I’m quite certain I’ll learn plenty of new stuff right here! Best of luck for the next!