OSDN Git Service

2012/01/09 1:42:48
[nlite/nlite.git] / nlite / nlite_commentview.cpp
1 #include "stdafx.h"
2 #include "nlite_include.h"
3
4
5
6 CCommentView::CCommentView():
7                 hScrollInfo()
8         {
9                 hScrollInfo.fMask = SIF_ALL;
10                 hScrollInfo.cbSize = sizeof(hScrollInfo);
11                 LOGFONT lf = {0};
12                 lf.lfHeight = 10;
13                 lf.lfCharSet = SHIFTJIS_CHARSET;
14
15
16                 hHeaderFontNew = CreateFontIndirect(&lf);
17
18                 colLinePen.CreatePen(PS_SOLID,1,RGB(224,224,224));
19                 outLinePenNomal.CreatePen(PS_SOLID,1,RGB(127,127,127));
20                 outLinePenSelect.CreatePen(PS_SOLID,1,RGB(255,0,0));
21                 bkBurushSelect.CreateSolidBrush(RGB(255,240,240));
22                 return;
23
24 }
25
26 CCommentView::~CCommentView(){
27
28         colLinePen.DeleteObject();
29         outLinePenNomal.DeleteObject();
30         outLinePenSelect.DeleteObject();
31         bkBurushSelect.DeleteObject();
32         DeleteObject(hHeaderFontNew);
33
34         return;
35 }
36
37
38
39 VOID CCommentView::Lock(){
40         ccs.Lock();
41 }
42
43 VOID CCommentView::Unlock(){
44         ccs.Unlock();
45 }
46
47
48 VOID CCommentView::OnConnect(){
49         commentlist.OnConnect();
50         m_listBox.SetRedraw(FALSE);
51         m_listBox.ResetContent();
52 }
53
54
55 UINT_PTR CCommentView::GetColumnHolSizeSum(){
56
57         return hScrollInfo.nMax;
58 }
59
60 VOID CCommentView::SetProperty(CommentViewProperty &setProperty){
61
62         viewproperty = setProperty;
63
64         if(bkBurushNomal.IsNull() == FALSE){
65                 bkBurushNomal.DeleteObject();
66         }
67         bkBurushNomal.CreateSolidBrush(viewproperty.backColor);
68         return;
69 }
70
71 CommentViewProperty &CCommentView::GetProperty(){
72
73         return viewproperty;
74
75 }
76
77 VOID CCommentView::OnMeasureItem(UINT wParam,LPMEASUREITEMSTRUCT lpMersureItemStruct){
78
79         if(lpMersureItemStruct->CtlID == commentViewConstant::LISTBOX_ID){
80
81                 auto &chat = *(CChatData*)lpMersureItemStruct->itemData;
82
83                 CDC cdc = m_listBox.GetDC();
84         
85                 RECT drowSize;
86                 m_header.GetItemRect(COMMENT,&drowSize);
87                 drowSize.left += 2;
88                 drowSize.top +=  2;
89                 drowSize.right -= 2;
90                 drowSize.bottom = 0;
91         
92                 SelectObject(cdc,AtlGetDefaultGuiFont());
93
94         
95                 cdc.DrawTextW(chat.chatBuf.c_str(),chat.chatBuf.length(),&drowSize, DT_CALCRECT | DT_WORDBREAK);
96         
97                 drowSize.top -= 2;
98                 drowSize.bottom += 2;
99
100                 lpMersureItemStruct->itemHeight = drowSize.bottom - drowSize.top;
101
102         }
103         
104
105         return;
106 }
107
108
109
110 HWND CCommentView::Create(HWND hWndParent){
111
112         
113
114         HWND rslt = __super::Create(hWndParent,0,commentViewConstant::NLITE_COMMENTVIEW,WS_VISIBLE | WS_CHILD | WS_HSCROLL | WS_BORDER,0,commentViewConstant::MENU_OR_ID);
115
116         PAINTSTRUCT ps;
117         HDC hdc = m_header.BeginPaint(&ps);
118         SIZE size;
119
120         HFONT hOld = (HFONT)SelectObject(hdc,hHeaderFontNew);
121
122         LPTSTR columns[] = {TEXT("\83R\83\81\94Ô"),TEXT("\83\86\81[\83U\81[\96¼"),TEXT("\83R\83\81\83\93\83g"),TEXT("\8e\9e\8aÔ"),TEXT("\8fî\95ñ")};
123         UINT_PTR holizenSize[] = {0,0,100,0,0};
124
125         for(UINT_PTR index = 0;index < ARRAY_LENGTH(columns) ;++index){
126
127                 GetTextExtentPoint32(hdc , columns[index] , _tcslen(columns[index]) , &size);
128                 UINT_PTR holsize = holizenSize[index] + size.cx + 15;
129                 holizenSize[index] = viewproperty.headerholSize[index] >= 0 ? viewproperty.headerholSize[index] : holsize;
130         }
131
132         SelectObject(hdc,hOld);
133
134         m_header.EndPaint(&ps);
135                         
136                         
137         HEADERSINFO headersinfo = {columns,holizenSize,ARRAY_LENGTH(columns)};
138
139         AddHeader(&headersinfo);
140
141         m_header.SetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
142                 
143                         
144         
145                         
146         return rslt;
147 }
148
149
150
151
152 LRESULT CCommentView::OnheaderItemChanged(LPNMHDR lParam){
153
154         
155         if(lParam->hwndFrom == m_header.m_hWnd){
156
157                 INT_PTR curSel = m_listBox.GetCurSel();
158
159                 SCROLLINFO scrollInfo = {0};
160                 scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
161                 m_listBox.GetScrollInfo(SB_VERT,&scrollInfo);
162                 scrollInfo.nPos++;
163                 BOOL scrollFlag = scrollInfo.nPos + (int)scrollInfo.nPage >= scrollInfo.nMax;
164                 UINT_PTR commentCount = commentlist.Size();
165
166         
167                 m_listBox.SetRedraw(FALSE);
168                 m_listBox.ResetContent();
169                 for(UINT_PTR index =0;index < commentCount;index++){
170                         m_listBox.AddString((LPCTSTR)&commentlist.GetChatAt(index));
171                 }
172         
173
174         
175
176                 m_listBox.SetCurSel(curSel);
177
178         
179
180                 m_listBox.SetRedraw(TRUE);
181                 m_listBox.Invalidate();
182         
183
184                 if(scrollFlag == TRUE){
185
186                         m_listBox.SendMessageW(WM_VSCROLL,SB_BOTTOM,0);
187                 }
188
189                 INT_PTR itemCount = m_header.GetItemCount();
190                 RECT itemSizeRect;
191                 hScrollInfo.nMax = 0;
192                 for(INT_PTR imtemIndex = 0;imtemIndex < itemCount;imtemIndex++){
193                         m_header.GetItemRect(imtemIndex,&itemSizeRect);
194                         hScrollInfo.nMax += itemSizeRect.right - itemSizeRect.left;
195
196                 }
197
198                 this->SetScrollInfo(SB_HORZ,&hScrollInfo,TRUE);
199                 DecisionHorzSize();
200                                 
201         }
202
203         return 0;
204 }
205
206 VOID CCommentView::OnChatReceve(NicoLiveChat_P chat,UINT_PTR count){
207         
208
209         
210         Lock();
211         commentlist.OnChatReceve(chat,count);
212         m_listBox.AddString((LPCTSTR)&commentlist.back());
213
214         SCROLLINFO scrollInfo = {0};
215         scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
216         m_listBox.GetScrollInfo(SB_VERT,&scrollInfo);
217         scrollInfo.nPos++;
218         
219         if(scrollInfo.nPos + (int)scrollInfo.nPage >= scrollInfo.nMax == TRUE){
220                 m_listBox.SendMessageW(WM_VSCROLL,SB_BOTTOM,0); 
221         }
222         Unlock();
223 }
224
225
226 VOID CCommentView::SetStreamStatus(StreamStatus &st){
227         
228         streamStatus.SetStreamStatus(st);
229 }
230
231 VOID CCommentView::OnChatReceveSettle(UINT_PTR commentCount,UINT_PTR commentCountSum){
232
233         m_listBox.SetRedraw(TRUE);
234         
235
236         return;
237 }
238
239 static UCHAR getrgb(){
240
241         
242         UCHAR rgb = 160 + rand() % 92;
243         return rgb;
244 }
245
246 LRESULT CCommentView::OnListBoxDoubleClick(UINT uNotifyCode, int nID, CWindow wndCtl){
247         
248
249
250         if(wndCtl.m_hWnd == m_listBox.m_hWnd){
251
252                 INT_PTR cursel = m_listBox.GetCurSel();
253                 if(cursel == LB_ERR)return 0;
254         
255                 auto chatData = commentlist.GetChatAt(cursel);
256                 COLORREF bkColor;
257                 if(chatData.listenerData->originBkFlag == FALSE){
258                         CListenerColorCollector colorCollector;
259                         listenerList.BkColorCollect(colorCollector);
260                         UCHAR red;
261                         UCHAR green;
262                         UCHAR blue;
263                 
264                         srand((unsigned int)time(NULL));
265                         do{
266
267                                 red = getrgb();
268                                 green = getrgb();
269                                 blue = getrgb();
270                                 bkColor = RGB(red,green,blue);
271
272                         }while(colorCollector.Find(bkColor));
273
274                         chatData.listenerData->originBkFlag = TRUE;
275
276                 } else {
277
278                         bkColor = viewproperty.backColor;
279                         chatData.listenerData->originBkFlag = FALSE;
280                 }
281
282         
283         
284
285                 chatData.listenerData->SetBkColor(bkColor);
286
287                 m_listBox.Invalidate(TRUE);
288         }
289
290         return 0;
291 }
292
293 VOID CCommentView::OnDrawItem(UINT wParam,LPDRAWITEMSTRUCT lpDrawItemStruct){
294
295         if((lpDrawItemStruct->hwndItem  == m_listBox.m_hWnd) && ((UINT)m_listBox.GetCount() > lpDrawItemStruct->itemID)){
296                                         
297                 RECT noViewRect;
298                 RECT userNameViewRect;
299                 RECT timeViewRect;
300                 RECT chatViewRect;
301                 RECT infoViewRect;
302
303         
304
305                 CChatData &chatData = *(CChatData*)lpDrawItemStruct->itemData;
306
307         
308
309                 time_t chatTime = (time_t)difftime(chatData.date,streamStatus.start_time);
310                 tm ct = *gmtime(&chatTime);
311                 
312                 
313                 TCHAR noString[sizeof(chatData.no) * 8]; 
314                 TCHAR dateString[LENGTH_16];
315                 _stprintf(noString,TEXT("%u"),chatData.no);
316
317                 _tcsftime(dateString,ARRAY_LENGTH(dateString),ct.tm_hour != 0 ? TEXT("%H:%M:%S") : TEXT("%M:%S"),&ct);
318
319         
320         
321                 //\91I\91ð\8fó\91Ô\82©\83`\83F\83b\83N
322                 if ((lpDrawItemStruct->itemState) & (ODS_SELECTED))
323                 {
324
325                         SelectObject(lpDrawItemStruct->hDC,bkBurushSelect);
326                         SelectObject(lpDrawItemStruct->hDC,outLinePenSelect);   
327                         SetBkColor(lpDrawItemStruct->hDC,RGB(255,240,240)) ;
328                 }
329                 else  
330                 {
331                         SelectObject(lpDrawItemStruct->hDC,outLinePenNomal);
332
333                         if(chatData.listenerData->originBkFlag == TRUE){
334                         
335                                 SelectObject(lpDrawItemStruct->hDC,chatData.listenerData->baseBkBrush);
336                                 SetBkColor(lpDrawItemStruct->hDC,chatData.listenerData->bkColor) ;
337
338                         } else {
339
340                                 SelectObject(lpDrawItemStruct->hDC,bkBurushNomal);
341                                 SetBkColor(lpDrawItemStruct->hDC,viewproperty.backColor) ;
342                         
343                         }
344                 }
345                 
346         
347                 //\83e\83L\83X\83g\82Ì\83J\83\89\81[\82ð\90Ý\92è
348                 SetTextColor(lpDrawItemStruct->hDC,viewproperty.baseStringColor);
349
350         
351         
352                 Rectangle(lpDrawItemStruct->hDC,lpDrawItemStruct->rcItem.left,lpDrawItemStruct->rcItem.top,lpDrawItemStruct->rcItem.right,lpDrawItemStruct->rcItem.bottom);
353
354
355
356
357
358
359
360                 //\95`\89æ\83T\83C\83Y\82ð\8cv\8eZ
361
362                 m_header.GetItemRect(NO,&noViewRect);
363                 m_header.GetItemRect(USERNAME,&userNameViewRect);
364                 m_header.GetItemRect(COMMENT,&chatViewRect);
365                 m_header.GetItemRect(TIME,&timeViewRect);
366                 m_header.GetItemRect(INFO,&infoViewRect);
367
368                 SelectObject(lpDrawItemStruct->hDC,colLinePen);
369         
370                 MoveToEx(lpDrawItemStruct->hDC,noViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
371                 LineTo(lpDrawItemStruct->hDC,noViewRect.right,lpDrawItemStruct->rcItem.bottom);
372                 MoveToEx(lpDrawItemStruct->hDC,userNameViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
373                 LineTo(lpDrawItemStruct->hDC,userNameViewRect.right,lpDrawItemStruct->rcItem.bottom);
374                 MoveToEx(lpDrawItemStruct->hDC,chatViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
375                 LineTo(lpDrawItemStruct->hDC,chatViewRect.right,lpDrawItemStruct->rcItem.bottom);
376                 MoveToEx(lpDrawItemStruct->hDC,timeViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
377                 LineTo(lpDrawItemStruct->hDC,timeViewRect.right,lpDrawItemStruct->rcItem.bottom);
378                 MoveToEx(lpDrawItemStruct->hDC,infoViewRect.right,lpDrawItemStruct->rcItem.top,NULL);
379                 LineTo(lpDrawItemStruct->hDC,infoViewRect.right,lpDrawItemStruct->rcItem.bottom);
380
381                 noViewRect.left += 2;
382                 userNameViewRect.left += 2;
383                 timeViewRect.left += 2;
384                 chatViewRect.left += 2;
385                 infoViewRect.left += 2;
386
387                 noViewRect.right += 2;
388                 userNameViewRect.right += 2;
389                 timeViewRect.right += 2;
390                 chatViewRect.right += 2;
391                 infoViewRect.right += 2;
392
393                 noViewRect.top = lpDrawItemStruct->rcItem.top + 2;
394                 userNameViewRect.top = lpDrawItemStruct->rcItem.top + 2;
395                 timeViewRect.top = lpDrawItemStruct->rcItem.top + 2;
396                 chatViewRect.top = lpDrawItemStruct->rcItem.top + 2;
397                 infoViewRect.top = lpDrawItemStruct->rcItem.top + 2;
398
399                 noViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
400                 userNameViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
401                 timeViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
402                 chatViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
403                 infoViewRect.bottom = lpDrawItemStruct->rcItem.bottom - 2;
404
405
406
407         
408
409                 ::DrawText(lpDrawItemStruct->hDC,noString,_tcslen(noString),&noViewRect,DT_WORD_ELLIPSIS);
410
411                 ::DrawText(lpDrawItemStruct->hDC,chatData.listenerData->user_id.c_str(),chatData.listenerData->user_id.length(),&userNameViewRect,DT_WORD_ELLIPSIS);
412
413                 ::DrawText(lpDrawItemStruct->hDC,chatData.chatBuf.c_str(),chatData.chatBuf.length(),&chatViewRect,DT_WORDBREAK);
414
415                 ::DrawText(lpDrawItemStruct->hDC,dateString,_tcslen(dateString),&timeViewRect,DT_WORD_ELLIPSIS);
416                                         
417         }
418
419         return;
420 }
421
422
423
424 VOID CCommentView::OnPaint(HDC wParam){
425         PAINTSTRUCT paintStruct;
426         HDC paintDC = this->BeginPaint(&paintStruct);
427         HPEN hPen = (HPEN)GetStockPen(NULL_PEN);
428         HPEN oldPen = (HPEN)::SelectObject(paintDC,hPen);
429         HBRUSH brush = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
430         HBRUSH oldBrush = (HBRUSH)::SelectObject(paintDC,brush);
431
432         ::Rectangle(paintDC,paintStruct.rcPaint.left,paintStruct.rcPaint.top,paintStruct.rcPaint.right,paintStruct.rcPaint.bottom);
433         this->EndPaint(&paintStruct);
434         ::SelectObject(paintDC,oldBrush);
435         ::SelectObject(paintDC,oldPen);
436                         
437         return;
438 }
439
440
441 VOID CCommentView::OnSizing(UINT wParam,LPRECT lParam){
442
443
444         ChangeSize( _WTYPES_NS::CSize(lParam->right - lParam->left,lParam->bottom - lParam->top));
445
446                         
447         return;
448
449 }
450
451
452
453 LRESULT CCommentView::OnSize(UINT wParam,SIZE lParam){
454         ChangeSize(lParam);
455                         
456         return 0;
457 }
458
459
460 VOID CCommentView::ChangeSize(const SIZE& client){
461         
462         
463
464         HDWP hDwp = BeginDeferWindowPos(2);
465         RECT headerPosRect;
466         RECT commentViewPosRect;
467
468         
469         m_header.GetWindowRect(&headerPosRect);
470         this->GetWindowRect(&commentViewPosRect);
471
472         INT_PTR movePos =  (client.cx - hScrollInfo.nPage);
473         idumpln(TEXT("movePos:%d"),movePos);
474         m_header.DeferWindowPos(hDwp,m_header.m_hWnd,movePos,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
475         m_listBox.DeferWindowPos(hDwp,m_listBox.m_hWnd,movePos,commentViewConstant::HEADER_HAIGHT,hScrollInfo.nMax,client.cy - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER);                
476
477         EndDeferWindowPos(hDwp);
478 //      m_listBox.MoveWindow(0,commentViewConstant::HEADER_HAIGHT,hScrollInfo.nMax,client.cy - commentViewConstant::HEADER_HAIGHT);
479         hScrollInfo.nPage = client.cx;
480         this->SetScrollInfo(SB_HORZ,&hScrollInfo);
481         RECT bkRect = {0};
482         bkRect.right = client.cx - hScrollInfo.nMax;
483         bkRect.bottom = client.cy;
484         this->InvalidateRect(&bkRect);
485
486         return;
487 }
488
489
490 LRESULT CCommentView::OnEraseBkgnd(HDC wParam){
491
492         return TRUE;
493 }
494
495
496 VOID CCommentView::OnDestroy(){
497         m_header.GetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
498         INT_PTR headerItemcount = m_header.GetItemCount();
499         RECT headerItemRect;
500         for(INT_PTR itemindex = 0;itemindex < headerItemcount;itemindex++){
501                                 
502                 m_header.GetItemRect(itemindex,&headerItemRect);
503                 viewproperty.headerholSize[itemindex] = headerItemRect.right - headerItemRect.left;
504         }
505         commentlist.OnDestroy();
506         m_header.DestroyWindow();
507         m_listBox.DestroyWindow();
508         return;
509
510 }
511
512 LRESULT CCommentView::OnHeaderEndDrag(LPNMHDR lParam){
513
514         if(lParam->hwndFrom == m_header.m_hWnd){
515
516                 m_listBox.Invalidate();
517
518         }
519
520         return 0;
521 }
522
523
524 VOID CCommentView::OnHScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam){
525
526                         
527         INT_PTR dy;
528         switch(loWParam){
529
530         case SB_THUMBPOSITION:
531         case SB_THUMBTRACK:
532                 dy = hiWParam - hScrollInfo.nPos;
533                 break;
534
535         case SB_LINELEFT:
536         case SB_PAGELEFT:
537
538                 dy = -1 * hScrollInfo.nPage;
539
540                 break;
541
542         case SB_LINERIGHT:
543         case SB_PAGERIGHT:
544
545                 dy = hScrollInfo.nPage + hScrollInfo.nPos > (UINT_PTR)hScrollInfo.nMax ? 0 :(UINT_PTR) (hScrollInfo.nMax - ( hScrollInfo.nPage + hScrollInfo.nPos)) < hScrollInfo.nPage ? (hScrollInfo.nMax - ( hScrollInfo.nPage + hScrollInfo.nPos)) : hScrollInfo.nPage;
546
547                 break;
548
549         default:
550                 dy = 0;
551                 break;
552
553         }
554         
555         dy = max(-1 * hScrollInfo.nPos, min(dy, hScrollInfo.nMax - hScrollInfo.nPos));
556
557
558         if(dy != 0){
559                 hScrollInfo.nPos += dy;
560                 RECT headerPosRect;
561                 RECT listBoxPosRect;
562                 m_header.GetWindowRect(&headerPosRect);
563                 m_listBox.GetWindowRect(&listBoxPosRect);
564                 INT_PTR moveRange = -(hScrollInfo.nPos);
565                 headerPosRect.bottom -= headerPosRect.top;
566                 headerPosRect.top = 0;
567                 headerPosRect.right += moveRange - headerPosRect.left;
568                 headerPosRect.left = moveRange;
569                                         
570                 listBoxPosRect.bottom -= (listBoxPosRect.top - commentViewConstant::HEADER_HAIGHT);
571                 listBoxPosRect.top = commentViewConstant::HEADER_HAIGHT;
572                 listBoxPosRect.right += moveRange - listBoxPosRect.left;
573                 listBoxPosRect.left = moveRange;
574                         
575                 m_header.MoveWindow(&headerPosRect);
576                 m_listBox.MoveWindow(&listBoxPosRect);
577                                         
578                                 
579                                         
580
581                 HDWP hDwp = BeginDeferWindowPos(2);
582
583                 m_header.DeferWindowPos(hDwp,m_header.m_hWnd,moveRange,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
584                 m_listBox.DeferWindowPos(hDwp,m_listBox.m_hWnd,moveRange,commentViewConstant::HEADER_HAIGHT,0,0,SWP_NOSIZE | SWP_NOZORDER);             
585
586                 EndDeferWindowPos(hDwp);
587                                         
588                                         
589                 this->SetScrollInfo(SB_HORZ,&hScrollInfo);
590         }
591                         
592         return;
593 }
594
595 LRESULT CCommentView::OnCreate(LPCREATESTRUCT lpcs){
596         m_header.Create(m_hWnd,0,WC_HEADER,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN   | HDS_BUTTONS | HDS_HOTTRACK |HDS_DRAGDROP | HDS_FULLDRAG  ,0,commentViewConstant::HEADER_ID);
597         m_listBox.Create(m_hWnd,0,WC_LISTBOX,WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_CLIPCHILDREN   | LBS_OWNERDRAWVARIABLE | LBS_NOTIFY | LBS_NOREDRAW  ,0,commentViewConstant::LISTBOX_ID);
598         m_listBox.SetFont(AtlGetDefaultGuiFont());
599                 
600                         
601         return 0;
602 }
603
604 VOID CCommentView::AddHeader(LPHEADERSINFO infos){
605
606
607         m_header.SetFont(hHeaderFontNew);
608
609         HDITEM item;
610         item.mask = HDI_FORMAT | HDI_TEXT | HDI_WIDTH;
611         item.fmt = HDF_CENTER | HDF_STRING;
612                         
613                         
614         for(UINT_PTR index = 0;index < infos->count ;++index){
615
616                 item.pszText = infos->columns[index];
617
618                 item.cxy =  infos->holizensize[index];
619                 hScrollInfo.nMax += infos->holizensize[index];
620                 m_header.InsertItem(index,&item);
621         }
622                         
623         this->SetScrollInfo(SB_HORZ,&hScrollInfo,TRUE); 
624         DecisionHorzSize();
625         return;
626 }
627
628 VOID CCommentView::DecisionHorzSize(){
629         
630         HDWP hWindowPosInfo = BeginDeferWindowPos(2);
631         RECT bkWindowRect;
632         this->GetClientRect(&bkWindowRect);
633         m_header.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,hScrollInfo.nMax,commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
634         m_listBox.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,hScrollInfo.nMax,bkWindowRect.bottom - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
635
636         EndDeferWindowPos(hWindowPosInfo);
637         bkWindowRect.left = hScrollInfo.nMax;
638                         
639         this->InvalidateRect(&bkWindowRect);
640                         
641         return;
642 }
643