My forms keep flashing but I have figured out how to keep the form updated by actually having a reference to the form created.
Below is the basis of the two classes I have,
Main File
namespace BlackJackForm{ static class Program { public static class Globals { public static string text; public Form1 Main_Form(); } [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Idle += App_Idle; Globals.Main_Form = new Form1; Application.Run(Globals.Main_Form); } static void App_Idle(object sender, EventArgs e) { Globals.Main_Form.Refresh_From_Idle("something"); } }}
Form File
namespace BlackJackForm{ partial class Form1 { private void InitializeComponent() { this.Label = new System.Windows.Forms.Label(); } public void Refresh_From_Idle(string T) { this.Label.Text = T; this.Refresh(); } public System.Windows.Forms.Label Label }}
All I wanted was to be able to trigger a change on the forms so when the program idle function is called and it decides the player needs a new card the form would change or the time label would keep ticking.
With the above the form is updating but will only update if the mouse moves or if I drag the window it will only then start counting. The idle function should keep firing constantly I'd of thought when no other actions are being performed but it seems to be the oposite only when actions are being performed on the form.
How would I correctly setup the idle function so it keeps firing when the program is idle ? and how do I stop the form from flashing ?
Please help its driving me nuts ><.
[Edited by - fishleg003 on February 17, 2008 3:19:15 PM]