IntroductionButton bar control supporting - Keyboard Support
- Full Designer Support
- Supports Custom Drawing
This Article Sample Project Source code, FeaturesButtonBar control has the following features - 6 Pre-defined Themes
- Supports alpha blend image
- Full Keyboard support
- Full Design Time support
- Supports Saving/Loading of layout colors
- Supports Disabled back color
- Supports HotKeys
Using the CodeThis control is array of buttons aligned vertical. Use the designer to fine tune appearance. Keyboard- Enter Key - Select button. Move by arrow key or hover over a button to select and press enter.
- Down Key - Move to next button.
- Up Key - Move to previous button.
ButtonBarPropertiesAppearance - Appearance object containing Global Appearance information.ButtonWidth- Width of buttons. Control resizes itself to button.DisableTransparency - Gets or Sets Disabled State Transparency.ImageTransparency - Gets or Sets Background Image transparency.Items - Collections of buttons.Padding - Gets or sets distance of button from control boundry.SelectedItem - Get current selected button.ShowBorders - Gets or Sets wether borders will be shown or not.Spacing - Gets or Sets distance between buttons.ThemeProperty - Property used to Get or Set which theme should be used. See also ThemeProperty.UseMnemonic - Indicates wether to use shortcut keys or not.
EventsBarClick - Occurs when Bar is clicked. This fired when clicked on area other than buttons.CustomDrawBackGround - Occurs when ButtonBar requests drawing. This can be used to implement custom draw.CustomDrawItems - Occurs when BarItem requests drawing. This can be used to implement own drawing.ItemClick - Occurs when a button is pressed. This is also fiered when Shortcut key is pressed or Enter key is pressed.ItemsChanged - Occurs when BarItem of Items is changed.ItemsChanging - Occurs when BarItem of Items is changing.ItemsClearing - Occurs when Items is clearing.ItemsInserted - Occurs when BarItem of Items is inserted into collection.ItemsInserting - Occurs when BarItem is being inserted on Items.ItemsRemoved - Occurs when BarItem of Items is removed from collection.ItemsRemoving - Occurs when BarItem is being removed from Items.SelectionChanged - Occurs when Button Selection changes.SelectionChanging - Occurs when Button Selection is about to change.
MethodsHitTestInfo HitTest(Point pt) - Performs HitTest for specified point.pt Point of hit. Returns HitTestInfo object containing information related to hit. e.g. Location, button index etc.HitTestInfo HitTest(int x, int y) - Performs HitTest for specified point.x and y coordinate of Point of hit. Returns HitTestInfo object containing information related to hit. e.g. Location, button index etc.bool ExportAppearance(string fileName) - Saves current color scheme of the Calander control to a xml file. fileName is path of xml file to which data will be written. Returns wether save was successful or not.bool ImportAppearance(string fileName) - Loads the color scheme from a xml file. fileName is location of xml file containing color scheme. Returns wether Load was successfull or not.EnsureVisibility(int index) - Ensures given item is visible. Scrolls to item if not visible. index is index of item which needs to be shown.State GetButtonState(BarItem barItem) - Gets Current State of button.BarItem of which state is to be determined.State of button. bool SelectItem(BarItem item) - Reset the appearance of Calander control to default value.Item to be selected..Returns wether item was selected or not.
ThemePropertyPropertiesUseTheme - Gets or Sets wether to use predefined theme or custom colors.ColorScheme - Gets or Sets ColorScheme to be applied. Please Note : This will not be applicable when UseTheme is set as false.
EventsThemeChanged - Fired when UseTheme or ColorScheme is changed.
Methodsbool DefaultChanged() - Returns wether ThemeProperty properties has changed or not.void Reset() - Resets current object to use default value for each property.
AppearancePropertiesBar - Gets appearance of ButtonBar.IsEmpty- Indicates Appearence is Empty or not.Item - Gets appearance of BarItem.
EventsAppearanceChanged - Occurs when properties related to drawing has been modified.
MethodsAssign(Appearance appearance) - Assigns properties of appearance to current object.bool DefaultChanged() - Returns wether property values has changed or not.Reset() - Resets current appearance to default appearance.
AppearanceBarPropertiesAppearanceBorder - Gets border appearance of ButtonBar.BackStyle - Gets background style of ButtonBar.CornerRadius- Gets corner radius of ButtonBarDisabledMask- Gets or Sets disabled mask color of ButtonBar.FocusedBorder - Gets or Sets focused border color of ButtonBar.IsEmpty - Indicates current object is Empty or not.NormalBorder - Gets or Sets Normal border color of ButtonBar.
EventsAppearanceChanged - Occurs when properties related to drawing has been modified.
MethodsAssign(AppearanceBar app) - Assigns Values of supplied AppearanceBar to current object.app AppearanceBar object whose value is to be assigned.bool DefaultChanged() - Returns wether ThemeProperty properties has changed or not.Reset() - Resets current appearance to default appearance.
AppearanceItemPropertiesAppearenceText - Gets AppearenceText of the item.BackStyle - Gets Back style of Item in Normal state.ClickStyle- Gets Back style of Item in Pressed state.DisabledBorder - Gets or Sets border color of Item in Disabled state.DisabledForeGround - Gets or Sets text color of Item in Disabled state.DisabledStyle - Gets Back style of Item in Disabled state.Gradient - Gets or Sets Gradient of Item BackColor. This will updating this will update Gradient for all State.HoverBorder - Gets or Sets border color of Item in Hover state.HoverForeGround - Gets or Sets text color of Item in Hover state.HoverStyle - Gets Back style of Item in Hover state.IsEmpty - Indicates current object is Empty or not.NormalBorder - Gets or Sets border color of Item in Normal state.NormalForeGround - Gets or Sets text color of Item in Normal state.SelectedBorder - Gets or Sets border color of Item in Selected state.SelectedForeGround - Gets or Sets text color of Item in Selected state.SelectedHoverStyle - Gets Back style of Item in SelectedHover state.SelectedStyle - Gets Back style of Item in Selected state.
EventsAppearanceChanged - Occurs when properties related to drawing has been modified.
MethodsAssign(AppearanceItem app) - Assigns properties of app to current object.bool DefaultChanged() - Returns wether ThemeProperty properties has changed or not.Reset() - Resets current appearance to default appearance.
Known Issues- Some Event handler does not get created with proper signature by designer. They Need to be fixed manually.
Version History- 2 December 2009: Initial draft of the control
Sample Project codeDownload Demo files -58 kb Download Help files -539 kb Download Src files -105 kb Download Lib files -48 kb |