Once the project is set up, you can start looking for ways to do so.
1, first, create a button, each press, you can update the contents of the non-current lattice, this is easy to achieve: void cgridcontroltest02dlg::onbnclickedfillbox () { //Todo:add your control notification handler code hereGv_item ITEM;Item.mask = gvif_text| Gvif_format;item.row = up;item.col = 2;Item.nformat = dt_center| dt_vcenter| dt_singleline| dt_end_ellipsis;Item.strText.Format (_t ("the"), 2);M_pgrid.setitem (&item);M_pgrid.refresh (); //ccellid cell (56,2); //m_pgrid.setfocuscell (cell);//method of setting focus }2, then, always find a way, until I see GridCtrl.h in the Protect in this function (BOOL SetScrollPos32 (int nBar, int nPos, BOOL bredraw = TRUE); ), and then look at the front and rear code that uses it, and find that it can be called. but unfortunately, it is protect, I change it to public also can not be compiled. later, consult a colleague, found that in the public and use it in an instantiated way, the compiler passed. as follows: int scrollpos = m_pgrid.getscrollpos32 (Sb_vert); 3, then, I can try to use my method to try: First get the current POS position, and then calculate offset, so that the current +offset, you can jump to the location of the content update:
int scrollpos = m_pgrid.getscrollpos32 (Sb_vert); ccellid idtopleft = M_pgrid.gettopleftnonfixedcell (); int yscroll = m_pgrid.getrowheight (idtopleft.row) * (item.row-1);m_pgrid.setscrollpos32 (Sb_vert, Scrollpos + yscroll);4, after compiling, and this method is feasible. The next step is to fix this method because there is a bug now.
Gridctrl Study Notes (2) Find ways to automatically update the table's latest data and display it to the current window