Search Results for

    Show / Hide Table of Contents

    Class Win32Caret

    Wrapper of Win32 caret functions.

    Inheritance
    Object
    Win32Caret
    Implements
    IDisposable
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    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 Source

    Win32Caret(Window)

    Declaration
    public Win32Caret(Window hostingWindow)
    Parameters
    Type Name Description
    Window hostingWindow

    Properties

    | Improve this Doc View Source

    CaretVisibility

    Declaration
    public CaretVisibility CaretVisibility { get; }
    Property Value
    Type Description
    CaretVisibility
    | Improve this Doc View Source

    CurrentCaretInfo

    Declaration
    public CaretInfo CurrentCaretInfo { get; }
    Property Value
    Type Description
    CaretInfo
    | Improve this Doc View Source

    HostingWindow

    Declaration
    public Window HostingWindow { get; }
    Property Value
    Type Description
    Window
    | Improve this Doc View Source

    HostingWindowHandle

    Declaration
    public IntPtr HostingWindowHandle { get; }
    Property Value
    Type Description
    IntPtr

    Methods

    | Improve this Doc View Source

    ChangePosition(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

    true if successfull.

    Exceptions
    Type Condition
    InvalidOperationException

    The caret was already detroyed.

    See Also
    SetCaretPos function (winuser.h)
    | Improve this Doc View Source

    Destroy()

    Destroys the Win32 caret and disposes the current instance.

    Declaration
    public bool Destroy()
    Returns
    Type Description
    Boolean

    true if successfull.

    Remarks

    To temporarily hide the caret call Hide() instead.

    Exceptions
    Type Condition
    InvalidOperationException

    The caret was already detroyed.

    See Also
    DestroyCaret function (winuser.h)
    | Improve this Doc View Source

    Dispose()

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    Dispose(Boolean)

    Declaration
    protected virtual bool Dispose(bool disposing)
    Parameters
    Type Name Description
    Boolean disposing
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    DisposeInternal()

    Declaration
    protected bool DisposeInternal()
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    Finalize()

    Declaration
    protected void Finalize()
    | Improve this Doc View Source

    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
    GetCaretBlinkTime function (winuser.h)
    | Improve this Doc View Source

    GetFlashTime()

    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.

    | Improve this Doc View Source

    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

    true if successfull.

    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
    GetCaretPos function (winuser.h)
    | Improve this Doc View Source

    Hide()

    Hides the caret, but does not destroy it.

    Declaration
    public bool Hide()
    Returns
    Type Description
    Boolean

    true if successfull.

    Remarks

    To destroy the caret call Destroy() or Dispose().

    Exceptions
    Type Condition
    InvalidOperationException

    The caret was already detroyed.

    See Also
    HideCaret function (winuser.h)
    | Improve this Doc View Source

    SetBlinkTime(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

    true if successfull.

    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
    SetCaretBlinkTime function (winuser.h)
    | Improve this Doc View Source

    Show(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

    true if the operation was successfull. Returns false if the creation has failed ot the caret is already visible.

    Remarks

    To create multiple carets, create the required number of Win32Caret instances.

    Exceptions
    Type Condition
    InvalidOperationException

    The caret was already detroyed.

    See Also
    ShowCaret function (winuser.h)

    Implements

    IDisposable

    Extension Methods

    HelperExtensionsCommon.ToDictionary(Object)
    HelperExtensionsCommon.ToFlatDictionary(Object)

    See Also

    https://learn.microsoft.com/en-us/windows/win32/menurc/carets
    https://learn.microsoft.com/en-us/windows/win32/menurc/about-carets
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX