How i can refresh the progress bar after every copy?I try different things without success.....The progress bar will only after the for loop are finished update to 100%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
try { double x=0,y=0,count=0; for (; count < copyCountTotal; ) { if ((copyCountX * (xSize + copyOffsetX)) > (x * (xSize + copyOffsetX))) { corelApp.ActiveSelection.Duplicate(x * (xSize + copyOffsetX), y); count++; x++; } else { x = 0; if (copyCountY <= ((ySize+copyOffsetY)/y)) { y -= ySize + copyOffsetY; } else { corelApp.ActiveDocument.InsertPages(1, false, 1); } } //os.OrderToFront(); Progress_Bar.Value = ((count / copyCountTotal)*100); TB_Info.Text = ((count / copyCountTotal) * 100).ToString(); corelApp.EventsEnabled = true; //corelApp.Optimization = true; //corelApp.Refresh(); corelApp.ActiveWindow.Refresh(); Thread.Sleep(200); } corelApp.ActiveSelection.Delete(); //corelApp.ActiveSelection.Move(-xSize * 2, 0); }
alternatively, you can use a Label with a colored background and change its width
The problem is my debug label "TB_Info.Text" also not refresh. It shows 100% only when is finish.
use DoEvents inside loop to allow CorelDraw perform internal operations, including redrawing controls on the form
DoEvents is deprecated in WPF