Search
FlowChart.DrawSelHandles Event
See Also
 



Raised to allow custom drawing of selection handles.

 Syntax

VB6  Copy Code

Public Event DrawSelHandles

 Event Data

Parameter

Type

Description

hdc

[input] long

A pointer to the drawing surface. Cast it to an HDC handle if using the classic graphics engine or to a pointer to a GDI+ Graphics object if using the GDI+ engine.

obj

[input] reference to a diagram item

The diagram item whose selection handles must be painted.

Dispatch ID: 87

 Remarks

The event is raised for selected items whose SelStyle is set to sstCustom. The drawing surface passed as the first argument is already prepared for drawing, having the needed transformations applied to match the diagram's ZoomFactor and scroll position. Use the appropriate GDI API functions or methods of the GDI+ Graphics class to perform custom drawing on the specified drawing surface.

 Example

The following MFC example shows how to perform custom drawing of selection handles in both the classic and GDI+ graphics engines.

C++  Copy Code

void CCustomDrawDlg::onBoxCreated(LPDISPATCH boxDisp)
{
    BoxItem box = boxDisp;
    box.SetSelStyle(sstCustom);
    box.DetachDispatch();
}

void CCustomDrawDlg::onDrawSelHandles(long* hdc, LPDISPATCH obj)
{
    BoxItem box = obj;
    if (box)
    {
        if (fc.GetGraphics().GetEngineType() == geClassic)
        {
            // using the classic GDI API
            HDC dc = (HDC)hdc;
            HPEN pen = CreatePen(PS_SOLID, 1, RGB(255, 0, 0));
            HPEN oldPen = (HPEN)SelectObject(dc, pen);
            Rectangle(dc, box.GetLeft(), box.GetTop(),
                box.GetRight(), box.GetBottom());
            SelectObject(dc, oldPen);
        }
        else
        {
            // using GDI+
            Gdiplus::Graphics* graphics = (Gdiplus::Graphics*)hdc;
            Gdiplus::Pen pen(Gdiplus::Color::Red, 0);
            graphics->DrawRectangle(&pen,
                box.GetLeft(), box.GetTop(),
                box.GetRight() - box.GetLeft(),
                box.GetBottom() - box.GetTop());
        }

        box.DetachDispatch();
    }
}

 See Also