 |
|
|
 |
|
|
it`s pretty easy to do it, just have a look at the code.
what you need to do is create your own progressbar shape that will look like a trapezium, just add the coordinates that you need and that`s it.
Gil
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
The control was working well when I was using VS2003 and .NET 1.1. I have just switched to VS2005/.Net 2.0 and the percent text is not centralized. I have tried to make to modifications to fix it. Here is the code:
private void DrawPercent(Graphics G) { // very ugly way to do it, but it works well Label PercentLabel = new Label(); PercentLabel.AutoSize = true; PercentLabel.Font = this.Font; PercentLabel.Text = _Position.ToString() + "%";
SizeF TextSize = G.MeasureString(PercentLabel.Text, this.Font);
float left = this.ClientRectangle.X + (this.ClientRectangle.Width - TextSize.Width) / 2; float top = this.ClientRectangle.Y + (this.ClientRectangle.Height - TextSize.Height) / 2;
SolidBrush mTextBrush = new SolidBrush(this.ForeColor); G.DrawString(PercentLabel.Text, this.Font, mTextBrush, left, top); mTextBrush.Dispose();
}
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi
i'm sending a fixed .Net 2.0 version right now but you can change this function to:
private void DrawPercent(Graphics G) { SizeF TextSize = G.MeasureString(Text,Font); SolidBrush TextBrush = new SolidBrush(ForeColor); float Left, Top;
Left = (Width - TextSize.Width) / 2; Top = (Height - TextSize.Height) / 2; G.DrawString( Text, Font, TextBrush, new PointF(Left, Top));
TextBrush.Dispose(); }
also update this propertie:
public int Position { get { return _Position; } set { if (value > 100) return; if (value < 0) return; _Position = value; Text = _Position + "%"; this.Invalidate(); } }
thanks for the commet.. Gil
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello, I threw together a quick app to test your progress bar. Here's my code that deals with the progress bar:
Me.ProgressBar1.Value = CInt(Me.dblPercentage) Me.AdvancedProgressBar1.Position = Me.ProgressBar1.Value
The percentage and position doesn't show any change until the end of my loop. Am I doing something wrong?
Here's a screenshot.
Thanks
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
Yes, I can. Thanks for your help! It will be tonight before I can though as I'll need my laptop to get the files.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
found it .. it was in the spam folder..
anyway all you have to do is change Me.AdvancedProgressBar1.Invalidate() with Me.AdvancedProgressBar1.Refresh()
(even that when you change the AdvancedProgressBar.Position value it already calls Refresh() .. weird)
btw this would make you code very slow couse it makes it redraw anyway so you need to change that whole block to
If Not CInt(Me.dblPercentage) = Me.AdvancedProgressBar1.Position Then Me.ProgressBar1.Value = CInt(Me.dblPercentage) Me.AdvancedProgressBar1.Position = Me.ProgressBar1.Value Me.AdvancedProgressBar1.Refresh() End If
that's all bye
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
hi
i can't really understand you commet becouse "i can not use this DLL in VB.NET" doesn't say a thing (where is the problem), i tried loading this dll in VB (into the toolbox by right clicking Add/Remove Items -> Browse -> select the AdvancedProgressBar dll) and it worked just fine..
also check if you are using VB 6 which isn't .NET this might cause you the problem
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
i cannot download the source code
can you send it to the following mail bnaya@wisemobility.com ?
Bnaya Eshet
.NET Expert and Chief Architect at Wise Mobility
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Hi, it's a good control. I liked the "snake" one  To improve it, you should add the line
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
in the OnPaint() method, in order to smooth the edges (the teeth like borders).
You have several values in the SmoothingMode enumeration, where "HighQuality" is the most powerfull (I think)...
See you Matías (from Uruguay)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |