We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ProgressBar text alignment in v5

Thread ID:

Created:

Updated:

Platform:

Replies:

62041 Jun 6,2007 08:31 PM UTC Jun 7,2007 12:04 AM UTC Windows Forms 2
loading
Tags: GridControl
Ossama Alami
Asked On June 6, 2007 08:31 PM UTC

The text in the progress bar is no longer aligned center to the control/cell (its aligned center to the actual value of the progress bar). This is even worse when the value is 0, as it doesn't show up at all.

I haven't modified the ProgressBar cells sample at all, yet it shows up like this.

Please let me know how to fix it.

Thanks.

progress.zip

haneefm [Syncfusion]
Replied On June 6, 2007 09:23 PM UTC

Hi Ossama,

One way you can do this by handling the DrawCell event and draw center aligned progress value string using the e.Graphics.DrawString method. Below is a code snippet that show this task.

private void gridControl1_DrawCell(object sender, GridDrawCellEventArgs e)
{
if (e.Style.CellType == "ProgressBar")
{
e.Cancel = true;
e.Style.ProgressBar.TextVisible = false;
e.Renderer.Draw(e.Graphics, e.Bounds, e.RowIndex, e.ColIndex, e.Style);
Size size = e.Graphics.MeasureString(e.Style.ProgressBar.ProgressValue.ToString() + "%", e.Style.GdipFont).ToSize() ;
Rectangle rect = GridUtil.CenterInRect(e.Bounds,size);
e.Graphics.DrawString(e.Style.ProgressBar.ProgressValue.ToString() + "%", e.Style.GdipFont, new SolidBrush(e.Style.TextColor), rect);

}
}

Best regards,
Haneef

Ossama Alami
Replied On June 7, 2007 12:04 AM UTC

Okay, I'll try that. But this looks like a bug, are you guys planning on fixing it?

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;