Search code examples
c#compact-frameworkprogress-bar

Progress bar click (Compact framework)


I'm using a progress bar to display the battery status. If the user clicks on the progress bar i want to display a popup with details.

Excluding the solution that requires checking if the click coordonates is in the bounds of the progress bar has anyone found another solution or a workaround to this?


Solution

  • OK, an easier way to do the custom control is to just start with a UserControl, drop a ProgressBar on it and dock it so that it fills the UserControl, then expose the ProgressBar as a public property of the UserControl, so that your code would say

    myProgressBar1.ProgressBar.Max = 100
    

    instead of

    progressBar1.Max = 100
    

    Then just use the Click event of the usercontrol to show the details (I think you might have to disable the inner ProgressBar for the click to work, but that shouldn't affect the appearance of the progress bar).

    This way your user control looks exactly like a regular progress bar (and, hence, like ass). :)