Click here to Skip to main content
Click here to Skip to main content

A Collection of Simple Widgets

, 5 Feb 2014
Rate this:
Please Sign up or sign in to vote.
A collection of simple .NET 2.0 controls and utilities.

Introduction

This is release 1.0.1 of the library. It fixes some documentation tags missing in the previous release.

The SimpleWidgets Library is a collection of simple, yet useful, .NET 2.0 controls and utilities. They are primarily intended for use in more complex controls and widgets.

All public and protected classes, methods and properties and fully documented using standard C# XML documentation comments. The project includes a HTML help file. Refer to the Overview section in the help file for more details on using the library.

The SimpleWidgets_100_Library download includes:

GAW.SimpleWidgets.dll Library.
GAW.SimpleWidgets.chm Help file.

The SimpleWidgets_100_Demo download includes the above files, as well as:

GAW.SimpleWidgetsTestApp.exe Sample app demonstrating most of the classes in the library.
GAW.ColorCircleDemo.exe Sample app for generating color circles, demonstrating the HSColor.GenerateCircle() method.

The SimpleWidgets_100_Source download includes the source for all of above programs, as well as the necessary files for building the help file.

Using the Library

There are many classes in the SimpleWidgets library. The main class are Filler, Filler2, Line, and Polygon. They all provide full Visual Studio Designer support.

Filler

The Filler class is an area filler class. It supports the following fill types:

  • Empty fills,
  • Solid fills (using a single color),
  • Hatched fills (using a hatch color, hatch pattern, and background color),
  • Linear gradient fills (using any number of colors), and
  • Path gradient fills.

Linear gradient fills have a direction, specified by an angle value. Path gradient fills radiate out from a center point, either as a rectangle or as an ellipse. For example, this is a gradient with an angle of 57 degrees:

Include a public type of Filler in a control and it will automatically be supported by Visual Studio Designer. The following code segment shows a member of type Filler named AreaFill:

private GAW.SimpleWidgets.Filler areaFill = new GAW.SimpleWidgets.Filler();
public GAW.SimpleWidgets.Filler AreaFill
{
    get { return areaFill; }
    set { areaFill = value; }
}

If such a code sample was part of a control, and that control was added to form, this property could be set within designer:

Selecting the "..." button brings up the FillerEditorDialog.

Filler2

The Filler2 class is an area filler class similar to Filler but with fewer options for gradient fills. It supports the following fill types:

  • Empty fills,
  • Solid fills (using a single color),
  • Hatched fills (using a hatch color, hatch pattern, and background color), and
  • Gradient fills (using any number of colors).

Filler2 is intended for use in a control where the gradient direction (if a gradient fill is chosen) is context dependent. For example, imagine a control with a spinning arrow. If a gradient fill was chosen for the arrow, and the control designer wanted the gradient to always flow in the direction the arrow was pointing, then Filler2 should be chosen as the fill over Filler. It would not make sense for the user to be able to select a gradient direction if the control ignored the selected direction.

Line

The Line class represents a line, of any size (thickness), color, and dash style. It is intended to be used to draw lines and/or paths using the .NET Graphics class.

The LineEditorDialog class implements a dialog which allows for the editing of a Line object:

Polygon

The Polygon class represents a polygon, either empty, or composed of any number of points. It is intended to be used to draw paths using the .NET Graphics class.

The PolygonEditorDialog class implements a dialog which allows for the creation and editing of a Polygon object. The polygon is constructed by entering the X and Y coordinates for each point. Points can be added, deleted, or re-ordered:

Other Classes

The following table summarizes most, but not all, of the other classes in the SimpleWidgets library.

WebColorPicker A control for selecting a web color.

WebColorPickerDialog A dialog form with a WebColorPicker control.

SystemColorPicker A control for selecting a system color.

SystemColorPickerDialog A dialog form with a SystemColorPicker control.

CustomColorPicker A control for selecting any color from the RGB or HSL color spaces.

CustomColorPickerDialog A dialog form with a CustomColorPicker control.

ComboColorPicker A control for which combines the WebColorPicker, SystemColorPicker, and CustomColorPicker using tabs
ComboColorPickerDialog A dialog form with a ComboColorPicker control.

ColorGradientEditor A control for editing a color gradient.

ColorGradientEditorDialog A dialog form with a ColorGradientEditor control.

DashStyleComboBox A control for selecting one of the preset DashStyle values from a ComboBox control.
HatchStyleComboBox A control for selecting one of the preset HatchStyle values from a ComboBox control.
LinearGradientModeComboBox A control for selecting one of the preset LinearGradientMode values from a ComboBox control.

History

  • February 5, 2014 - Release 1.0.1
    • Fixed some missing documentation tags.
  • February 2, 2014 - First release

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Graham Wilson
Software Developer (Senior)
Canada Canada
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 5 Feb 2014
Article Copyright 2014 by Graham Wilson
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid