| ||||
IntroductionFancyTextBox uses two new properties for showing background text: 'BackText' and 'BackTestShowOnFocus'.BackText - allows to enter text that is seen in system graytext color when TextBox is empty. BackTextShowOnFocus - keeps background text visible when TextBox is in focus. Any control can be added to FancyTextBox on the left or on the right side. It makes sense to add controls that are comparable in size that is images, buttons, labels, checkboxes, and radiobuttons. Controls can be dropped into FancyTestBox straight from ToolBox or dragged from design surface at desing time. |
||||
|
Watch Video... | ||||
|
FancyTextBox Custom Control from Igor Morozov on Vimeo. | ||||
|   | How it was constructedFancyTextBox draws background text in the edit box window on paint
requests as necessary. Controls can be added to FancyTextBox programmatically by simply using FancyTextBox.Controls.Add(control) method. When control is added it's Left property needs to be set to 0 to insert on the left side or to FancyTextBox.Width to insert it on the right side. FancyTextBox adjusts internal edit box margins within which text is written to accommodate controls that are added on left and right of control. Difficulties encounteredParentControlDesigner DragDrop event does not return the control that is being dropped in eventargs which makes it impossible to reset dropped control's location for it show in the correct position inside FancyTextBox. After much investigation and experimenting I noticed that CanParent method of ParentControlDesigner fires before OnDragDrop. So I simply overrode CanParent method to save control in private variable to be used in OnDragDrop. The ambient properties, such as Font, Cursor, Background Color etc., of controls that are added to FancyTextBox default to FancyTextBox values unless they are explicitely overriden. I didn't find a workaround this issue as of yet. Right-To-Left was not implemented here. DateBox Custom ControlDateBox control is suitable for entering a general date. It was created using FancyTextBox and MonthCalendar control which acts as a dropdown to assist in date selection. |
|||
|
Watch Video... |
||||
|
DateBox Custom Control from Igor Morozov on Vimeo. |
||||