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. How to create a fadein dialog by C#?

How to create a fadein dialog by C#?

Scheduled Pinned Locked Moved C#
csharptutorialquestion
9 Posts 3 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.
  • T Offline
    T Offline
    tuliplanetrain
    wrote on last edited by
    #1

    anybody know? Tuliplanet

    M T 3 Replies Last reply
    0
    • T tuliplanetrain

      anybody know? Tuliplanet

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      Change the Opacity property of your form in a timer or something like that. Mazy "Improvisation is the touchstone of wit." - Molière

      1 Reply Last reply
      0
      • T tuliplanetrain

        anybody know? Tuliplanet

        T Offline
        T Offline
        tuliplanetrain
        wrote on last edited by
        #3

        it doesn't work! the interval property of timer is 100! this is my code,is there anything wrong? private void button1_Click(object sender, System.EventArgs e) { this.Opacity = 0; timer1.Start(); } private void timer1_Tick(object sender, System.EventArgs e) { this.Opacity = this.Opacity + 5; if(this.Opacity >= 100) { timer1.Stop(); } } Tuliplanet

        M M 3 Replies Last reply
        0
        • T tuliplanetrain

          it doesn't work! the interval property of timer is 100! this is my code,is there anything wrong? private void button1_Click(object sender, System.EventArgs e) { this.Opacity = 0; timer1.Start(); } private void timer1_Tick(object sender, System.EventArgs e) { this.Opacity = this.Opacity + 5; if(this.Opacity >= 100) { timer1.Stop(); } } Tuliplanet

          M Offline
          M Offline
          Morten Kristensen
          wrote on last edited by
          #4

          Hey.. You have to set the timers interval, when it has to run the method. Timer newTimer = new Timer(); newTimer.Interval = 1000; // one sec newTimer.Tick += new EventHandler(TheMethod); // .. newTimer.Start(); :)


          - Up The Irons, Morten Kristensen

          1 Reply Last reply
          0
          • T tuliplanetrain

            it doesn't work! the interval property of timer is 100! this is my code,is there anything wrong? private void button1_Click(object sender, System.EventArgs e) { this.Opacity = 0; timer1.Start(); } private void timer1_Tick(object sender, System.EventArgs e) { this.Opacity = this.Opacity + 5; if(this.Opacity >= 100) { timer1.Stop(); } } Tuliplanet

            M Offline
            M Offline
            Mazdak
            wrote on last edited by
            #5

            Automatic Fading Form [^] Mazy "Improvisation is the touchstone of wit." - Molière

            1 Reply Last reply
            0
            • T tuliplanetrain

              anybody know? Tuliplanet

              T Offline
              T Offline
              tuliplanetrain
              wrote on last edited by
              #6

              see my reply!! i set interval=100,but the form just show after a flash! Tuliplanet

              M 1 Reply Last reply
              0
              • T tuliplanetrain

                it doesn't work! the interval property of timer is 100! this is my code,is there anything wrong? private void button1_Click(object sender, System.EventArgs e) { this.Opacity = 0; timer1.Start(); } private void timer1_Tick(object sender, System.EventArgs e) { this.Opacity = this.Opacity + 5; if(this.Opacity >= 100) { timer1.Stop(); } } Tuliplanet

                M Offline
                M Offline
                Mazdak
                wrote on last edited by
                #7

                By the way this will solve it: Tuliplanet wrote: this.Opacity = this.Opacity + 5; Change it to

                this.Opacity = this.Opacity + 0.05;

                You should use numbers between 0 to 1. Mazy "Improvisation is the touchstone of wit." - Molière

                1 Reply Last reply
                0
                • T tuliplanetrain

                  see my reply!! i set interval=100,but the form just show after a flash! Tuliplanet

                  M Offline
                  M Offline
                  Morten Kristensen
                  wrote on last edited by
                  #8

                  Hehe.. Easy man. Didnt see that sorry. Anyways.. You could also use Thread and ThreadStart? using System.Threading; //.. ThreadStart ts = new ThreadStart(TheMethod); Thread t = new Thread(ts); t.Start(); // .. public void TheMethod(){ for(int i = 0;i<=100;i++){ Thread.Sleep(10); // Perform Code } }


                  - Up The Irons, Morten Kristensen

                  M 1 Reply Last reply
                  0
                  • M Morten Kristensen

                    Hehe.. Easy man. Didnt see that sorry. Anyways.. You could also use Thread and ThreadStart? using System.Threading; //.. ThreadStart ts = new ThreadStart(TheMethod); Thread t = new Thread(ts); t.Start(); // .. public void TheMethod(){ for(int i = 0;i<=100;i++){ Thread.Sleep(10); // Perform Code } }


                    - Up The Irons, Morten Kristensen

                    M Offline
                    M Offline
                    Mazdak
                    wrote on last edited by
                    #9

                    The problem is not with thread or timer. He set the wrong value for that property. :) Mazy "Improvisation is the touchstone of wit." - Molière

                    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