Clock event declared as process variable to invalidate System.Threading.Timer clock

Source: Internet
Author: User

The small module of this project is to draw a label control into the Tablepayoutpanel form,

The middle uses the clock, the event (with the return value), the hash table. Because the clock definition in the Form1 startup constructor caused the Form1, after the start of the clock to stop running, the result of drawing a label to half stop, look for problems, very big head, after the great God help, found the problem of process variables, in this summary. Mainly see the red letter marked out part

Public Form1 ()
{
InitializeComponent ();

Declaring a binding event to start
Onecodeeventclass EDT = new Onecodeeventclass ();
Onecodeevent + = new Onecodehander (mainpanel_paint);
System.Threading.Timer Timer = new System.Threading.Timer (new TimerCallback (onecodetest), NULL, 0, +);

}

The procedure should read:

public partial class Form2:form
{
Public System.Threading.Timer Timer; Added this line, declaring the global variable outside the constructor
Public Form2 ()
{
InitializeComponent ();

Initialize the color hash table 1 for unused, 0 for use, and initially all for 1.
Startcolorhashble ();
Clock activation Start Event return value string to Mainpanel_paint
Onecodeevent + = new Onecodehander (mainpanel_paint);
timer = new System.Threading.Timer (new TimerCallback (onecodetest), NULL, 0, +);

pointxy.x = 0;
POINTXY.Y = 0;
}

Results The program runs normally, thank you for helping me debug the Great God carry. There are many good people in the world. Red envelopes are launched.

Clock event declared as process variable to invalidate System.Threading.Timer clock

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.