3

I'm currently trying to create a screen similar to this:

Image

Using this tool to browse visual style parts and states, I found the bottom area to be a FLYOUT_LINKPANEL.

But what about the refresh button? I can't find any buttons that have the same behaviour; no background until hover. In addition, I've tried looking through the dlls in shell32 for icons replicating that refresh icon – no dice. The refresh icon is a bitmap in ExplorerFrame.dll.

I also tried giving WinSpy++ a go to poke around the window, but that won't work since it disappears immediately on disactivation.

Advice?

Community
  • 1
  • 1
unrelativity
  • 3,670
  • 6
  • 38
  • 63

2 Answers2

0

This looks like a standard Toolstrip with one refresh button.

You can use method outlined in C# ToolStrip is transparent but border is still visible? to make it transparent.

I did check %SystemRoot%\system32\shell32.dll and there is an icon very similar to this that you may be able to use.

Community
  • 1
  • 1
Raj Ranjhan
  • 3,869
  • 2
  • 19
  • 29
  • The ToolStrip button hover state is a transparent glassy effect isn't it? In the network flyout it seems to be a standard button without a background when not hovered over (and also a dotted outline, which I'd rather not try to emulate as well) – unrelativity Jan 25 '12 at 22:02
  • Although I've answered my own question, I'll award you the bounty since your answer helped me a bit with the final solution. – unrelativity Jan 26 '12 at 01:03
0

Here is an example implementation. As for the image, it can be extracted from ExplorerFrame.

The first attempt of this class simply flipped the button's FlatStyle when hovering, but the image shifted position whenever the button was hovered over.

Also, the class does not faithfully replicate that button in the flyout; it has a pressed state instead of shifting the image, and it also doesn't draw a dotted outline when it's active. That however goes against how buttons typically function in Windows, so this did not replicate the behaviour.

    public class FlyoutImageButton : Button
    {
        bool _isHovering = false;
        public FlyoutImageButton() : base()
        {
            MouseEnter += (sender, e) => _isHovering = true;
            MouseLeave += (sender, e) => _isHovering = false;
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            if (_isHovering)
                base.OnPaint(e);
            else
            {
                if (this.Image != null)
                {
                    e.Graphics.Clear(BackColor);
                    if (this.Enabled)
                        e.Graphics.DrawImageUnscaled(
                            this.Image,
                            (this.Width - this.Image.Width) / 2,
                            (this.Height - this.Image.Height) / 2);
                    else
                        ControlPaint.DrawImageDisabled(
                            e.Graphics,
                            this.Image,
                            (this.Width - this.Image.Width) / 2,
                            (this.Height - this.Image.Height) / 2,
                            BackColor);
                }
                if (this.DesignMode)
                    ControlPaint.DrawBorder(
                        e.Graphics, ClientRectangle, SystemColors.ControlDarkDark, ButtonBorderStyle.Dashed);
            }
        }
    }
unrelativity
  • 3,670
  • 6
  • 38
  • 63