Timer Background transition

I was trying to have my Form's background change when I press a button with a transition.

I figured the most simple and fast way to do this would be to put a white panel over my Form, with a blank backcolor, and to change its alpha component from 0 to 250 then from 250 to 0 when I click the button. When alpha reaches its maximum value, I want to change the background image. This technique worked like an hour ago, but now the color does not change at all, and my code is not entirely executed. Here's the function that is called by the Timer :

private void ChangeIndex(object sender, EventArgs e) { if (progressBar.Value == progressBar.Maximum-progressBar.Step) { t.Stop(); btnDébut.Enabled = true; btnFin.Enabled = true; btnPrécédent.Enabled = true; btnSuivant.Enabled = true; if (indiceCourant >= dt.Rows.Count) { this.indiceCourant = 0; } lblChargement.Visible = false; progressBar.Visible = false; RemplitChamps(indiceCourant); } progressBar.Step = 10; progressBar.Maximum = 200; progressBar.PerformStep(); MessageBox.Show(progressBar.Value.ToString() + " " + pnlFondEcran.BackColor.A.ToString() + " " + progressBar.Maximum.ToString()); if(progressBar.Value <100) { this.pnlFondEcran.BackColor = System.Drawing.Color.FromArgb(pnlFondEcran.BackColor.A + progressBar.Maximum/progressBar.Step,255, 255,255); // i wanna add 24 each time, until alpha=240 } else { MessageBox.Show("error"); this.pnlFondEcran.BackColor = System.Drawing.Color.FromArgb(pnlFondEcran.BackColor.A -progressBar.Maximum / progressBar.Step, 255, 255, 255); //then substract 24 each time } }

The Panel's name is pnlFondEcran. The progressbar works fine. The MessageBox.Show(some stuff )'s ouptpur is 0,20,40... to 200, 0, 200. The progressBar.Value<100 statement is never evaluated until the first last time the function is called, I have no idea why.

Here's the method calling ChangeIndex() :

private void DebutTimer()//lance le timer pour la progressbar { lblChargement.Visible = true; progressBar.Visible = true; progressBar.Value = 0; //gestion du timer t = new System.Windows.Forms.Timer(); t.Interval = 150; t.Enabled = true; t.Tick += new EventHandler(ChangeIndex); t.Start(); //gestion des boutons btnDébut.Enabled = false; btnFin.Enabled = false; btnPrécédent.Enabled = false; btnSuivant.Enabled = false; }

Category:c# Views:2 Time:2018-11-06

Related post

  • The Boost Statechart Library - how to implement time-consuming transitions 2009-08-24

    In our project we have UI and logic (which may be represented as a state machine). Transitions between some steps in this step machine are long (IO-bound). We don't want to steal our UI thread for all the time the transition is in progress. Therefore

  • jQuery Colorbox background transition effect? 2010-05-03

    I find the background transition of the jQuery Colorbox very 'hard'. I couldn't find a setting where I can specify a custom transition. Is it possible to create a fade-effect for the background like Nyro Modal has? --------------Solutions------------

  • css background transition in opera goes through black 2012-01-20

    I'm just getting into CSS3 transitions (about time!) and I witness some strange behavior in Opera 11.60. I use a transition to change an element from background:none to background:#fff. However, the transition actually goes through black/dark grey be

  • background transitioning / changing with fade 2012-04-03

    Heu Guys. What are the common ways to achieve a background change (slide show basically), with a transition effect. I want to change the comeplte document background at time intervals. I am a ASP.net developer, and would like to most of it natively i

  • How should I determine next daylight saving time (DST) transition for a timezone in Perl? 2010-07-14

    I'm working on a world clock web application, and I'd like to add a function to note how and when each location will next undergo a DST change. I'm using the DateTime and DateTime::Timezone CPAN modules, which seem to provide every conceivable functi

  • Start a long time background task 2012-03-13

    User request some page at my website. What i want to do? Send to user a fast answer and start background task which take a long time. It looks like: public ActionResult index() { var task = new Task(Stuff); //start task async task.start(); return Vie

  • How do I integrate and time background music into a slide with animation? 2012-08-28

    My boss is working on a PC desktop, creating a MS Office 2010 PowerPoint presentation. There is one slide where she is attempting to have pictures fade in, one at a time, timing a downloaded Johnny Cash song (I've been everywhere) to play in the back

  • Caurina Tweener Transition & Video Stream Time (AS3) 2011-01-26

    We are streaming an .flv file and using the stream time to trigger animations that utilize Caurina transitions. For whatever reaseon a few parameters aren't working at all or not fully; for example the delay function and a few transitions are ignored

  • Simple HTML5/CSS3 background image transition on mouse hover 2011-05-31

    I'm trying to understand the simplest background transition possible using only HTML5 and CSS3. Searching through stackoverflow I've learned it can be easily implemented using external libraries such as jQuery but for this project I've decided not re

  • Design-time-only background color in WPF? 2012-01-31

    In WPF XAML there is the convenient DesignHeight and DesignWidth, for instance in code as <UserControl ... d:DesignHeight="500" d:DesignWidth="500" ... /> which is great because I can build the layout with a representative, but not locked-in, c

  • Is there any disadvantage of setting global background CSS3 transition on all elements? 2012-03-30

    I've started playing around with CSS3 transitions in one of my projects, and I found that I basically want to have a transition on background color for every element that changes it on hover. If I do something like a { transition-property: background

  • Background html transition doesnt work in Firefox/IE10 2013-07-09

    I´d like some help to be sure if there isn´t any solution about this: I made a background transition which in the html element. The transition works only in the latest Chrome, Safari and Opera. It doesn´t in IE10 and FFx. Seems it´s because the bkg i

  • Jira - webhook only fires first time transition is ran on prod server, fires every time on dev server 2015-03-23

    I have a Jira WebHook that only fires the first time a transition happens on our production server, but fires every time the transition happens on our dev server. The Jira logs don't even show it trying to fire for a second time in prod. The webhooks

  • Prevent flicker on webkit-transition of webkit-transform 2010-08-11

    Possible Duplicate: iphone webkit css animations cause flicker For some reason, right before my animation of the webkit-transform property occurs, there is a slight flicker. Here is what I am doing: CSS: #element { -webkit-transition: -webkit-transfo

  • Can you use CSS3 to transition from height:0 to the variable height of content? 2010-08-18

    I am trying to make a <ul> slide down using CSS transitions. The ul starts off at height: 0;. On hover, the height is set to height:auto;. However, this is causing it to simply appear, not transition, If I do it from height: 40px; to height: au

  • CSS transition height: 0; to height: auto; 2010-08-18

    I am trying to make a <ul> slide down using CSS transitions. The ul starts off at height: 0;. On hover, the height is set to height:auto;. However, this is causing it to simply appear, not transition, If I do it from height: 40px; to height: au

  • Hidding the title bar on specific layouts that use ViewFlipper, and transitions not working properly 2010-10-30

    First off I am a beginner in Android development; I have been doing a lot of research into how to get the various tasks I am trying to complete. I have yet to find any similar issue to this, which is why I am asking it. This is a multipart question.

  • jQuery Animation with Time Issue 2011-05-31

    How do I get this http://cnanney.com/journal/demo/apple-counter/countdown.php to countdown to 10AM everyday and then restart. It's for a daily deadline. I already have a script that does this but in far more basic form, however I want the transition

  • Anyone transition from ASP.NET(MVC) to Play Framework 2011-07-12

    Been a long time user of the Microsoft stack and looking at other frameworks to learn and maybe transition to. I ran across the Play Framework recently and started working through some of the demos and really like it. Anyone from a .NET background tr

  • story board states, transition and visibility property 2012-03-12

    I am playing for the first time with Expression Blend. I made a very simple overlay grid that occupies all the screen space. <!-- phone application page --> <Grid x:Name="LayoutRoot"> <Grid> <Grid.RowDefinitions> <RowDefini

  • Find DST transition timestamp with java.util.TimeZone 2009-02-24

    Is it possible to get the previous and next DST transition timestamp with the Java Calendar/Date/TimeZone API? With Joda-Time I can write: DateMidnight today = new DateMidnight(2009, 2, 24); DateTimeZone zone = today.getZone(); DateTime previousTrans

  • Flash AS3 timer question 2009-03-02

    Hi I have got a timerEvent that adds 25 movieclips to the stage and animates them from x:0,y:0, this all works fine! What i would like to do is assign each movie clip a y value of 25px more than the last movieClip added to the stage. I did a little t

  • How to slice a factless fact table on time dimension? (SSAS) 2009-08-21

    Starting with the customary - "please excuse me as this is my first post and i'm a relative beginner" disclaimer, i have the following question... I work for a not for profit campaigning organisation, I've set up an SSAS solution to measure campaigni

  • Epoch Time (Ticks since 1970) - Mac vs. Windows 2010-01-11

    I have some C# web services that return JSON. The .NET JavaScriptSerializer returns dates in Epoch Time (milliseconds since 1970). On any Windows machine, the web based application processes the milliseconds back into the proper date without a proble

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.114 (s). 11 q(s)