Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Progress Bar (Read 1890 times)
Pac
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 9
Joined: Aug 16th, 2007
Progress Bar
Jan 8th, 2010 at 12:36pm
Print Post  
Hi.  I use the following code to overlay a progress bar onto a TableNode

[code]
               float totalWidthBy80Percent = Percent(80) * tableNode.Bounds.Width;                         // This width is that taken up by the first four (of total five) columns
               float xPos = tableNode.Bounds.Left;                                                         // The left Pos is the left hand side of the table
               float barYPos = tableNode.Bounds.Top + (Percent(20) * tableNode.Bounds.Height);           // Top of ProgressBar control host is 20 percent down the table node
               float barHeight = 4;
               float barHeightAsPercent = (barHeight * 100) / tableNode.Bounds.Height;

               ControlNode host = new ControlNode(fc);
               host.Bounds = new RectangleF(xPos, barYPos, totalWidthBy80Percent, barHeight);
               fc.Diagram.Nodes.Add(host);

               host.HandlesStyle = HandlesStyle.Invisible;
               host.AttachTo(tableNode, 0, 20, 80, 20 + barHeightAsPercent);

               ProgressBar progressBar = (ProgressBar)host.Control;
               progressBar.BackColor = Color.PaleGreen;
               progressBar.ForeColor = Color.RoyalBlue;
               progressBar.Minimum = 0;
               progressBar.Maximum = 100;
               progressBar.Step = 1;
[/code]

This works ok however I have a cosmetic problem.  When I use the scrollbars to scroll the document the progress bar control moves ahead (or out of sync) to the TableNode.  By the end of the scrolling the TableNode and scrollbar move into correct position with respect to each other so they are only out of sync during the scroll operation but this does not look good.

Is there any way around this issue or do I need to look at a totally different approach to encorporate a progressbar into a TableNode.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Progress Bar
Reply #1 - Jan 8th, 2010 at 1:03pm
Print Post  
Hi,

It could be better to do that with custom drawing. If you set table.CustomDraw = Additional, the control raises the DrawNode event just before rendering the caption string. You might handle it by calling e.Graphics.DrawRectangle to show the progress.

If you prefer real progressbars for some reason, check this thread:
http://mindfusion.eu/Forum/YaBB.pl?board=fcnet_disc;action=display;num=122890284...

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint