HypernovaDesktop Components · docs
Binarymission
WinForms › Header Control › BinaryScrollablePanel

BinaryScrollablePanel

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.NavigationControls

A scrolling, gradient-filled panel that fills the client area of a BinaryHeaderControl, for pane content that can be longer than the pane.

public class BinaryScrollablePanel : Panel

Inherits from / implements: Panel

Remarks

What it is for

BinaryHeaderControl does not scroll (its BinaryHeaderControl.AutoScroll is always false). Add one of these panels to the header control and put the pane's controls on the panel: it scrolls when they extend beyond it, and is painted in the same colour scheme as the header control so that the two look like one surface.

How it behaves

Examples

var projectsPane = new BinaryHeaderControl { Dock = DockStyle.Right, Width = 280, HeaderText = "Projects" };
var scroller = new BinaryScrollablePanel();

int top = 8;
foreach (string project in new[] { "Website redesign", "Payroll migration", "Q3 audit", "Mobile app" })
{
    scroller.Controls.Add(new CheckBox { Text = project, Left = 8, Top = top, Width = 220, BackColor = Color.Transparent });
    top += 28;
}

projectsPane.Controls.Add(scroller);   // fills the pane and takes its colour scheme
Controls.Add(projectsPane);            // in the form's constructor

See also

Members at a glance

Constructors
BinaryScrollablePanelInitialises a new BinaryScrollablePanel with scrolling switched on, no border and a white Control.BackColor.
Properties
ColorSchemeGets or sets the built-in palette the panel's background gradient is drawn in.
EndColorForGradientRenderingGets or sets the colour the panel's background gradient ends with.
GradientDrawingDirectionGets or sets the direction in which the panel's background gradient runs.
StartColorForGradientRenderingGets or sets the colour the panel's background gradient starts with.
Methods
OnEnterRaises the Control.Enter event, first redrawing the frame of the containing BinaryHeaderControl when in the designer.
OnMouseWheelScrolls the panel, raises the Control.MouseWheel event and redraws the background so that the gradient stays fixed to the visible area.
OnPaintPaints the background gradient and raises the Control.Paint event.
OnPaintBackgroundDoes nothing: the background gradient is painted in OnPaint, which avoids flicker.
OnParentChangedFits the panel to a new BinaryHeaderControl parent – filling its client area and taking its ColorScheme – and raises the Control.ParentChanged event.
OnResizeRedraws the parent, if any, and raises the Control.Resize event.
WndProcProcesses the panel's window messages, repainting the background as the panel scrolls so that the gradient stays fixed to the visible area.

Constructors

BinaryScrollablePanel

public BinaryScrollablePanel() : base()

Initialises a new BinaryScrollablePanel with scrolling switched on, no border and a white Control.BackColor.

Remarks

The scheme colours are applied when the panel is added to a BinaryHeaderControl or when ColorScheme is set; until then the gradient runs from SystemColors.ControlDarkDark to white.

Properties

ColorScheme

public ColorScheme ColorScheme

Gets or sets the built-in palette the panel's background gradient is drawn in.

Value
The default is ColorScheme.Blue; a panel added to a BinaryHeaderControl takes that control's scheme.
Default
Blue
Remarks

Choosing a scheme overwrites StartColorForGradientRendering and EndColorForGradientRendering. With ColorScheme.None the panel copies the background colours of the BinaryHeaderControl it is in, so that the two match; outside a header control, ColorScheme.None leaves the colours as they are.

The header control sets this property on its panels whenever its own scheme changes.

See also

EndColorForGradientRendering

public Color EndColorForGradientRendering

Gets or sets the colour the panel's background gradient ends with.

Value
The default comes from ColorScheme: RGB(195, 219, 249) for the ColorScheme.Blue scheme.
Designer category
Color
See also

GradientDrawingDirection

public LinearGradientMode GradientDrawingDirection

Gets or sets the direction in which the panel's background gradient runs.

Value
The default is Vertical: from StartColorForGradientRendering at the top to EndColorForGradientRendering at the bottom.
Designer category
Drawing

StartColorForGradientRendering

public Color StartColorForGradientRendering

Gets or sets the colour the panel's background gradient starts with.

Value
The default comes from ColorScheme: RGB(128, 167, 225) for the ColorScheme.Blue scheme.
Designer category
Color
Remarks

The panel paints this gradient instead of Control.BackColor. Choosing a ColorScheme, or adding the panel to a BinaryHeaderControl, overwrites the colour, so set it afterwards.

See also

Methods

OnEnter

protected override void OnEnter(EventArgs e)

Raises the Control.Enter event, first redrawing the frame of the containing BinaryHeaderControl when in the designer.

Parameters
e
The data for the event.

OnMouseWheel

protected override void OnMouseWheel(MouseEventArgs e)

Scrolls the panel, raises the Control.MouseWheel event and redraws the background so that the gradient stays fixed to the visible area.

Parameters
e
The data for the event.

OnPaint

protected override void OnPaint(PaintEventArgs e)

Paints the background gradient and raises the Control.Paint event.

Parameters
e
The data for the event.
Remarks

At run time, inside a BinaryHeaderControl, the panel is docked to fill it here if it is not already.

OnPaintBackground

protected override void OnPaintBackground(PaintEventArgs pevent)

Does nothing: the background gradient is painted in OnPaint, which avoids flicker.

Parameters
pevent
The data for the event; not used.

OnParentChanged

protected override void OnParentChanged(EventArgs e)

Fits the panel to a new BinaryHeaderControl parent – filling its client area and taking its ColorScheme – and raises the Control.ParentChanged event.

Parameters
e
The data for the event.
Remarks

In any other parent the panel is undocked.

OnResize

protected override void OnResize(EventArgs e)

Redraws the parent, if any, and raises the Control.Resize event.

Parameters
e
The data for the event.

WndProc

protected override void WndProc(ref Message m)

Processes the panel's window messages, repainting the background as the panel scrolls so that the gradient stays fixed to the visible area.

Parameters
m
The window message to process.