Hello
Over to the next problem; how do i update the image one time per second?
The timer is working, but when i complie it says to me that i have to use EventHandler() instead of directly MainBox.Refresh(), so how do i do one void/subclass or something that i could use "MainBox.Refresh()" in?
Thanks a lot for the previous answers!
Code:#region using using System; using System.Drawing; using System.Windows.Forms; using System.IO; using System.Net; #endregion public class MainsClass { public static void Main() { new InterfaceClass(); } } public class InterfaceClass { public InterfaceClass() { Form MainWindow = new Form(); PictureBox MainBox = new PictureBox(); MainWindow.Text = "Segel Kamera"; MainWindow.StartPosition = FormStartPosition.CenterScreen; MainWindow.Width = 640; MainWindow.Height = 480; WebRequest reg = WebRequest.Create("http://raceoffice.segel.aland.fi:81/record/current.jpg"); Stream stream = reg.GetResponse().GetResponseStream(); Bitmap img = new Bitmap(stream); MainBox.BackgroundImage = img; MainBox.Width = 640; MainBox.Height = 480; MainBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; Timer MainTimer = new Timer(); MainTimer.Interval = 1000; MainTimer.Start(); MainTimer.Tick += MainBox.Refresh(); MainWindow.Controls.Add(MainBox); MainWindow.ShowDialog(); } }



LinkBack URL
About LinkBacks


