在報表中寫資料

來源:互聯網
上載者:User
 

case WM_NOTIFY:                     LPNMITEMACTIVATE lpnmitem;                  switch(LOWORD(wParam))                     {                     case ID_LIST:                            lpnmitem=(LPNMITEMACTIVATE)lParam;                            if(lpnmitem->hdr.code==NM_CLICK||lpnmitem->hdr.code==NM_SETFOCUS)                            {                                        if(hListEdit!=NULL)                                   {                                          GetWindowText(hListEdit,buff,10);                                          SetItemText(hDlg,curpos.x,curpos.y,buff);                                          DestroyWindow(hListEdit);                                                                                              hListEdit=NULL;                                   }                                   curpos.x=lpnmitem->iItem;                                   curpos.y=lpnmitem->iSubItem;                                   if(curpos.y<1||curpos.x<0)                                          return 0;                                   Rect.top=lpnmitem->iSubItem;                                   Rect.left=LVIR_BOUNDS;                                   SendDlgItemMessage(hDlg,ID_LIST,LVM_GETSUBITEMRECT,(WPARAM)lpnmitem->iItem,(LPARAM)&Rect);                                   hListView=GetDlgItem(hDlg,ID_LIST);                                   hListEdit=CreateWindow("EDIT","",WS_CHILD|WS_BORDER|WS_VISIBLE,Rect.left,Rect.top,Rect.right-Rect.left,Rect.bottom-Rect.top,hListView,(HMENU)ID_LISTEDIT,hInst,NULL);                                   lvi.mask=LVIF_TEXT;                                   lvi.iItem=lpnmitem->iItem;        //行數                                   lvi.iSubItem=lpnmitem->iSubItem;         //列數                                   lvi.pszText=buff;       //文本                                   lvi.cchTextMax=20;                                   SendDlgItemMessage(hDlg,ID_LIST,LVM_GETITEMTEXT,lpnmitem->iItem,(LPARAM)(LPLVITEM)&lvi);                                   SetWindowText(hListEdit,buff);                                   SetFocus(hListEdit);                            }                            break;                     }                     break;WM_COMMAND://取消編輯框if(hListEdit!=NULL)              {                     GetWindowText(hListEdit,buff,10);                     SetItemText(hDlg,curpos.x,curpos.y,buff);                     DestroyWindow(hListEdit);                                                                                              hListEdit=NULL;              }

 響應捲軸訊息

hListView=GetDlgItem(hDlg,ID_LIST);
OldList=(WNDPROC)SetWindowLong(hListView,GWL_WNDPROC,(LPARAM)ListProc);//設定訊息響應常式

LRESULT CALLBACK ListProc(HWND hList,UINT message,WPARAM wParam,LPARAM lParam)
{
 char buff[10];

 switch(message)
 {
 case WM_HSCROLL:
  if(hListEdit!=NULL)
  {
   GetWindowText(hListEdit,buff,10);
   SetItemText(hDlgMain,curpos.x,curpos.y,buff);
   DestroyWindow(hListEdit);            
   hListEdit=NULL;
  }
  break;
 }
 return CallWindowProc (OldList, hList, message, wParam, lParam) ; //其他訊息返回原訊息處理常式
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.