Computing height of status bar panel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm embedding a progress bar control on one of the panels of my status bar (via the controls property). I can easily set the prog bar to the same width of the panel but setting its height equal to the status bar's makes it taller than its panel (and panel has no height property, AFAIK). Any elegant way of querying the height of a status bar panel. Of course, I can do simple trial-and-error but that won't be elegant at all for me. Thanks =)
 
One way to do this is to set the desired StatusBarPanel's "Style" to
"OwnerDraw". Then hook into the StatusBar's "DrawItem" event and the code
should look like the following.

private void statusBar1_DrawItem(object sender,
System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent)
{
if ((sbdevent.Panel == this.statusBarPanel1) && (this.progressBar1.Bounds
!= sbdevent.Bounds))
{
this.progressBar1.Bounds = sbdevent.Bounds;
}
}

--
Tim Wilson
..Net Compact Framework MVP

jester said:
I'm embedding a progress bar control on one of the panels of my status bar
(via the controls property). I can easily set the prog bar to the same width
of the panel but setting its height equal to the status bar's makes it
taller than its panel (and panel has no height property, AFAIK). Any elegant
way of querying the height of a status bar panel. Of course, I can do simple
trial-and-error but that won't be elegant at all for me. Thanks =)
 
* =?Utf-8?B?amVzdGVy?= said:
I'm embedding a progress bar control on one of the panels of my status
bar (via the controls property). I can easily set the prog bar to the
same width of the panel but setting its height equal to the status bar's
makes it taller than its panel (and panel has no height property,
AFAIK). Any elegant way of querying the height of a status bar panel.

<URL:http://www.google.de/[email protected]>
 
Back
Top