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.
eligazit
Posts
-
Mouse wheel settings API -
thread safe callsTo 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).
-
thread safe callsIf you use the 2.0, try to use the BackgroundWorker, it gives the abilty to update without the cross-thread exception.