Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Creating this "Please wait..." window?

Creating this "Please wait..." window?

Scheduled Pinned Locked Moved C#
question
14 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D dan sh

    You can use a form with border set to none and having a label with required text. This[^] does the same.

    S Offline
    S Offline
    SimpleData
    wrote on last edited by
    #3

    I've thought about that but there should be a simpler way because lots of applications use it.

    D D C 3 Replies Last reply
    0
    • S SimpleData

      I've thought about that but there should be a simpler way because lots of applications use it.

      D Offline
      D Offline
      danzar
      wrote on last edited by
      #4

      Are you tring to figure out how to show the form or how to show it while the program is loading? If you are wanting to show it while the program load, then what i did was loaded the "loading form" at the ever beginning of the other form. then when it was done with all the other stuff I closed the "loading form"

      S 1 Reply Last reply
      0
      • D danzar

        Are you tring to figure out how to show the form or how to show it while the program is loading? If you are wanting to show it while the program load, then what i did was loaded the "loading form" at the ever beginning of the other form. then when it was done with all the other stuff I closed the "loading form"

        S Offline
        S Offline
        SimpleData
        wrote on last edited by
        #5

        I am not having trouble on figuring out those, the thing I am wondering is creating a form in that style. I think that form style is built-in Windows as a standart loading screen.

        1 Reply Last reply
        0
        • S SimpleData

          Hi I would like to show this windows in my application because it takes lot of time for it to load itself. How can I show this window. http://img36.imageshack.us/img36/7597/wnd.jpg[^] Thanks.

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #6

          This is what I used the last time I needed this in Load event (formSplash is a borderless form).

          Hide();
          bool done = false;
          ThreadPool.QueueUserWorkItem(
          (x) =>
          {
          using (formSplash = new FormSplash())
          {
          formSplash.Show();
          while (!done)
          Application.DoEvents();
          formSplash.Close();
          }
          });
          // Do stuff...
          done = true;
          Show();

          Dave
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
          Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
          Why are you using VB6? Do you hate yourself? (Christian Graus)

          S 1 Reply Last reply
          0
          • D DaveyM69

            This is what I used the last time I needed this in Load event (formSplash is a borderless form).

            Hide();
            bool done = false;
            ThreadPool.QueueUserWorkItem(
            (x) =>
            {
            using (formSplash = new FormSplash())
            {
            formSplash.Show();
            while (!done)
            Application.DoEvents();
            formSplash.Close();
            }
            });
            // Do stuff...
            done = true;
            Show();

            Dave
            BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
            Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
            Why are you using VB6? Do you hate yourself? (Christian Graus)

            S Offline
            S Offline
            SimpleData
            wrote on last edited by
            #7

            Thank you for the code but a borderless form and a label does a little bit different comparing to the screen in screenshot.

            D 1 Reply Last reply
            0
            • S SimpleData

              I've thought about that but there should be a simpler way because lots of applications use it.

              D Offline
              D Offline
              dan sh
              wrote on last edited by
              #8

              Do whatever you are doing in load on a separate thread. And while that is executed, set the border of your form to none and hide all the controls. Display just a label to the user with needed text. This is no different than the previous post of mine except instead of having a separate form, you are doing same thing in the current form itself. This, IMO, is not a good way. You will need to write same thing again and again if there are some more forms which take time to load. Go for what I had posted earlier. AFAIK it is a decent way to achieve this. I don't know if there is any other way to do this.

              1 Reply Last reply
              0
              • S SimpleData

                Thank you for the code but a borderless form and a label does a little bit different comparing to the screen in screenshot.

                D Offline
                D Offline
                DaveyM69
                wrote on last edited by
                #9

                You can use whatever border style you like if you set the form's ControlBox to false and Text to empty. Alternatively, override OnPaint in the splash form and draw your own border etc eg.

                protected override void OnPaint(PaintEventArgs e)
                {
                using (Pen pen = new Pen(Color.FromKnownColor(KnownColor.InactiveBorder)))
                {
                e.Graphics.DrawRectangle(
                pen,
                new Rectangle(
                Point.Empty, new Size(Width - 1, Height - 1))
                );
                }
                base.OnPaint(e);
                }

                Dave
                BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
                Why are you using VB6? Do you hate yourself? (Christian Graus)

                S 1 Reply Last reply
                0
                • D DaveyM69

                  You can use whatever border style you like if you set the form's ControlBox to false and Text to empty. Alternatively, override OnPaint in the splash form and draw your own border etc eg.

                  protected override void OnPaint(PaintEventArgs e)
                  {
                  using (Pen pen = new Pen(Color.FromKnownColor(KnownColor.InactiveBorder)))
                  {
                  e.Graphics.DrawRectangle(
                  pen,
                  new Rectangle(
                  Point.Empty, new Size(Width - 1, Height - 1))
                  );
                  }
                  base.OnPaint(e);
                  }

                  Dave
                  BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                  Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
                  Why are you using VB6? Do you hate yourself? (Christian Graus)

                  S Offline
                  S Offline
                  SimpleData
                  wrote on last edited by
                  #10

                  That's better, thanks.

                  D 1 Reply Last reply
                  0
                  • S SimpleData

                    That's better, thanks.

                    D Offline
                    D Offline
                    DaveyM69
                    wrote on last edited by
                    #11

                    I've investigated this a little more, and it may be able to be done by PInvoking SetWindowLong[^]. See also Window Styles[^] and Extended Window Styles[^].

                    Dave
                    BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                    Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
                    Why are you using VB6? Do you hate yourself? (Christian Graus)

                    1 Reply Last reply
                    0
                    • S SimpleData

                      Hi I would like to show this windows in my application because it takes lot of time for it to load itself. How can I show this window. http://img36.imageshack.us/img36/7597/wnd.jpg[^] Thanks.

                      A Offline
                      A Offline
                      Alan N
                      wrote on last edited by
                      #12

                      Hi, That looks remarkably like a button without a focus rectangle to me.

                      public class CuelessButton : Button {
                      public CuelessButton() {
                      }

                      protected override bool ShowFocusCues {
                        get { return false; }
                      }
                      

                      }

                      Now dock it in a borderless form.

                      public partial class SplashForm : Form {
                      private CuelessButton button1;

                      public SplashForm() {
                        InitializeComponent();
                        this.button1 = new CuelessButton();
                        this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
                        this.button1.Text = "Please Wait ...";
                        this.Controls.Add(this.button1);
                      }
                      

                      }

                      Umm, I think that needs a bit of work but it looks about right! Alan.

                      1 Reply Last reply
                      0
                      • S SimpleData

                        I've thought about that but there should be a simpler way because lots of applications use it.

                        C Offline
                        C Offline
                        Christian Graus
                        wrote on last edited by
                        #13

                        What could possibly be simpler than what you were told to do ? I mean, seriously ? you need to put it in another thread if you want it to repaint itself while the app is busy. yes, the other apps do that, too

                        Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

                        S 1 Reply Last reply
                        0
                        • C Christian Graus

                          What could possibly be simpler than what you were told to do ? I mean, seriously ? you need to put it in another thread if you want it to repaint itself while the app is busy. yes, the other apps do that, too

                          Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

                          S Offline
                          S Offline
                          SimpleData
                          wrote on last edited by
                          #14

                          What I ment by simpler was something built-in to windows.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups