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. Set the msflexgrid col width and row height according client rect [modified]

Set the msflexgrid col width and row height according client rect [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
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.
  • Z Offline
    Z Offline
    zeus_master
    wrote on last edited by
    #1

    how to set the col width and row height according client rect and make the cells full fill with the client area. I calc the value as follow way, but it still can't meet the rect.... BOOL CPgDialog::OnInitDialog() { CRect clrect; long row=0,col=0; m_grid.SetRows(20); // total rows 20 m_grid.SetCols(20); // total cols 20 m_grid.GetClientRect(&clrect); long lwidth =clrect.Width()/m_grid.GetRows()*14.4; // inch? long lheight = clrect.Height()/m_grid.GetCols()*14.4; for (col=0;col< m_grid.GetCols();col++) { m_grid.SetColWidth(col,lwidth); } for (row=0;row

    V 1 Reply Last reply
    0
    • Z zeus_master

      how to set the col width and row height according client rect and make the cells full fill with the client area. I calc the value as follow way, but it still can't meet the rect.... BOOL CPgDialog::OnInitDialog() { CRect clrect; long row=0,col=0; m_grid.SetRows(20); // total rows 20 m_grid.SetCols(20); // total cols 20 m_grid.GetClientRect(&clrect); long lwidth =clrect.Width()/m_grid.GetRows()*14.4; // inch? long lheight = clrect.Height()/m_grid.GetCols()*14.4; for (col=0;col< m_grid.GetCols();col++) { m_grid.SetColWidth(col,lwidth); } for (row=0;row

      V Offline
      V Offline
      Viorel
      wrote on last edited by
      #2

      Are your sure that SetColWidth and SetRowHeight functions requires size in other units than pixels? Try without your "14.4" multiplier.

      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