WALKTHROUGH 2 — DESIGNING GlossContourButtons™, DEPLOYING AS ContourServers™ OR ContourClients™

While its class name certainly refers to extended capabilities, GlossContourButton™ was designed to fill both flat or contoured button roles more efficiently other button alternatives. In other words, GlossContourButton™ was designed to be the basic button of your UI development efforts, even in flat, stand-alone form.

GlossContourButtons™ as ContourClients™ of their parent GlossContourSurface™. Besides expediting group drawing, ContourClient™ deployment eliminates substantial individual button configuration.

As with GlossContourSurface™, most of your work with GlossContourButton™ will involve little configuration, because you will want to comply with your own cohesive style, and because most of the prototypes you will build will be based on SystemColors.Control.

  1. A productive technique is to build a relative few GlossContourButton™ prototypes, from which specialized buttons are derived.
  2. Finished prototypes are dragged to your ToolBox.
  3. From your ToolBox, you drop prototype descendants onto a form again to build finished classes marked by your house logo, client logos, glyphs, captions, and layout.
  4. Finished library classes too are dragged to your ToolBox, from which you readily populate forms at will.

ContourServer™ AND ContourClient™ ROLES

In each of these groups, the button on the left can serve as a ContourServer™ to clients on the right — eliminating manual or programmatic configuration and expediting group drawing speed.

GlossContourButtons™ as typical ContourClients™ of a GlossContourSurface™.

Both GC buttons and surfaces can serve as ContourServers™ to GlossContourButton™ instances. In the case of button ContourServers™ however, the server typically does not parent its clients. Instead, clients replicate the server at whatever position they occupy (as in the tinted button groups above).


This page steps through a subset of regular documentation topics to introduce the basic modes of graphic configuration:

  1. Colors.Fore — base color.
    1. R, G, and B offsets — tint and luminosity adjustments to Colors.Fore.
  2. ContouredRegions — what regions are contoured.
  3. LuminosityDifferentials.Gloss — luminosity of gloss effects.
    1. Sharpen effects applied to the margin between glossed and/or contoured regions.
    2. AutoEliminateWhiteOut and AutoEliminateWhiteOut_MaxLeastRGB.
  4. LuminosityDifferentials.GlyphGlare — glare effects applied to glyphs


Color is manipulated by setting the base color, and optionally by modifying the base color with R, G, and B offset properties:

public Color Colors.Fore

Default = SystemColors.Control.

Declared in GCServer_Base™.

Buttons drawn from the color, SystemColors.Control.

Specialized library OK button, distinguished by a blue-green Colors.Fore.


A black GlossContourButton™ drew our site logos.

Base color.

public Int32 Colors.Offset.R, G, or B

Default = 0, 0, 0 of -255...255 inclusive.

Declared in GCServer_Base™.

Declared in GlossContourButton.

Button groups distinguished by tinting SystemColors.Control (top) — red, green blue.

OK button colored by tinting SystemColors.Control.

Colors.Offset.R offsets Colors.Fore.R, Color_Base_DN.R, Colors.BorderDown.R, and Colors.BorderFocused.R.

R/G/B "offsets" are generally used,

  1. To offset luminosity.
  2. To tint a given button or group of buttons.

    Colors.Offset.R == -10, Colors.Offset.G == 5, and Colors.Offset.B == 5 for instance will produce a blue green tint without altering luminosity.

Explicit Colors.Fore prescriptions avoid graying.

Where it is practical not to derive tinted colors from system constants, explicitly set Colors.Fore for gray free results.


Contour effects are manipulated by specifying what regions to contour, by specifying the rate of contour gradients, and by specifying the radii of contours. If a ContourServer™ is specified, contour effects are derived from the server.

public enumContouredRegions ContouredRegions

public enum enumContouredRegions { None = 0, TopAndBottom = 1, TopOnly = 2, BottomOnly = 3 }

Default = enumContouredRegions.TopAndBottom.

Declared in GCServer_Base™.

From left to right: enumContouredRegions.None, TopAndBottom, BottomOnly, and TopOnly.

GlossContourSurface™ RadiusedEdge ContouredRegions set to TopAndBottom.

GlossContourSurface™ RadiusedEdge ContouredRegions set to BottomOnly.

Regions to which contour effects are applied.

public GCServer_Base ContourServer

Default = null.

Declared in GCServer_Base™.

Multiple GlossContourButtons™ in ContourClient™ roles.

Assigning a GCServer_Base descendant to a client ContourServer™ property causes the client to derive its drawing data from computations already performed by the ContourServer™. Subscription, detachment, and role behavior are fully automated as a consequence of assignments to this property. If the server is a GCSurface™, relative vertical position of the ContourClient™ within the vertical bounds of the ContourServer™ dictates the derived data and results in the client assuming the contours of the server at the relative vertical position. If the ContourServer™ is a GCButton™, client buttons assume the surfaces of the server. If the height of the server is not >= that of the client, or if the bounds of a child client do not fall within the bounds of the parent server, the client reverts to drawing itself.

For example, if a GlossContourButton™ is a child and ContourClient™ of a GlossContourSurface™ of Size( 200, 100 ) and the GlossContourButton™ occupies Bounds( 0, 74, 26, 26 ), the ContourClient™ assumes the contours of the GlossContourSurface™ Rectangle( 0, 74, 26, 26 ). Whenever and wherever within the ContourServer's™ vertical bounds the button is moved, its re-drawing is automated. If the client is moved out of the vertical span of the server, the client simply reverts to drawing itself.

Top: A GlossContourButton™ configured to ContouredRegions.TopOnly.
Bottom: A GlossContourSurface™ configured to ContouredRegions.BottomOnly acts as a ContourServer™ to 5 child GCButtons™.

When ContourClient™ 1 is moved to position 2, it automatically assumes the contours of its relative position by re-drawing itself from pre-computed server data.
Down states (3) likewise derive concave contours from pre-computed data.

  1. Bounds:
    1. ContourClient™ child controls must occupy bounds belonging to the vertical scope of the parent server's bounds: the Y bound of a ContourClient™ must be greater than or equal to 0; and the bottom bound of the client cannot exceed the bottom bound of the server.
    2. No error is raised if this out-of-drawing-data-bounds condition is violated. Instead, the client simply reverts to drawing its own contours.
  2. Drawing suspension and resumption:
    1. It is the application's responsibility to resume any suspended drawing of a client which is detached from a ContourServer™. ContourServers™ do not automatically unsuspend drawing when a ContourClient™ unsubscribes to its server functionality, because it may be the intention of the application to reconfigure the unsubscribing client before drawing.:

      Ordinarily, clients remain subscribed to servers for the life of application sessions, while drawing suspension and resumption are invoked automatically on clients by suspending and resuming the server instance only.

      If however you detach a client from its server at runtime, you must understand the ramifications for suspended drawing (if any).

      If GCButton1.ContourServer == GCSurface1, and GCSurface1.Paint_SuspendAll( ) has been called on the server, this results in broadcasting the SuspendAll condition to all clients. Thus this is equivalent in respect to GCButton1, of calling GCButton1.Paint_SuspendAll( ). Afterward then, if null is assigned to GCButton1.ContourServer, this will leave GCButton1 in a SuspendAll state — GCButton1 will not draw its own surfaces until GCButton1.Paint_ResumeAll( ) is called.

    2. Although only considerably specialized purposes will ever unsubscribe ContourClients™ from ContourServers™, it is important to understand that ContourServers™ broadcast their condition to clients as a necessary means of minimizing computation intensity. This useful behavior prescribes a style of working with the server, versus redundantly iterating clients.

public Int32 LuminosityDifferentials.PerPixelOfContour

Default = 4 of 1...10 inclusive.
Initialized to 2 in GlossContourSurface_UnInit™.

Declared in GCServer_Base™.

LuminosityDifferentials.PerPixelOfContour == 4 (left), 8 (right).

Prescribes the luminosity differential per pixel of contour effect, or vertical rate of contour luminosity.

public Int32 RadiusYSpan

Default = 13 of 2...32 inclusive.

Declared in GCServer_Base™.

Minimal radii in various focused, down, and up states.

RadiusYSpan can be understood to mean "draw radiused contours over RadiusYSpan much of the Height."

  1. Regardless of the RadiusYSpan value, the maximum drawn radius will be no more than Height/2.
  2. Radii intersecting at the midsection are drawn as a continuous, homogeneous curve.
  3. A maximum limit must be imposed because excessive radii require exceeding the range of luminosity.


Gloss is manipulated by LuminosityDifferentials.Gloss. Undesirable white-out is automatically accounted for by AutoEliminateWhiteOut™ properties. Glyphs can be treated with additional gloss with the LuminosityDifferentials.GlyphGlare property.

public Boolean AutoEliminateWhiteOut

Default = false.
Initialized to true in GlossContourButton_UnInit™ (Default = true in GlossContourButton_UnInit™ descendants).

Declared in GCServer_Base™.

White-out engendered by user configuration (left).
Right, unintended white-out is automatically adjusted out by setting AutoEliminateWhiteOut™ to true.

AutoEliminateWhiteOut downwardly adjusts base color luminosity so that the least RGB component of color is no greater than AutoEliminateWhiteOut_MaxLeastRGB. See WORKING WITH ADVANCE GlossContourButton™ AND GlossContourSurface™ for related information.

public Int32 AutoEliminateWhiteOut_MaxLeastRGB

Default = 255 of 223...255 inclusive.

Declared in GCServer_Base™.

AutoEliminateWhiteOut == false (left).
AutoEliminateWhiteOut == true (center and right).
AutoEliminateWhiteOut_MaxLeastRGB == 245 (right).

AutoEliminateWhiteOut downwardly adjusts base color luminosity so that the least RGB component of color is no greater than AutoEliminateWhiteOut_MaxLeastRGB. For example, if Colors.Fore.R == 200, Colors.Fore.G == 190, and Colors.Fore.B == 180 and AutoEliminateWhiteOut_MaxLeastRGB == 245, the maximum B of the glossed region will be no greater than 245. See WORKING WITH ADVANCE GlossContourButton™ AND GlossContourSurface™ for related information.

public Int32 LuminosityDifferentials.Gloss

Default = 50 of 0...127 inclusive.
Initialized to 0 in GlossContourSurface_UnInit™.

Declared in GCServer_Base™.

LuminosityDifferentials.Gloss == 10 (left), 32 (right), with AutoEliminateWhiteOut™ set to true.

Prescribes the magnitude of the gloss effect.

  1. Glossed region luminosity == contour luminosity + LuminosityDifferentials.Gloss.
  2. Set to 0 for no gloss effect.

public Int32 LuminosityDifferentials.GlyphGlare

Default = 50 of 0...127 inclusive.

Declared in GCServer_Base™.

LuminosityDifferentials.GlyphGlare == 0 (left), 100 (right).

Luminosity differential applied in rendering glare over glossed regions of glyphs.

  1. Set to 0 for no glare effect.

These are the few topics you must be familiar with to expertly manipulate graphic effects.


© Copyright 1995-2007, by ADVANCE Information Systems, Inc. ALL RIGHTS RESERVED.Copyright 1995-2007, by ADVANCE Information Systems, Inc. ALL RIGHTS RESERVED.

Firefox™.Best viewed in Mozilla Firefox™.