获取TListView选中行的内容

    技术2022-08-07  74

    通过鼠标点击获取TListView选中的内容,用的是OnClicked事件,不是OnChange事件,代码如下:  

    TPoint p; GetCursorPos(&p); p = lvLoginUser->ScreenToClient(p); TListItem * pItem = lvLoginUser->GetItemAt(p.x, p.y); if(pItem == NULL)return; m_nID = atoi(pItem->Caption.c_str());//选中的ID edtUserID->Text = pItem->SubItems->Strings[0]; edtUserName->Text = pItem->SubItems->Strings[1]; if(m_bSeePassword) edtPwd->Text = GetPwdString(m_nID); else edtPwd->Text = "******"; cbbLimit->ItemIndex= g_pRoleManage->GetRoleTypeOfRoleName(pItem->SubItems->Strings[3]); edtPhone->Text = pItem->SubItems->Strings[4]; mmoMarks->Text = pItem->SubItems->Strings[5];

     

    Processed: 0.021, SQL: 9