Click here to Skip to main content
12,447,275 members (57,444 online)
Click here to Skip to main content
Add your own
alternative version

Stats

19.9K views
2K downloads
43 bookmarked
Posted

A Collection of Simple Widgets

, 19 Jan 2016 CPOL
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.1.1 of the library. It fixes a couple of bugs discovered in release 1.1.0. Refer to the History section for more detail.

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_111_Library download includes:

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

The SimpleWidgets_111_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_111_Source download includes the source for all of above programs, as well as the necessary files for building the help file.

Compatibility with Other .NET Framework Versions

The GAW.SimpleWidgets library is compiled using .NET Framework version 2.0. To confirm that there were no issues with other framework versions, the compiled library was used by an application which was compiled, in turn, under .NET Framework versions 3.0, 3.5, 4.0, and 4.5. The GAW.SimpleWidgets library functioned properly with all of them.

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

  • January 19, 2016 - Release 1.1.1
    • Fixed bug where SetStartPosition was positioning the form with the upper left corner at the specified point, not the center of the top edge as stated in the documentation.
    • Updated SetStartPosition and SetStartPositionBelowControl such that the form position is adjusted to keep it in the working area of the screen.
    • Fixed bug where Black was missing from the list of web colors.
  • September 13, 2015 - Release 1.1.0
    • Fixed bug where FillerPanel and Filler2Panel were using nested UserControls, making it impossible for mouse messages to be intercepted.
    • Fixed bug where Utils.SetSetPosition() would not always function properly on the non primary display of a multiple display system.
    • Added additional constructors to FillerEditorDialog and Filler2EditorDialog allowing the window to be positioned immediately beneath a specified control.
    • Changed form border style of various dialogs from fixed dialog to fixed tool window.
    • Changed titles on various dialogs.
    • Changed Line class so that a width of zero is an empty (not visible) line.
    • Added alpha value selector to CustomColorPicker control.
  • September 13, 2014 - Release 1.0.2
    • Converted .csproj files to Visual Studio 2013 format.
    • Converted help files to work with SandCastle Help File Builder 2014.5.31.0.
  • 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

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionHave you consider to post this as a tip? Pin
Nelek19-Jan-16 23:17
protectorNelek19-Jan-16 23:17 
AnswerRe: Have you consider to post this as a tip? Pin
Graham Wilson21-Jan-16 15:47
memberGraham Wilson21-Jan-16 15:47 
GeneralRe: Have you consider to post this as a tip? Pin
Nelek22-Jan-16 0:02
protectorNelek22-Jan-16 0:02 
Generalthanks Pin
Member 1187373329-Jul-15 23:02
memberMember 1187373329-Jul-15 23:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160811.3 | Last Updated 19 Jan 2016
Article Copyright 2014 by Graham Wilson
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid