Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
E

eligazit

@eligazit
About
Posts
3
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Mouse wheel settings API
    E eligazit

    Does anyone knows the API to set the mouse wheel 'number of lines' per scroll property? I want to create a small exe program that changes it like the windows settings does. Thanx.

    C# json question

  • thread safe calls
    E eligazit

    To update GUI with the BackgroundWorker, you need to do the following steps: 1. When creating the wroker: public void InitWorker() { worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); worker.DoWork += new DoWorkEventHandler(worker_DoWork); } Note that I've creating new event handler to update GUI, when ever I want to set something on the GUI, I should call the ReportProgress(...) method of the worker: void worker_DoWork(object sender, DoWorkEventArgs e) { // Some long operation // ..... Thread.Sleep(2000); // Update GUI worker.ReportProgress(30); // Some long operation // ..... Thread.Sleep(2000); // Update GUI worker.ReportProgress(60); // Some long operation // ..... Thread.Sleep(2000); // Update GUI worker.ReportProgress(90); } And, on the ReportProgress handler, I can update the GUI as I want, this is beacuse the worker handles moving the OS the the right thread so it is not my problem... void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { Label label; label.Text = e.ProgressPercentage + "%"; } Note that on the ReportProgress you can send an object that will be set on the ProgressChangedEventArgs (State), in this property you can set all the values you want to update on the GUI (other than the precentage).

    C# tutorial question

  • thread safe calls
    E eligazit

    If you use the 2.0, try to use the BackgroundWorker, it gives the abilty to update without the cross-thread exception.

    C# tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups