Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6815417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:48:16+00:00 2026-05-26T20:48:16+00:00

Im using Visual Studio 2010 Ultimate and Im trying to convert some images using

  • 0

Im using Visual Studio 2010 Ultimate and Im trying to convert some images using a progress bar and two labels but the text of both labels is not shown and the program just shows the labels with white background.

enter image description here

p.s. The labels backcolor is “Control” (not transparent)

I have two forms 1st the “Main” form and the “ProgressDialog” form

in the main form when I click my “Save” button

//copy the filenames to a new array to sort them
string[] FileNames = openDialog.FileNames;
Array.Sort(FileNames);                

//create an instance of my progress dialog
ProgressDialog progress = new ProgressDialog(this, 100/FileNames.Length);
progress.ShowProgress();

//save all the files in the array
for (int i = 0; i < FileNames.Length; i++)
{    
    //call the SaveImage method 
    SaveImage(FileNames[i], 597, 412, Fill);

    //increase the progresbar and set the label text of the progress dialog to the filename
    progress.Increase(FileNames[i]);
}

progress.Close();//close progress dialog and re-enable the main form

…and here the code of my “ProgressDialog” form:

Bar: name of the progress bar

Comment: name of the label with the image path as text

private Form SenderForm;// the "Main" form
private int Step; //value to increase in the progress bar

public ProgressDialog(Form sender, int step)//constructor
{
    InitializeComponent();

    SenderForm = sender;
    Step = step;
}

//disable cose button
private const int CP_NOCLOSE_BUTTON = 0x200;
protected override CreateParams CreateParams
{
    get
    {
        CreateParams myCp = base.CreateParams;
        myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
        return myCp;
    }
}

//re-enable the "Main" form
private void ProgressDialog_FormClosed(object sender, FormClosedEventArgs e)
{
    SenderForm.Enabled = true;
    SenderForm.Activate();//activate form
} 

//increase the value of the progressbar
public void Increase( string comment=null, int step=0)
{
    //if step is 0 -> use the Step of the constructor
    if (step==0) step = Step;

    //if the comment (the current file name) is != of null
    if (comment!=null)
        Comment.Text = comment;//use the comment of the parameter

    //increase progressbar
    Bar.Value += step;            
}

//show "ProgrssDialog" form
public void ShowProgress()
{
    this.Show();
    SenderForm.Enabled = false;//disable the main form
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:48:16+00:00Added an answer on May 26, 2026 at 8:48 pm

    It happens because mainthread is too busy to update label in ui
    U should do the process in a thread to prevent the UI hangs
    Have look to this postC# question on preventing GUI from becoming sluggish when using backgroundworker/thread

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Visual Studio 2010 Ultimate Beta 2. What is the relevant namespace/classes
I'm running Windows 7 Ultimate (64 bit) using Visual Studio 2010 RC. I recently
I'm using the Visual Studio 2010 RC for .NET 4.0 and I'm trying to
I am using VS 2010 Ultimate and I am just trying some stuff with
I am using Visual Studio 2010 Ultimate Edition and I've installed the Beta 2
I'm working on a solution in Visual Studio 2010 Ultimate that contains two C#
Environment: Visual Studio Ultimate 2010 Windows XP WPF Desktop Application using .NET 4.0 We
I'm making a Windows Forms application in Visual Studio 2010 Ultimate, but can't get
I'm using Visual Studio 2010 Ultimate, and it seems that I cannot suppress warnings
I am using Visual Studio 2010 Ultimate and I'm on Windows Server 2003 with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.