Hide

SftTree/OCX 7.5 - ActiveX Tree Control

Display
Print

GetPositionPix Method, SftTreeHeaders Object

Returns the coordinates of the combined row/column header and all column headers.

Syntax

VB.NETBoolean = object.GetPositionPix(ByRef LeftPix As OLE_XPOS_PIXELS, ByRef TopPix As OLE_YPOS_PIXELS, ByRef WidthPix As OLE_XSIZE_PIXELS, ByRef HeightPix As OLE_YSIZE_PIXELS) As Boolean
VBBoolean = object.GetPositionPix(LeftPix As OLE_XPOS_PIXELS, TopPix As OLE_YPOS_PIXELS, WidthPix As OLE_XSIZE_PIXELS, HeightPix As OLE_YSIZE_PIXELS) As Boolean
C#.NETbool Boolean = object.GetPositionPix(out OLE_XPOS_PIXELS LeftPix, out OLE_YPOS_PIXELS TopPix, out OLE_XSIZE_PIXELS WidthPix, out OLE_YSIZE_PIXELS HeightPix);
VC++VARIANT_BOOL Boolean = object->GetPositionPix(OLE_XPOS_PIXELS* LeftPix, OLE_YPOS_PIXELS* TopPix, OLE_XSIZE_PIXELS* WidthPix, OLE_YSIZE_PIXELS* HeightPix);
CHRESULT object->raw_GetPositionPix(OLE_XPOS_PIXELS* LeftPix, OLE_YPOS_PIXELS* TopPix, OLE_XSIZE_PIXELS* WidthPix, OLE_YSIZE_PIXELS* HeightPix, VARIANT_BOOL* Boolean);

object

A SftTreeHeaders object.

LeftPix

Returns the horizontal position relative to the top, left corner of the tree control in pixels.

TopPix

Returns the vertical position relative to the top, left corner of the tree control in pixels.

WidthPix

Returns the width of the column header in pixels.

HeightPix

Returns the height of the column header in pixels.

Span

Returns the number of columns that the column header occupies.

Boolean

BooleanDescription
TrueThe column headers are displayed and visible.
FalseThe column headers are not visible. The returned coordinates are not valid.

Comments

The GetPositionPix method returns the coordinates of the combined row/column header and all column headers.

The Headers.GetPosition and GetPositionPix methods are synonyms, but may use different coordinate systems.

The Header.GetPosition method can be used to retrieve the coordinates of one column header.

Examples

VB.NET

    End Sub

    Private Sub AxSftTree1_ContextMenuEvent(ByVal sender As Object, ByVal e As AxSftTreeLib75._DSftTreeEvents_ContextMenuEvent) Handles AxSftTree1.ContextMenuEvent
        Dim P As Point
        P = AxSftTree1.PointToScreen(New Point(e.x, e.y))

        ' Determine click context menu for header or item
        Dim L As Integer, T As Integer, H As Integer, W As Integer
        AxSftTree1.Headers.GetPositionPix(L, T, W, H)
        If e.x >= L And e.x < L + W And e.y >= T And e.y <= T + H Then
            HeaderMenu(PointToClient(P))
            Return
        End If

        ' determine item right-clicked
        Dim ItemIndex As Integer

C#

        }

        private void axSftTree1_ContextMenuEvent(object sender, AxSftTreeLib75._DSftTreeEvents_ContextMenuEvent e)
        {
            Point point = axSftTree1.PointToScreen(new Point(e.x, e.y));

            // Determine click context menu for header or item
            int l, t, h, w;
            axSftTree1.Headers.GetPositionPix(out l, out t, out w, out h);
            if (e.x >= l && e.x < l + w && e.y >= t && e.y <= t + h) {
                HeaderMenu(PointToClient(point));
                return;
            }

            // determine item right-clicked
            int ItemIndex = axSftTree1.Items.HitTestPix(e.x, e.y);

C++

void CBookTableDlg::OnContextMenuSftTree1(short Button, short Shift, long x, long y)
{
    CPoint pt(x, y);
    ::MapWindowPoints((HWND) m_vTree->hWnd, NULL, &pt, 1);

    // Determine click context menu for header or item
    long l, t, w, h;
    m_vTree->Headers->GetPositionPix(&l, &t, &w, &h);
    if (x >= l && x < l + w && y >= t && y <= t + h) {
        HeaderMenu(pt);
        return;
    }

    // determine item right-clicked
    long ItemIndex;
    ItemIndex = m_vTree->Items->HitTestPix(x, y);

See Also SftTreeHeaders Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2022 Softel vdm, Inc.