HeaderPane
Main
Hide
Share Link
Print

MouseIcon Property, SftMask Object

Defines a custom mouse icon.

Syntax

Get

C#System.Drawing.Image refPictureObj = object.MouseIcon;
VB.NETrefPictureObj = object.MouseIcon As System.Drawing.Image
C++IPictureDisp* refPictureObj = object->GetMouseIcon();
CHRESULT object->get_MouseIcon(IPictureDisp** refPictureObj);
VBSet refPictureObj = object.MouseIcon As IPictureDisp

Put

C#void object.let_MouseIcon(System.Drawing.Image refPictureObj);
VB.NETobject.let_MouseIcon(ByVal refPictureObj As System.Drawing.Image)
C++void object->PutMouseIcon(IPictureDisp* refPictureObj);
CHRESULT object->put_MouseIcon(IPictureDisp* refPictureObj);
VBobject.MouseIcon = refPictureObj As IPictureDisp

PutRef

C#System.Drawing.Image object.MouseIcon = refPictureObj;
VB.NETobject.MouseIcon = refPictureObj As System.Drawing.Image
C++void object->PutRefMouseIcon(IPictureDisp* refPictureObj);
CHRESULT object->putref_MouseIcon(IPictureDisp* refPictureObj);
VBSet object.MouseIcon = refPictureObj As IPictureDisp

object

A SftMask object.

refPictureObj

Defines a custom mouse icon.

Comments

The MouseIcon property defines a custom mouse icon.

The MouseIcon property provides a custom icon that is used when the MousePointer property is set to sftCustom (99). This mouse pointer is displayed when the cursor is located anywhere on the control.

Using PutRef (see Syntax above) the control will use the reference to the Picture object. If the Picture object is later changed, this will also affect the image used by the control. Using Put instead causes the control to create a copy of the Picture object. If the Picture object is later changed, this will not affect the image used by the control as it uses a copy of the object. Because of the additional overhead and the increased resource use of Put, PutRef is the preferred method.

Examples

VB6 View entire sample code

Private Sub Form_Load()
    ' A picture box is used to hold the icon for the MouseIcon property. A suitable
    ' icon has been defined in the picture box using its Picture property.
    Set SftMask1.MouseIcon = Picture1.Picture
    SftMask1.MousePointer = sftCustom
    ' Or use a predefined icon
    SftMask1.MousePointer = sftCross
End Sub

C++ View entire sample code

    PICTDESC PictDesc;
    PictDesc.cbSizeofstruct = sizeof(PICTDESC);
    PictDesc.picType = PICTYPE_ICON;
    PictDesc.icon.hicon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_WINLOGO));
    IPictureDispPtr pIPictureDisp;
    HRESULT hr = OleCreatePictureIndirect(&PictDesc, IID_IPictureDisp, TRUE, (void**)&pIPictureDisp);
    ASSERT(SUCCEEDED(hr));
    m_pMask1->PutRefMouseIcon(pIPictureDisp);
    m_pMask1->MousePointer = sftCustom;

    // Or use a predefined icon
    m_pMask1->MousePointer = sftCross;

    return TRUE;
}

See Also SftMask Object | Object Hierarchy


Last Updated 11/03/2026 - (email)
© 2026 Softel vdm, Inc.