Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Odd CEdit

Odd CEdit

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AntonGogolev
    wrote on last edited by
    #1

    Hello, guys. Check this out: void CCtrlsDlg::OnDblclkList(NMHDR* pNMHDR, LRESULT* pResult) { LPNMITEMACTIVATE pIA = (LPNMITEMACTIVATE)pNMHDR; *pResult = 0; if((-1 == (m_nItem = pIA->iItem)) || (0 == (m_nSubitem = pIA->iSubItem))) return; CRect rc; m_ctrlList.GetSubItemRect(pIA->iItem, pIA->iSubItem, LVIR_BOUNDS, rc); if(!m_pEdit) m_pEdit = new CEdit; CString strText = m_ctrlList.GetItemText(m_nItem, m_nSubitem); m_pEdit->Create(WS_CHILD | WS_VISIBLE | WS_BORDER, rc, &m_ctrlList, 12); m_pEdit->ModifyStyleEx(0, WS_EX_CLIENTEDGE, 0); m_pEdit->SetWindowText(strText); m_pEdit->SetSel(0, -1); m_pEdit->SetFocus(); } This whole thing displays an edit box for CListCtrl's subitems, but as CEdit control is created it has some odd look - it looks like edit control from Windows 3.1 rather anything else. Where's the problem?

    P 1 Reply Last reply
    0
    • A AntonGogolev

      Hello, guys. Check this out: void CCtrlsDlg::OnDblclkList(NMHDR* pNMHDR, LRESULT* pResult) { LPNMITEMACTIVATE pIA = (LPNMITEMACTIVATE)pNMHDR; *pResult = 0; if((-1 == (m_nItem = pIA->iItem)) || (0 == (m_nSubitem = pIA->iSubItem))) return; CRect rc; m_ctrlList.GetSubItemRect(pIA->iItem, pIA->iSubItem, LVIR_BOUNDS, rc); if(!m_pEdit) m_pEdit = new CEdit; CString strText = m_ctrlList.GetItemText(m_nItem, m_nSubitem); m_pEdit->Create(WS_CHILD | WS_VISIBLE | WS_BORDER, rc, &m_ctrlList, 12); m_pEdit->ModifyStyleEx(0, WS_EX_CLIENTEDGE, 0); m_pEdit->SetWindowText(strText); m_pEdit->SetSel(0, -1); m_pEdit->SetFocus(); } This whole thing displays an edit box for CListCtrl's subitems, but as CEdit control is created it has some odd look - it looks like edit control from Windows 3.1 rather anything else. Where's the problem?

      P Offline
      P Offline
      Paul Hooper
      wrote on last edited by
      #2

      I'm guessing that you are seeing the System font which looks very old. Try m_pEdit->ModifyStyleEx(0, WS_EX_CLIENTEDGE, 0); m_pEdit->SetFont(&newfont); m_pEdit->SetWindowText(strText); where newfont is a CFont that you find acceptable. Paul Hooper If you spend your whole life looking over your shoulder, they will get you from the front instead.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups