Krzysztof Mossakowski
Windows Programming
2008 - Tasks
Custom controls
Custom image
Description:
Custom image control with additional image color transformations
Functionality:
Custom control class inherit from
Control
class
One additional property
Parameters
of complex typy contains three properties
Gamma - float, gamma correction factor
Grayscale - bool, flag indicating if image is drawn in grayscale
Image - Image, the source of image
Each property has its own description, Gamma and Grayscale have default value defined as 1.0f and
false
respectively
Parameters
property is located in
Image
category of the properties grid
At
Parameters
property level in the properties grid, a
Gamma
member value is shown and could be edited
Control cannot be moved and its size cannot be chaned with mouse in desing mode
In design mode a
Grayscale
item is added to the control's context menu, selecting of the item changes
Grayscale
property value
Value change of any property should be reflected in image drawing immediately
Demo project (Windows Froms) with control usage
Hints:
DesignerAttribute, TypeConverterAttribute, CategoryAttribute, DescriptionAttribute, DefaultValueAttribute
ControlDesigner.SelectionRules, ControlDesigner.Verbs
TypeConverter.GetPropertiesSupported, TypeConverter.GetProperties
TypeDescriptor.GetProperties
ImageAttributes, ColorMatrix
Approximate points:
custom control displaing an image: 1.0
complex type editable in properties grid: 2.5
grayscale item in desing mode contex menu: 2.0
disable of control moving and size changing in design mode: 1.0
fast grayscale drawing: 1.5
gamma correction: 1.0
demo project: 1.0
Links for uploading:
Solutions
Corrections