PhotoPrintFrom.cpp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. // PhotoPrintFrom.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "LYFZIPManage.h"
  5. #include "PhotoPrintFrom.h"
  6. #include "MyMdi.H"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. #pragma comment(lib, "Shlwapi.lib")
  13. /////////////////////////////////////////////////////////////////////////////
  14. // PhotoPrintFrom
  15. IMPLEMENT_DYNCREATE(PhotoPrintFrom, CFormView)
  16. PhotoPrintFrom::PhotoPrintFrom()
  17. : CFormView(PhotoPrintFrom::IDD)
  18. {
  19. //{{AFX_DATA_INIT(PhotoPrintFrom)
  20. m_filter = _T("");
  21. //}}AFX_DATA_INIT
  22. }
  23. PhotoPrintFrom::~PhotoPrintFrom()
  24. {
  25. }
  26. void PhotoPrintFrom::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CFormView::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(PhotoPrintFrom)
  30. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  31. DDX_Control(pDX, IDC_LIST2, m_List1);
  32. DDX_Control(pDX, IDC_STATIC1, m_static1);
  33. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  34. //}}AFX_DATA_MAP
  35. }
  36. BEGIN_MESSAGE_MAP(PhotoPrintFrom, CFormView)
  37. //{{AFX_MSG_MAP(PhotoPrintFrom)
  38. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  39. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  40. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  41. ON_WM_TIMER()
  42. //}}AFX_MSG_MAP
  43. END_MESSAGE_MAP()
  44. /////////////////////////////////////////////////////////////////////////////
  45. // PhotoPrintFrom diagnostics
  46. #ifdef _DEBUG
  47. void PhotoPrintFrom::AssertValid() const
  48. {
  49. CFormView::AssertValid();
  50. }
  51. void PhotoPrintFrom::Dump(CDumpContext& dc) const
  52. {
  53. CFormView::Dump(dc);
  54. }
  55. #endif //_DEBUG
  56. /////////////////////////////////////////////////////////////////////////////
  57. // PhotoPrintFrom message handlers
  58. void PhotoPrintFrom::OnInitialUpdate()
  59. {
  60. CFormView::OnInitialUpdate();
  61. // TODO: Add your specialized code here and/or call the base class
  62. CMyMdi Mdi;
  63. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  64. // Here we create the outbar control using the splitter as its parent
  65. // and setting its id to the first pane.
  66. CRect rc2;
  67. GetWindowRect(rc2);
  68. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  69. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  70. m_static1.SetFont (&g_titlefont);
  71. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;相片名称,100;数量,100;是否发出,100;是否回来,100;男宾电话,100;女宾电话,100" );
  72. m_List1.LoadColumnInfo (120);m_List1.m_bSortSupport=0;
  73. g_sendhead.bsql=0;
  74. g_sendhead.code[0]=37;
  75. g_sendhead.tabcount=1;
  76. g_pMainWnd->ProcessChatMessageRequest2(21);if(g_bSendOK==0)return;
  77. DataToArray(&m_List1array);
  78. FillGrid();
  79. m_combo1.GetWindowRect (rc2);
  80. ScreenToClient(rc2);
  81. rc2.bottom +=200;
  82. m_combo1.MoveWindow (rc2);
  83. }
  84. void PhotoPrintFrom::FillGrid()
  85. {
  86. m_List1.DeleteAllItems2 ();
  87. int ii=0;
  88. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  89. int count=0;
  90. if(m_filter.IsEmpty ())
  91. {
  92. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  93. {
  94. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  95. }
  96. }
  97. else
  98. {
  99. int type=GetType(m_filter);
  100. if(type==1)//电话
  101. {BOOL bFinded=0;
  102. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  103. {
  104. if(bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  105. {
  106. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  107. continue;
  108. }
  109. if(m_List1array.ElementAt (ii).ElementAt (7).Find (m_filter)!=-1\
  110. || m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 )
  111. {
  112. bFinded=1;
  113. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  114. }
  115. else
  116. {
  117. bFinded=0;
  118. }
  119. }
  120. }
  121. else if(type==2)//拼音
  122. {BOOL bFinded=0;
  123. m_filter.MakeUpper ();
  124. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  125. {
  126. if(bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  127. {
  128. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  129. continue;
  130. }
  131. if(m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1\
  132. || m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1 )
  133. {
  134. bFinded=1;
  135. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  136. }
  137. else
  138. {
  139. bFinded=0;
  140. }
  141. }
  142. }
  143. else
  144. {
  145. BOOL bFinded=0;
  146. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  147. {
  148. if(bFinded && m_List1array.ElementAt (ii).ElementAt (0).IsEmpty ())
  149. {
  150. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  151. continue;
  152. }
  153. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1\
  154. || m_List1array.ElementAt (ii).ElementAt (5).Find (m_filter)!=-1\
  155. || m_List1array.ElementAt (ii).ElementAt (6).Find (m_filter)!=-1\
  156. || m_List1array.ElementAt (ii).ElementAt (7).Find (m_filter)!=-1\
  157. || m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1 )
  158. {
  159. bFinded=1;
  160. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  161. }
  162. else
  163. {
  164. bFinded=0;
  165. }
  166. }
  167. }
  168. }
  169. m_List1.m_arLabels.SetSize(count, 1);
  170. ii=count;
  171. m_List1.m_LabelCount=ii;
  172. m_List1.SetItemCountEx (ii);
  173. }
  174. void PhotoPrintFrom::OnBUTclose()
  175. {
  176. // TODO: Add your control notification handler code here
  177. GetParent()->SendMessage(WM_CLOSE);
  178. }
  179. void PhotoPrintFrom::OnButton1()
  180. {
  181. // TODO: Add your control notification handler code here
  182. UpdateData();
  183. m_filter.TrimLeft ();
  184. m_filter.TrimRight ();
  185. FillGrid();
  186. }
  187. void PhotoPrintFrom::OnSelchangeCombo1()
  188. {
  189. // TODO: Add your control notification handler code here
  190. SetTimer(1, 100, NULL);
  191. }
  192. void PhotoPrintFrom::OnTimer(UINT nIDEvent)
  193. {
  194. // TODO: Add your message handler code here and/or call default
  195. KillTimer(nIDEvent);
  196. OnButton1();
  197. }
  198. BOOL PhotoPrintFrom::PreTranslateMessage(MSG* pMsg)
  199. {
  200. // TODO: Add your specialized code here and/or call the base class
  201. try
  202. {
  203. if(pMsg->message==WM_KEYDOWN)
  204. {
  205. switch (pMsg->wParam)
  206. {
  207. case VK_RETURN:
  208. OnButton1();
  209. return 1;
  210. case 0x43: // copy
  211. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  212. {
  213. GetFocus()->SendMessage(WM_COPY);
  214. return TRUE;
  215. }
  216. break;
  217. case 0x56: //Ctrl + V:
  218. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  219. {
  220. GetFocus()->SendMessage(WM_PASTE);
  221. return TRUE;
  222. }
  223. break;
  224. case 0x58: // cut
  225. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  226. {
  227. GetFocus()->SendMessage(WM_CUT);
  228. return TRUE;
  229. }
  230. break;
  231. case 0x5A: //undo
  232. case 0x59: //redo
  233. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  234. {
  235. GetFocus()->SendMessage(WM_UNDO);
  236. return TRUE;
  237. }
  238. break;
  239. }
  240. }
  241. /* else if(pMsg->message==WM_LBUTTONDOWN)
  242. {
  243. CPoint pt;
  244. CRect rc,rc2;
  245. ::GetCursorPos (&pt);
  246. m_List1.GetWindowRect (rc2);
  247. pt.x-=rc2.left ;
  248. pt.y-=rc2.top ;
  249. m_List1.GetHeaderCtrl()->GetItemRect (0, rc);
  250. rc.right =rc.left +rc2.Width ();
  251. if(rc.PtInRect (pt))
  252. return 1;
  253. }*/
  254. return CFormView::PreTranslateMessage(pMsg);
  255. }
  256. catch(...)
  257. {
  258. }
  259. }