ConstExcel's model — and this one — treats a border as a PEN plus a set of edges, and the panel is laid out in that order: the pen first (color, then line style, since our line styles are drawn IN the color), then the presets, then the diagram with a button per edge around it, the way the Format Cells dialog arranges them.
Every one of those buttons draws its own icon with the pen (see BorderTemplateIcon), so the
whole panel restyles as the color or the line changes and each button previews its own edit.
The pen is panel state, not cell state: it is what the next click will draw, so it survives moving the selection, exactly as the Format Cells dialog's does.
Everything reads the SELECTION's border rather than the anchor cell's — inner rules only exist at range scope.
The Border tab of the format pane.