Click here to Skip to main content
15,913,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: Event handle problem in C# Pin
Expert Coming29-Mar-06 11:02
Expert Coming29-Mar-06 11:02 
GeneralRe: Event handle problem in C# Pin
Phoen2529-Mar-06 12:34
Phoen2529-Mar-06 12:34 
GeneralRe: Event handle problem in C# Pin
Expert Coming29-Mar-06 12:36
Expert Coming29-Mar-06 12:36 
GeneralRe: Event handle problem in C# Pin
Phoen2530-Mar-06 1:20
Phoen2530-Mar-06 1:20 
GeneralRe: Event handle problem in C# Pin
Phoen2530-Mar-06 1:22
Phoen2530-Mar-06 1:22 
QuestionControl visible changed event Pin
malharone29-Mar-06 8:48
malharone29-Mar-06 8:48 
QuestionEnvironment.GetFolderPath doesn't return anything when running from a Windows Service Pin
montm29-Mar-06 8:07
montm29-Mar-06 8:07 
QuestionTimer and Paint Pin
CoolASL29-Mar-06 7:51
CoolASL29-Mar-06 7:51 
Hi all.
Please help me out with this.
What i am doing is that, in a small form i am displaying the current time. To keep it updated, i am using a timer and calling Invalidate on the form, after every 1000 ms, to paint the surface clean for me.
Now the problem is that, the time does not display at all. It sometimes appears, but for such a short duration that it is hardly visible.

Here's what i am doing:

class MyClock
    {
     .....
        public MyClock()
        {
            m_timer = new System.Windows.Forms.Timer();
            m_timer.Interval = 1000;
            m_timer.Tick += new EventHandler(Start);
            m_timer.Start();
        }
        private static void Start(Object o, EventArgs e)
        {
            m_timer.Stop();
            m_form.Invalidate(true);
            m_time = DateTime.Now;
            string time = m_time.Hour + ":" + m_time.Minute + ":" + m_time.Second;
            Brush b = Brushes.White;
            m_gFormGraphic.DrawString(time, new Font("Verdana", 15), b, new PointF(20, 40));
            m_timer.Start();
        }
  .....
    }


I tried adding handlers for Validating and Validated, where i set a boolean variable and display the time only when the form has been validated. But this doesnt work too.

Any pointers will be highly appreciated.

Thanks in advance.


*** Who said nothing is impossible? I have been doing it for a long time ***


-- modified at 13:56 Wednesday 29th March, 2006
AnswerRe: Timer and Paint Pin
Ravi Bhavnani29-Mar-06 8:11
professionalRavi Bhavnani29-Mar-06 8:11 
GeneralRe: Timer and Paint Pin
CoolASL29-Mar-06 17:50
CoolASL29-Mar-06 17:50 
AnswerRe: Timer and Paint Pin
Guffa29-Mar-06 8:12
Guffa29-Mar-06 8:12 
GeneralRe: Timer and Paint Pin
CoolASL29-Mar-06 17:48
CoolASL29-Mar-06 17:48 
AnswerRe: Timer and Paint Pin
Guffa29-Mar-06 21:09
Guffa29-Mar-06 21:09 
QuestionMouseEnter Problem in C# Pin
Phoen2529-Mar-06 7:26
Phoen2529-Mar-06 7:26 
QuestionHelp! Asynchronous Executions Pin
swanmynova29-Mar-06 6:28
swanmynova29-Mar-06 6:28 
AnswerRe: Help! Asynchronous Executions Pin
Judah Gabriel Himango29-Mar-06 11:19
sponsorJudah Gabriel Himango29-Mar-06 11:19 
GeneralRe: Help! Asynchronous Executions Pin
swanmynova30-Mar-06 5:18
swanmynova30-Mar-06 5:18 
GeneralRe: Help! Asynchronous Executions Pin
Judah Gabriel Himango30-Mar-06 6:30
sponsorJudah Gabriel Himango30-Mar-06 6:30 
GeneralRe: Help! Asynchronous Executions Pin
swanmynova30-Mar-06 7:54
swanmynova30-Mar-06 7:54 
QuestionFLOPS Pin
Mridang Agarwalla29-Mar-06 5:58
Mridang Agarwalla29-Mar-06 5:58 
QuestionFlags problem Pin
Mridang Agarwalla29-Mar-06 5:53
Mridang Agarwalla29-Mar-06 5:53 
GeneralRe: Flags problem Pin
Guffa29-Mar-06 6:52
Guffa29-Mar-06 6:52 
AnswerRe: Flags problem Pin
Ravi Bhavnani29-Mar-06 7:39
professionalRavi Bhavnani29-Mar-06 7:39 
GeneralRe: Flags problem Pin
Mridang Agarwalla29-Mar-06 15:17
Mridang Agarwalla29-Mar-06 15:17 
GeneralRe: Flags problem Pin
Ravi Bhavnani29-Mar-06 16:12
professionalRavi Bhavnani29-Mar-06 16:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.