GRAPH.C
上传用户:bjghjy
上传日期:2007-01-07
资源大小:379k
文件大小:15k
源码类别:

金融证券系统

开发平台:

Visual C++

  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include "hq.h"
  6. #include "hq_cl.h"
  7. #include "msg.h"
  8.                      //10,20,30
  9. GRAPH_PARA def_para ={30, 40, 30};
  10. LPGRAPH_PARA gra_para[] ={&GraphData.xlt, &GraphData.jlt, NULL};
  11. LPSTR gra_items[] ={"XLT", "JLT", NULL};
  12. extern BOOL GetInitString(LPSTR, LPSTR, LPSTR);
  13. extern BOOL PutInitString(LPSTR, LPSTR, LPSTR);
  14. extern ErrMsg(HWND, LPSTR);
  15. extern HWND ghWndMain, ghWndXlt, ghWndJlt;
  16. extern BOOL IsZsRec(int, int);
  17. HBITMAP hBmp =NULL;
  18. //this macro return respond x coor accroding to time value
  19. #define COOR(tim)  (tim>=HqTime[GraphData.jys].pm_min_start?HqTime[GraphData.jys].am_min_count+(tim-HqTime[GraphData.jys].pm_min_start):tim -HqTime[GraphData.jys].am_min_start)
  20. //this macro return respond time value accroding to set serial
  21. #define TIME(x) (x>=HqTime[GraphData.jys].am_min_count?HqTime[GraphData.jys].pm_min_start+x-HqTime[GraphData.jys].am_min_count:HqTime[GraphData.jys].am_min_start+x)
  22. #define R_DOTS 0 //预留空间
  23.                                  
  24. BOOL GraphInit()
  25. {
  26. int i;
  27. char tmp[100];
  28. LPSTR tok;
  29. int r, g, b;
  30. LOGFONT lf;
  31. i =0;
  32. while(gra_items[i])
  33. {
  34. if(!GetInitString("GRAPH", gra_items[i], tmp))
  35. {
  36. memcpy(gra_para[i], &def_para, sizeof(GRAPH_PARA));
  37. sprintf(tmp, "%i,%i,%i", def_para.ma[0], def_para.ma[1], def_para.ma[2]);
  38. PutInitString("GRAPH", gra_items[i], tmp);
  39. }
  40. else
  41. {
  42. if(!(tok =strtok(tmp, ",")))
  43. {
  44. memcpy(gra_para[i], &def_para, sizeof(GRAPH_PARA));
  45. i++;
  46. continue;
  47. }
  48. while(*tok ==' ') tok++;
  49. gra_para[i]->ma[0] =atoi(tok);
  50. if(!(tok =strtok(NULL, ",")))
  51. {
  52. memcpy(gra_para[i], &def_para, sizeof(GRAPH_PARA));
  53. i++;
  54. continue;
  55. }
  56. while(*tok ==' ') tok++;
  57. gra_para[i]->ma[1] =atoi(tok);
  58. if(!(tok =strtok(NULL, ",")))
  59. {
  60. memcpy(gra_para[i], &def_para, sizeof(GRAPH_PARA));
  61. i++;
  62. continue;
  63. }
  64. while(*tok ==' ') tok++;
  65. gra_para[i]->gap =atoi(tok);
  66. }
  67. i++;
  68. }
  69. if(!GetInitString("GRAPH", "COLOR1", tmp))
  70. {
  71. strcpy(tmp, "180,180,0");
  72. PutInitString("GRAPH", "COLOR1", tmp);
  73. }
  74. r =255;
  75. if(tok =strtok(tmp, ","))
  76. r =atoi(tok)%256;
  77. g =0;
  78. if(tok)
  79. if(tok =strtok(NULL, ","))
  80. g =atoi(tok)%256;
  81. b =255;
  82. if(tok)
  83. if(tok =strtok(NULL, ","))
  84. b =atoi(tok)%256;
  85. GraphData.color[0] =RGB(r, g, b);
  86. if(!GetInitString("GRAPH", "COLOR2", tmp))
  87. {
  88. strcpy(tmp, "0,255,255");
  89. PutInitString("GRAPH", "COLOR2", tmp);
  90. }
  91. r =0;
  92. if(tok =strtok(tmp, ","))
  93. r =atoi(tok)%256;
  94. g =255;
  95. if(tok)
  96. if(tok =strtok(NULL, ","))
  97. g =atoi(tok)%256;
  98. b =255;
  99. if(tok)
  100. if(tok =strtok(NULL, ","))
  101. b =atoi(tok)%256;
  102. GraphData.color[1] =RGB(r, g, b);
  103. memset(&lf, 0, sizeof(lf));
  104. lf.lfHeight =13;
  105. lf.lfWeight =FW_NORMAL;
  106. strcpy(lf.lfFaceName, "Termianl");
  107. GraphData.hFont =CreateFontIndirect(&lf);
  108.     
  109.     if(GraphData.hFont ==NULL)
  110.     {
  111.      ErrMsg(ghWndMain, "Create font failed!");
  112.     }
  113. return TRUE;
  114. }
  115. void GraphExit(void)
  116. {
  117. if(GraphData.hFont) DeleteObject(GraphData.hFont);
  118. if(hBmp) DeleteObject(hBmp);
  119. }
  120. int vLineTo(HDC hDC, int x1, int y1)
  121. {
  122.     int x0,y0,i;
  123.     DWORD dw;
  124.     
  125.     dw =GetCurrentPosition(hDC);
  126.     x0 =LOWORD(dw);
  127.     y0 =HIWORD(dw);
  128.     if(y1>y0)
  129.     {
  130.      for(i=y0;i<=y1;i++)
  131.      {
  132.          if(i-(int)(i/4)*4==0)        
  133.      SetPixel(hDC,x0,i,RGB(80,80,80));    
  134.      }
  135.     }
  136.     if(y1<y0)
  137.     {
  138.      for(i=y0;i>=y1;i--)
  139.      {
  140.          if(i-(int)(i/4)*4==0)        
  141.      SetPixel(hDC,x0,i,RGB(80,80,80));    
  142.      }    
  143.     }
  144. return 0;
  145. }
  146. int hLineTo(HDC hDC, int x1, int y1)
  147. {
  148.     int x0,y0,i;
  149.     DWORD dw;
  150.     
  151.     dw =GetCurrentPosition(hDC);
  152.     x0 =LOWORD(dw);
  153.     y0 =HIWORD(dw);
  154.     if(x1>x0)
  155.     {
  156.      for(i=x0;i<=x1;i++)
  157.      {
  158.          if(i-(int)(i/4)*4==0)        
  159.      SetPixel(hDC,i,y0,RGB(100,100,100));    
  160.      }
  161.     }
  162.     if(x1<x0)
  163.     {
  164.      for(i=x0;i>=x1;i--)
  165.      {
  166.          if(i-(int)(i/4)*4==0)        
  167.      SetPixel(hDC,i,y0,RGB(100,100,100));    
  168.      }    
  169.     }
  170. return 0;
  171. }
  172. int DrawXlt(HDC hDC, LPRECT rc)
  173. {
  174. int i, k,j;
  175. int ma;
  176. double fplus;
  177. float zjjg;
  178. double fhdj, fwdt, f ,zgjg;
  179. HPEN hPen, hPenRed, hPenGreen;
  180. int tim;
  181. char tmp[20];
  182. //画Y坐标
  183. hPen =CreatePen(PS_SOLID, 2, RGB(255, 255, 255));
  184. SelectObject(hDC, hPen);
  185. MoveTo(hDC,rc->left,rc->bottom);
  186. LineTo(hDC,rc->left,rc->top+2);
  187. LineTo(hDC,rc->right-1,rc->top+2);
  188. SelectObject(hDC,GetStockObject(WHITE_PEN));
  189. DeleteObject(hPen);
  190. if(GraphData.minEnd <=0 || GraphData.minCount <=0) return -1;
  191. SelectObject(hDC, GetStockObject(WHITE_PEN));
  192. fwdt =(double)(rc->right-rc->left)/(HqTime[HqPaintData.jys].am_min_count
  193. +HqTime[HqPaintData.jys].pm_min_count+R_DOTS);
  194. if(GraphData.GraHead.zgjg==0)
  195. zgjg = 100.00;
  196. else
  197.     zgjg =GraphData.GraHead.zgjg;
  198.     
  199. fhdj =(double)(rc->bottom-rc->top)/(zgjg*2);
  200. SetViewportOrg(hDC, rc->left, rc->bottom-(rc->bottom-rc->top)/2);
  201. SetTextColor(hDC, RGB(255, 255, 0));
  202. SelectObject(hDC, GraphData.hFont);
  203. //画X坐标
  204. hPen =CreatePen(PS_SOLID, 1, RGB(80, 80, 80));
  205. SelectObject(hDC, hPen);
  206. for(f =-GraphData.GraHead.zgjg; f<=zgjg+0.001;f+=zgjg/5)
  207. {
  208. MoveTo(hDC, rc->right-rc->left-2, (int)(f*fhdj));
  209. LineTo(hDC, 0, (int)(f*fhdj));
  210. sprintf(tmp, "%.2f", f+GraphData.GraHead.zrsp);
  211. if((int)(f*100) >0)
  212. SetTextColor(hDC, RGB(255, 0, 0));
  213. else if((int)(f*100) <0)
  214. SetTextColor(hDC, RGB(0, 255, 0));
  215. else SetTextColor(hDC, RGB(255, 255, 255));
  216. SetTextAlign(hDC, TA_RIGHT|TA_BASELINE);
  217. TextOut(hDC, -4, -(int)(f*fhdj), tmp, strlen(tmp));
  218. sprintf(tmp, "%.1f%c", f*100/GraphData.GraHead.zrsp,'%');
  219. SetTextAlign(hDC, TA_LEFT|TA_BASELINE);
  220. TextOut(hDC, rc->right-rc->left+2, -(int)(f*fhdj), tmp, strlen(tmp));
  221. }
  222. SelectObject(hDC, GetStockObject(WHITE_PEN));
  223. DeleteObject(hPen);
  224. hPen =CreatePen(PS_SOLID, 2, RGB(255, 255, 255));
  225. SelectObject(hDC, hPen);
  226. MoveTo(hDC, 0, 0);
  227. LineTo(hDC, rc->right-rc->left-2, 0);
  228. SelectObject(hDC, GetStockObject(WHITE_PEN));
  229. DeleteObject(hPen);
  230. tim =GraphData.lpGraData[0].tim;
  231. hPenRed =CreatePen(PS_SOLID, 1, RGB(200, 0, 200));
  232. hPenGreen =CreatePen(PS_SOLID, 1, RGB(0, 255, 0));
  233. zjjg =GraphData.lpGraData[0].zjjg;
  234. MoveTo(hDC, (int)(fwdt*COOR(tim)), -(int)(fhdj*zjjg));
  235. for(i =1; i<GraphData.minCount; i++)
  236. {
  237. tim =GraphData.lpGraData[GraphData.lpMinPos[i]].tim;
  238. if(tim>HqTime[GraphData.jys].pm_min_start+HqTime[GraphData.jys].pm_min_count)
  239. break;
  240. if(tim==0) continue;
  241. zjjg =GraphData.lpGraData[GraphData.lpMinPos[i]].zjjg;
  242. SelectObject(hDC, hPenRed);
  243. LineTo(hDC, (int)(fwdt*COOR(tim)), -(int)(fhdj*zjjg));
  244. }
  245. SelectObject(hDC, GetStockObject(WHITE_PEN));
  246. DeleteObject(hPenRed);
  247. DeleteObject(hPenGreen);
  248. for(k =0; k<1; k++)
  249. {
  250. ma =GraphData.xlt.ma[k];
  251. if(GraphData.minCount<ma) continue;
  252. hPen =CreatePen(PS_SOLID, 0, RGB(255,255,0));//GraphData.color[k]);
  253. SelectObject(hDC, hPen);
  254. //SetROP2(hDC, R2_XORPEN);
  255.         ///////////////////////////////////////////////////////////        
  256.         //以下为分时平均
  257. //fplus =(float)0.0;
  258. //for(i =0; i<ma; i++)
  259. // fplus +=GraphData.lpGraData[GraphData.lpMinPos[i]].zjjg;
  260. //tim =GraphData.lpGraData[GraphData.lpMinPos[i-1]].tim;
  261. //MoveTo(hDC, (int)(fwdt*COOR(tim)), -(int)(fhdj*fplus/ma));
  262. //
  263. //for(; i<GraphData.minCount; i++)
  264. //{
  265. // zjjg =GraphData.lpGraData[GraphData.lpMinPos[i-ma]].zjjg;
  266. // fplus-=zjjg;
  267. // zjjg =GraphData.lpGraData[GraphData.lpMinPos[i]].zjjg;
  268. // fplus +=zjjg;
  269. // tim =GraphData.lpGraData[GraphData.lpMinPos[i]].tim;
  270. // if(tim == 0) continue;
  271. // if(tim >=HqTime[GraphData.jys].pm_min_start)
  272. // tim =HqTime[GraphData.jys].am_min_count
  273. // +(tim-HqTime[GraphData.jys].pm_min_start);
  274. // else tim -=HqTime[GraphData.jys].am_min_start;
  275. // LineTo(hDC, (int)(fwdt*tim), -(int)(fhdj*fplus/ma));
  276. //} 
  277. ///////////////////////////////////////////////////////////
  278. //以下为平均线
  279. for(i=0,j=1,fplus=0;i<GraphData.minCount;i++)
  280. {
  281.     if(GraphData.lpGraData[GraphData.lpMinPos[i]].tim==0)
  282.      continue;
  283.   fplus +=GraphData.lpGraData[GraphData.lpMinPos[i]].zjjg;
  284. tim =GraphData.lpGraData[GraphData.lpMinPos[i]].tim;
  285. if(tim>HqTime[GraphData.jys].pm_min_start+HqTime[GraphData.jys].pm_min_count)
  286. break;
  287. if(i==0)
  288.   MoveTo(hDC, (int)(fwdt*COOR(tim)), -(int)(fhdj*fplus/j++));
  289.   else
  290.   LineTo(hDC, (int)(fwdt*COOR(tim)), -(int)(fhdj*fplus/j++));
  291. }
  292. SelectObject(hDC, GetStockObject(WHITE_PEN));
  293. DeleteObject(hPen);
  294. }
  295. return 0;
  296. }
  297. int DrawJlt(HDC hDC, LPRECT rc)
  298. {
  299. int i;
  300. //int ma;
  301. //long lplus;
  302. double fhdj, fwdt, zjjg, lastjg;
  303. long l, val, oldval;
  304. HPEN hPen, hPenRed, hPenGreen;
  305. int tim;
  306. char tmp[20];
  307. int ll;
  308. //画X坐标及Y坐标
  309. hPen =CreatePen(PS_SOLID, 2, RGB(255, 255, 255));
  310. SelectObject(hDC, hPen);
  311. MoveTo(hDC,rc->left,0);
  312. LineTo(hDC,rc->left,rc->bottom+1);
  313. LineTo(hDC,rc->right, rc->bottom+1);
  314. SelectObject(hDC,GetStockObject(WHITE_PEN));
  315. DeleteObject(hPen);
  316. if(GraphData.minEnd <=0 || GraphData.minCount <=0) 
  317. return -1;
  318. SelectObject(hDC, GetStockObject(WHITE_PEN));
  319. fwdt =(double)(rc->right-rc->left)/(HqTime[HqPaintData.jys].am_min_count
  320. +HqTime[HqPaintData.jys].pm_min_count+R_DOTS);
  321. if(GraphData.GraHead.zglc ==0) return -1;
  322. fhdj =(double)(rc->bottom-rc->top)/GraphData.GraHead.zglc;
  323. SetTextColor(hDC, RGB(255, 255, 0));
  324. SetTextAlign(hDC, TA_RIGHT|TA_TOP);
  325. val =0;
  326. if(IsZsRec(GraphData.jys, GraphData.recNum))
  327. ll =100;
  328. else ll =1;
  329. hPen =CreatePen(PS_SOLID, 1, RGB(80, 80, 80));
  330. SelectObject(hDC, hPen);
  331. if(fhdj)
  332. {
  333. oldval =val;
  334. if(GraphData.GraHead.zglc <100)
  335. {
  336. for(i =1; i<5; i++)
  337. {
  338. val =GraphData.GraHead.zglc*i/5;
  339. wsprintf(tmp, "%ld", val);
  340. MoveTo(hDC, rc->right-2, rc->bottom-(int)(fhdj*val));
  341. LineTo(hDC, rc->left, rc->bottom-(int)(fhdj*val));
  342. TextOut(hDC, rc->left-4, rc->bottom-(int)(fhdj*val)-4,
  343. tmp, strlen(tmp));
  344. }
  345. }
  346. else
  347. for(l =GraphData.GraHead.zglc/5; l >=0 && l<=GraphData.GraHead.zglc; l+=GraphData.GraHead.zglc/5)
  348. {
  349. wsprintf(tmp, "%ld", l);
  350. i =strlen(tmp)-2;
  351. if(i>0)
  352. {
  353. val =1;
  354. while(i-->0)
  355. val *=10;
  356. val =l -l%val;
  357. if(oldval ==val) continue;
  358. wsprintf(tmp, "%ld", val);
  359. }
  360. else
  361. val =l;
  362. MoveTo(hDC, rc->right-2, rc->bottom-(int)(fhdj*val));
  363. LineTo(hDC, rc->left, rc->bottom-(int)(fhdj*val));
  364. TextOut(hDC, rc->left-4, rc->bottom-(int)(fhdj*val)-4,
  365. tmp, strlen(tmp));
  366. if(val >GraphData.GraHead.zglc) break;
  367. oldval =val;
  368. }
  369. }
  370. SelectObject(hDC, GetStockObject(WHITE_PEN));
  371. DeleteObject(hPen);
  372. hPenRed =CreatePen(PS_SOLID, 1, RGB(255, 0, 255));
  373. hPenGreen =CreatePen(PS_SOLID, 1, RGB(0, 255, 255));
  374. zjjg =GraphData.lpGraData[GraphData.lpMinPos[0]].zjjg;
  375. lastjg =GraphData.GraHead.zrsp;
  376. for(i =0; i<GraphData.minCount; i++)
  377. {
  378. tim =GraphData.lpGraData[GraphData.lpMinPos[i]].tim;
  379. if(tim>HqTime[GraphData.jys].pm_min_start+HqTime[GraphData.jys].pm_min_count)
  380. break;
  381. if(tim ==0) continue;
  382. zjjg =GraphData.lpGraData[GraphData.lpMinPos[i]].zjjg;
  383. if(zjjg>lastjg)
  384. SelectObject(hDC, hPenRed);
  385. else if(zjjg<lastjg)
  386. SelectObject(hDC, hPenGreen);
  387. else
  388.     SelectObject(hDC, hPenRed);
  389.     
  390. l =GraphData.lpMinLc[i];
  391. MoveTo(hDC, rc->left+(int)(fwdt*COOR(tim)), rc->bottom);
  392. LineTo(hDC, rc->left+(int)(fwdt*COOR(tim)),
  393. rc->bottom-(int)(fhdj*l));
  394. lastjg =zjjg;
  395. }
  396. SelectObject(hDC, GetStockObject(WHITE_PEN));
  397. DeleteObject(hPenGreen);
  398. DeleteObject(hPenRed);
  399. //分时平均线 
  400. /*
  401. ma =GraphData.jlt.ma[0];
  402. if(GraphData.minCount <ma) return 0;
  403. hPen =CreatePen(PS_SOLID, 0, GraphData.color[0]);
  404. SelectObject(hDC, hPen);
  405. lplus =0L;
  406. for(i =0; i<ma; i++)
  407. lplus +=GraphData.lpMinLc[i];
  408. tim =GraphData.lpGraData[GraphData.lpMinPos[i-1]].tim;
  409. MoveTo(hDC, rc->left+(int)(fwdt*COOR(tim)), rc->bottom-(int)(fhdj*(lplus/ma)));
  410. for(; i<GraphData.minCount; i++)
  411. {
  412. lplus-=GraphData.lpMinLc[i-ma];
  413. lplus +=GraphData.lpMinLc[i];
  414. tim =GraphData.lpGraData[GraphData.lpMinPos[i-1]].tim;
  415. if(tim>HqTime[GraphData.jys].pm_min_start+HqTime[GraphData.jys].pm_min_count)
  416. break;
  417. if(tim ==0) continue;
  418. LineTo(hDC, rc->left+(int)(fwdt*COOR(tim)), rc->bottom-(int)(fhdj*(lplus/ma)));
  419. }
  420. SelectObject(hDC, GetStockObject(WHITE_PEN));
  421. DeleteObject(hPen);
  422. */
  423. return 0;
  424. }
  425. int DrawTimeLines(HWND hWnd,HDC hDC, LPRECT rc, BOOL fDrawText)
  426. {
  427. int i, j;
  428. char tmp[50];
  429. HPEN hPen;
  430. double fwdt;
  431. int top;
  432. if(hWnd ==ghWndJlt) top =0;
  433. else top =rc->top+1;
  434. j = HqTime[HqPaintData.jys].am_min_count
  435. +HqTime[HqPaintData.jys].pm_min_count+R_DOTS;
  436. fwdt =(double)(rc->right-rc->left)/j;
  437. hPen =CreatePen(PS_SOLID, 0, RGB(80, 80, 80));
  438. SelectObject(hDC, hPen);
  439. SetTextAlign(hDC, TA_LEFT|TA_TOP);
  440. SelectObject(hDC, GraphData.hFont);
  441. for(i=0;i<=j;i=i+30)
  442. {     
  443. if(i>0)
  444. {
  445. MoveTo(hDC, rc->left+(int)(fwdt*i), top);
  446. LineTo(hDC, rc->left+(int)(fwdt*i), rc->bottom);
  447. }
  448. if(fDrawText)
  449. {
  450. wsprintf(tmp, "%d:%02d",TIME(i)/60,TIME(i)%60);
  451. TextOut(hDC, rc->left+(int)(fwdt*i), rc->bottom+2,
  452. tmp,strlen(tmp));
  453. }
  454. }
  455. SelectObject(hDC, GetStockObject(WHITE_PEN));
  456. DeleteObject(hPen);
  457. return 0;
  458. }
  459. BOOL fVLineDrawed =FALSE;
  460. extern int graphTop;
  461. extern HBITMAP getImage(HDC, LPRECT);
  462. extern int putImage(HDC, HBITMAP, LPRECT);
  463. extern int CapHig;
  464. int DrawVLine(int pos)
  465. {
  466. static int minNum =0;
  467. RECT rc, rc1, rc2;
  468. float fwdt, fhdj;
  469. HDC hDC;
  470. char tmp[100];
  471. static int slen =0;
  472. int ll;
  473. int timPos =0;
  474. static RECT rcJg;
  475. if(GraphData.minCount <=0 || GraphData.minEnd <=0) return 0;
  476. GetWindowRect(ghWndXlt, &rc1);
  477. SetRect(&rc, 0, graphTop, rc1.right-rc1.left, rc1.bottom-rc1.top-1);
  478. fwdt =(float)(rc1.right-rc1.left-80)/(HqTime[HqPaintData.jys].am_min_count
  479. +HqTime[HqPaintData.jys].pm_min_count+R_DOTS);
  480. fhdj =(float)(rc.bottom-rc.top-10)/(GraphData.GraHead.zgjg*2);
  481. hDC =GetDC(NULL);
  482. SetROP2(hDC, R2_NOT);
  483. if(minNum+pos <0)
  484. pos =GraphData.minCount-1 -minNum;
  485. if(minNum >=GraphData.minCount) minNum =GraphData.minCount-1;
  486. if(minNum+pos >=GraphData.minCount) pos =-minNum;
  487. GetWindowRect(ghWndJlt, &rc2);
  488. rc2.bottom -=10;
  489. timPos =GraphData.lpGraData[GraphData.lpMinPos[minNum]].tim;
  490. MoveTo(hDC, rc1.left+50+(int)(fwdt*COOR(timPos)), rc1.top+graphTop+2);
  491. LineTo(hDC, rc1.left+50+(int)(fwdt*COOR(timPos)), rc2.bottom-20);
  492. if(pos && fVLineDrawed)
  493. {   
  494.     do
  495.     {
  496. minNum +=pos;
  497. timPos =GraphData.lpGraData[GraphData.lpMinPos[minNum]].tim;
  498. }while(timPos ==0);
  499. if(timPos >=HqTime[GraphData.jys].pm_min_start)
  500. timPos =HqTime[GraphData.jys].am_min_count+(timPos-HqTime[GraphData.jys].pm_min_start);
  501. else timPos -=HqTime[GraphData.jys].am_min_start;
  502. MoveTo(hDC, rc1.left+50+(int)(fwdt*timPos), rc1.top+graphTop+2);
  503. LineTo(hDC, rc1.left+50+(int)(fwdt*timPos), rc2.bottom-20);
  504. }
  505. fVLineDrawed =TRUE;
  506. if(IsZsRec(GraphData.jys, GraphData.recNum))
  507. ll =100;
  508. else ll =1;
  509. sprintf(tmp, "时间:%2d:%02d 价格:%6.2f 量差:%5ld 总量:%8ld",
  510.             GraphData.lpGraData[GraphData.lpMinPos[minNum]].tim/60,
  511.             GraphData.lpGraData[GraphData.lpMinPos[minNum]].tim%60,
  512. GraphData.lpGraData[GraphData.lpMinPos[minNum]].zjjg+GraphData.GraHead.zrsp,
  513. GraphData.lpMinLc[minNum],
  514. GraphData.lpGraData[GraphData.lpMinPos[minNum]].zl);
  515. if(GraphData.lpGraData[GraphData.lpMinPos[minNum]].zjjg<0)
  516. SetTextColor(hDC, RGB(0, 255, 0));
  517. else SetTextColor(hDC, RGB(255, 0, 0));
  518. SetROP2(hDC, R2_COPYPEN);
  519. SelectObject(hDC,GetStockObject(BLACK_BRUSH));
  520. ReleaseDC(NULL, hDC); 
  521. GetWindowRect(ghWndMain,&rc);
  522. GetWindowRect(ghWndXlt,&rc1);
  523. GetWindowRect(ghWndMsg,&rc2);
  524. if(pos&& fVLineDrawed)
  525. Msg(tmp,MSG_VERT|MSG_TIME);
  526. else
  527. Msg(tmp,MSG_HIDE);
  528. return 0;
  529. }