Unicode Controls & Classes for VB6 - Version 4

ctlUniCanvas Control

Unicode API window that you can use like a normal Device Context.
You can draw into its area using normal API functions and you can receive events with Unicode data for KeyPress, KeyDown, KeyUp.
The "Label Editor" dialog used in our Dynamic HTML Editor program uses a ctlUniCanvas object to catch Unicode keys ;-)
This control supports IME input.
Check common properties here

Enums
Name Description
eUniCanvas_BorderStyle Border Style
Events
Name Description
Paint
KeyDown check here for details
KeyPress check here for details
KeyUp check here for details
Click
DblClick
MouseDown
MouseMove
MouseUp
MouseWheel Raised when the mouse wheel scrolls
CanvasGotFocus Raised when the control gets the focus. This works, the VB6 one doesn't.
CanvasLostFocus Raised when the control loses the focus. This works, the VB6 one doesn't.
Resize
IMEComposition Raised when the user confirms a string in the IME editor, check here for details
OLEStartDrag
OLESetData
OLEGiveFeedback
OLEDragOver
OLEDragDrop
OLECompleteDrag
Properties
Name Type Description
BackColorOut (OLE_COLOR) Gets or sets the Color of the area out of the border (when using Rounded Borders in a non WindowLess control)
Leave -1& for automatic management
BorderColor (OLE_COLOR) Gets or sets the Border color
BorderStyle (eUniCanvas_BorderStyle) Gets or sets the Border Style of the control
ClientHeight (Long) Returns the height of the client area
ClientWidth (Long) Returns the width of the client area
Enabled (Boolean) Enables or disables the control
Font (Font) Gets or sets the font used for text in the control, check the [ApplyFontChanges] for details
MouseIcon (Picture) Gets or sets the MouseIcon for the control
MousePointer (VBRUN.MousePointerConstants) Gets or sets the MousePointer for the control
OLEDropMode (eCtlOLEDropMode) Gets or sets the OleDropMode for the control
RightToLeft (Boolean) Gets or sets the ability to show bidirectional text on the control
RoundedBorders (Boolean) Gets or sets Rounded borders
Tip (String) Gets or sets the Unicode Tooltip for the control
TrapTabKey (Boolean) Gets or sets the ability for the control to catch Tab keys
UseMouseSetCapture (Boolean) Permits you to capture the mouse movements even if the mouse is out of the control (when pressing the mouse button into the control and then exiting from it maintaining the button pressed) like a normal PictureBox control
UseRoundRegions (Boolean) Gets or sets the ability to use Round Regions for round borders instead of using the [BackColorOut] property;
Methods
Name Type Description
ApplyFontChanges When setting a new font on the control you need to call this function in order to refresh the interface
hWnd (Long) Retuns the handle associated with the control
IsInIME (Boolean) You can use this property for knowing if the KeyPress, KeyDown and KeyUp events have been raised by the active IME window associated to your control.
OLEDrag Starts an OLEDrag operation
Refresh Invalidates the client area of the control
Remarks
How to use this control:
Simply manage the Paint Event, it gives you a Device Context that you can use to draw.
The DC passed has no memory, it's like a standard Window DC. Useful to catch Unicode characters using the KeyDown/KeyUp/KeyPress events.

You can use a clsMemDC object to create and manage Windows DC.



Private oMemDC As New clsMEMDC
Private oWrap As New clsCommonWrapper

Private Sub Form_Load()

'Create the memory DC
oMemDC.CreateDC ctlUniCanvas1.ClientWidth, _
ctlUniCanvas1.ClientHeight

'Draw into DC using Windows API
oWrap.DrawRectCoords oMemDC.Hdc, 0, 0, 100, 100, vbRed, True

End Sub

Private Sub ctlUniCanvas1_Paint(lHDC As Long)
'Draw the memory DC to the visible DC
oMemDC.PaintPicture lHDC
End Sub