Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Hot track item
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Hot track item

 Post Reply Post Reply
Author
Message
douglashogan View Drop Down
Groupie
Groupie


Joined: 02 July 2003
Location: Switzerland
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote douglashogan Quote  Post ReplyReply Direct Link To This Post Topic: Hot track item
    Posted: 03 April 2006 at 3:39pm

Hi

How is it possible to hot track with an underline in the report control? I want to hot track the first column of the rows.

 

Regards
Douglas Hogan
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 06 April 2006 at 3:13pm
Hi,

There are no an easy setting for this, but you can do it in a custom way in 2 following steps:

1) Add a code to GetItemMetrics() method to draw a report cell underlined where a mouse currently placed. It could be like a following:

void CMessageRecord::GetItemMetrics(...)
{
...
    if (pView && pDrawArgs->pColumn && pDrawArgs->pControl && pDrawArgs->pColumn->GetIndex() == 5)
    {
        // Get the current mouse location and convert it to client coordinates.
        DWORD pos = GetMessagePos();
        CPoint ptCur(LOWORD(pos), HIWORD(pos));
        pDrawArgs->pControl->ScreenToClient(&ptCur);

        if (pDrawArgs->rcItem.PtInRect(ptCur))
        {
            static CFont m_fontUnderlined;
           
            if (!m_fontUnderlined.GetSafeHandle())
            {
                LOGFONT lf;
                pDrawArgs->pControl->GetPaintManager()->m_fontText. GetLogFont(&lf);
                lf.lfUnderline = TRUE;
               
                m_fontUnderlined.CreateFontIndirect(&lf);
            }
           
            pItemMetrics->pFont = &m_fontUnderlined;
        }
    }
...


2) Add report control redrawing on mouse move inside a Report Control:

void CYourReport::OnReportMouseMove(...)
{
    GetReportCtrl().RedrawControl();
}


--
WBR,
Serge
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.