How to redraw or refresh the screen

I am working on a wpf application. Here I need to use System.Windows.Forms.FolderBrowserDialog in my Wpf application.

        System.Windows.Forms.FolderBrowserDialog openFolderBrowser = new System.Windows.Forms.FolderBrowserDialog();

        openFolderBrowser.Description = "Select Resource Path:";
        openFolderBrowser.RootFolder = Environment.SpecialFolder.MyComputer;
        if (openFolderBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
        {
            //some logic
            openFolderBrowser.Dispose();
        }

I launch FolderBrowserDialog, select the folder and click OK, and then launch another System.Windows.Forms.FolderBrowserDialog. My problem is that when I select the folder and click OK in this FolderBrowserDialog, the shadow of the FolderBrowserDialog remains on the screen (means that my screen is not updating). I need to minimize or resize it to remove the shadow of a FolderBrowserDialog. How can I solve this problem? Any help plz?

Edit:

I have found a solution. I called the OnRender method in my wpf Window and it worked for me. He redraws everything on the screen.

+3
2
+3

 Update();

ui.

winforms, Update() , . . , . :

System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
t.Interval = 1000; // specify interval time as you want 
t.Tick += new EventHandler(timer_Tick);
t.Start();

void timer_Tick(object sender, EventArgs e)
{
  label1.text = DateTime.Now.ToString("h:mm:ss")); 
  Update(); //this will refresh the form and label text is updated.
}

label1.text .

-1

Source: https://habr.com/ru/post/1740270/


All Articles