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