Class Win32Caret
Wrapper of Win32 caret functions.
Implements
Inherited Members
Namespace: BionicCode.Utilities.Net
Assembly: BionicCode.Utilities.Net.Wpf.dll
Syntax
public class Win32Caret : IDisposable
Remarks
To create multiple carets, create the required number of Win32Caret instances.
This type implements IDisposable. Calling Dispose() will destroy the caret.
Constructors
| Improve this Doc View SourceWin32Caret(Window)
Declaration
public Win32Caret(Window hostingWindow)
Parameters
| Type | Name | Description |
|---|---|---|
| Window | hostingWindow |
Properties
| Improve this Doc View SourceCaretVisibility
Declaration
public CaretVisibility CaretVisibility { get; }
Property Value
| Type | Description |
|---|---|
| CaretVisibility |
CurrentCaretInfo
Declaration
public CaretInfo CurrentCaretInfo { get; }
Property Value
| Type | Description |
|---|---|
| CaretInfo |
HostingWindow
Declaration
public Window HostingWindow { get; }
Property Value
| Type | Description |
|---|---|
| Window |
HostingWindowHandle
Declaration
public IntPtr HostingWindowHandle { get; }
Property Value
| Type | Description |
|---|---|
| IntPtr |
Methods
| Improve this Doc View SourceChangePosition(CaretInfo)
Change the position at where the caret is rendered.
Declaration
public bool ChangePosition(CaretInfo caretInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| CaretInfo | caretInfo | Defines the properties of the caret. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The caret was already detroyed. |
See Also
| Improve this Doc View SourceDestroy()
Destroys the Win32 caret and disposes the current instance.
Declaration
public bool Destroy()
Returns
| Type | Description |
|---|---|
| Boolean |
|
Remarks
To temporarily hide the caret call Hide() instead.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The caret was already detroyed. |
See Also
| Improve this Doc View SourceDispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual bool Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | disposing |
Returns
| Type | Description |
|---|---|
| Boolean |
DisposeInternal()
Declaration
protected bool DisposeInternal()
Returns
| Type | Description |
|---|---|
| Boolean |
Finalize()
Declaration
protected void Finalize()
GetBlinkTime()
Retrieves the time required to invert the caret's pixels. The user can set this value using SetBlinkTime(TimeSpan).
Declaration
public static TimeSpan GetBlinkTime()
Returns
| Type | Description |
|---|---|
| TimeSpan | A TimeSpan holding the blink time in milliseconds. A return value of Zero indicates that the caret does not blink. |
Remarks
The flash time of a caret is twice as much as the blink time: "Blink" is the period of time between successive state changes in the caret animation. "Flash" is 2 * blink, the period of time to transition from visible, to hidden, to visible again.
See Also
| Improve this Doc View SourceGetFlashTime()
Returns the current flash time, which is twice the blink time value returned by GetBlinkTime().
Declaration
public static TimeSpan GetFlashTime()
Returns
| Type | Description |
|---|---|
| TimeSpan | A TimeSpan holding the flash time in milliseconds. |
Remarks
The flash time of a caret is twice as much as the blink time: "Blink" is the period of time between successive state changes in the caret animation. "Flash" is 2 * blink, the period of time to transition from visible, to hidden, to visible again.
GetPosition(out Point)
Copies the caret's position to the specified Point structure.
Declaration
public bool GetPosition(out Point caretPsoition)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | caretPsoition |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Remarks
The caret position is always given in the client coordinates of the window that contains the caret.
This API does not participate in DPI virtualization. The returned values are interpreted as logical sizes in terms of the window in question. The calling thread is not taken into consideration.
See Also
| Improve this Doc View SourceHide()
Hides the caret, but does not destroy it.
Declaration
public bool Hide()
Returns
| Type | Description |
|---|---|
| Boolean |
|
Remarks
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The caret was already detroyed. |
See Also
| Improve this Doc View SourceSetBlinkTime(TimeSpan)
Sets the caret blink time to the specified number of milliseconds. The blink time is the elapsed time, in milliseconds, required to invert the caret's pixels.
Declaration
public static bool SetBlinkTime(TimeSpan blinkTimeInMilliseconds)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeSpan | blinkTimeInMilliseconds | Caret blink rate in milliseconds. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Remarks
The user can set the blink time using the Control Panel. Applications should respect the setting that the user has chosen. The SetCaretBlinkTime function should only be used by application that allow the user to set the blink time, such as a Control Panel applet.
The flash time is the elapsed time, in milliseconds, required to display, invert, and restore the caret's display. The flash time of a caret is twice as much as the blink time: "Blink" is the period of time between successive state changes in the caret animation. "Flash" is 2 * blink, the period of time to transition from visible, to hidden, to visible again.
If you change the blink time, subsequently activated applications will use the modified blink time, even if you restore the previous blink time when you lose the keyboard focus or become inactive.This is due to the multithreaded environment, where deactivation of your application is not synchronized with the activation of another application.This feature allows the system to activate another application even if the current application is not responding.
See Also
| Improve this Doc View SourceShow(CaretInfo)
Create and show a caret for the current hosting Window.
Declaration
public bool Show(CaretInfo caretInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| CaretInfo | caretInfo | Defines the properties of the caret. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Remarks
To create multiple carets, create the required number of Win32Caret instances.
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The caret was already detroyed. |