GuiDockToolBarEx.cpp
上传用户:wlkj888
上传日期:2022-08-01
资源大小:806k
文件大小:16k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. /****************************************************************************
  2.  * *
  3.  * GuiToolKit   *
  4.  *  (MFC extension) *
  5.  * Created by Francisco Campos G. www.beyondata.com fcampos@beyondata.com *
  6.  *--------------------------------------------------------------------------*
  7.  * *
  8.  * This program is free software;so you are free to use it any of your *
  9.  * applications (Freeware, Shareware, Commercial),but leave this header *
  10.  * intact. *
  11.  * *
  12.  * These files are provided "as is" without warranty of any kind. *
  13.  * *
  14.  *        GuiToolKit is forever FREE CODE !!!!! *
  15.  * *
  16.  *--------------------------------------------------------------------------*
  17.  * Created by: Francisco Campos G. *
  18.  * Bug Fixes and improvements : (Add your name) *
  19.  * -Francisco Campos *
  20.  * *
  21.  ****************************************************************************/
  22. #include "stdafx.h"
  23. #include "guidocktoolbarex.h"
  24. #include "GuiDrawLayer.h"
  25. #include "GuiMDIFrame.h"
  26. #include "GuiFrameWnd.h"
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CDockButton
  29. CDockButton::CDockButton()
  30. {
  31. m_bMouseOver=FALSE;
  32. m_hIcon=NULL;
  33. }
  34. CDockButton::~CDockButton()
  35. {
  36. }
  37. BEGIN_MESSAGE_MAP(CDockButton, CWnd)
  38. //{{AFX_MSG_MAP(CDockButton)
  39. ON_WM_CREATE()
  40. ON_WM_MOUSEMOVE()
  41. ON_WM_PAINT()
  42. ON_WM_LBUTTONDOWN()
  43. ON_WM_LBUTTONUP()
  44. ON_WM_KILLFOCUS()
  45. ON_WM_TIMER()
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CDockButton message handlers
  50. BOOL CDockButton::Create(LPCTSTR lpszWindowName,DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,HWND hWnd)
  51. {
  52. // TODO: Add your specialized code here and/or call the base class
  53. m_Caption=lpszWindowName;
  54. m_nDockBarAling=nID;
  55. m_hWnd=hWnd;
  56. return CWnd::Create(NULL,lpszWindowName, dwStyle |WS_CLIPSIBLINGS|WS_CLIPCHILDREN, rect, pParentWnd, nID+(int)m_hWnd);
  57. }
  58. int CDockButton::OnCreate(LPCREATESTRUCT lpCreateStruct)
  59. {
  60. if (CWnd::OnCreate(lpCreateStruct) == -1)
  61. return -1;
  62. // TODO: Add your specialized creation code here
  63. return 0;
  64. }
  65. void CDockButton::SetIconBtn(HICON hIcon)
  66. {
  67. m_hIcon=hIcon;
  68. m_szBtn=GuiDrawLayer::GetSizeIcon(m_hIcon);
  69. }
  70. void CDockButton::OnMouseMove(UINT nFlags, CPoint point)
  71. {
  72. // TODO: Add your message handler code here and/or call default
  73. if (m_bMouseOver) return;
  74. if (!IsTopParentActive() || !GetTopLevelParent()->IsWindowEnabled())
  75. return;
  76. CRect m_rect;
  77. GetClientRect(m_rect);
  78. if (m_rect.PtInRect(point))
  79. {
  80. CGuiControlBar* m_tb=GetBar(m_hWnd);
  81. if  ((m_tb->IsVisible() && m_tb->IsAutoHide()) )
  82. {
  83. m_tb->ScrollOff();
  84. GetParentFrame()->ShowControlBar(m_tb, FALSE, FALSE);
  85. }
  86. else
  87. {
  88. if  (!m_tb->IsVisible())
  89. {
  90. CGuiControlBar* m_tb1=IsControlVisible(m_tb);
  91. if (m_tb1!= NULL)
  92. {
  93. if (m_tb1 != m_tb)
  94. {
  95. GetParentFrame()->ShowControlBar(m_tb1, FALSE, TRUE);
  96. }
  97. }
  98. m_tb->ScrollOn();
  99. m_bMouseOver=TRUE;  //numero de ventana a activar
  100. SetTimer(1,500,0);
  101. }
  102. }
  103. }
  104. CWnd::OnMouseMove(nFlags, point);
  105. }
  106. CGuiControlBar* CDockButton::IsControlVisible(CGuiControlBar* m_Bar)
  107. {
  108. CGuiMDIFrame* pB;
  109. CGuiFrameWnd* pB1;
  110. CDockButton* pBtn;
  111. BOOL isMDI=FALSE;
  112. if (GetParentFrame()->IsKindOf(RUNTIME_CLASS(CGuiMDIFrame)))
  113. isMDI=TRUE;
  114. if (isMDI)
  115.  pB=(CGuiMDIFrame*)GetParentFrame();
  116. else 
  117.  pB1= (CGuiFrameWnd*)GetParentFrame();
  118. int nSize=isMDI==TRUE? pB->m_dockHideBottom.m_ArrayButton.GetSize() : pB1->m_dockHideBottom.m_ArrayButton.GetSize() ;
  119. for(int i=0; i < nSize; i++)
  120. {
  121. if (isMDI==TRUE)
  122. pBtn= (CDockButton*) pB->m_dockHideBottom.m_ArrayButton[i];
  123. else
  124. pBtn= (CDockButton*) pB1->m_dockHideBottom.m_ArrayButton[i];
  125. CGuiControlBar* pBar= GetBar(pBtn->m_hWnd);
  126. if(pBar == m_Bar) continue;
  127. if (pBar->IsWindowVisible())
  128. return pBar;
  129. }
  130. nSize=(isMDI==TRUE) ? pB->m_dockHideLeft.m_ArrayButton.GetSize(): pB1->m_dockHideLeft.m_ArrayButton.GetSize();
  131. for( i=0; i < nSize; i++)
  132. {
  133. if (isMDI==TRUE)
  134. pBtn= (CDockButton*) pB->m_dockHideLeft.m_ArrayButton[i];
  135. else
  136. pBtn= (CDockButton*) pB1->m_dockHideLeft.m_ArrayButton[i];
  137. CGuiControlBar* pBar= GetBar(pBtn->m_hWnd);
  138. if(pBar == m_Bar) continue;
  139. if(pBar->IsWindowVisible())
  140. return pBar;
  141. }
  142. nSize=(isMDI==TRUE) ? pB->m_dockHideRight.m_ArrayButton.GetSize() : pB1->m_dockHideRight.m_ArrayButton.GetSize();
  143. for( i=0; i < nSize; i++)
  144. {
  145. if (isMDI==TRUE)
  146. pBtn=(CDockButton*) pB->m_dockHideRight.m_ArrayButton[i] ;
  147. else
  148. pBtn=(CDockButton*) pB1->m_dockHideRight.m_ArrayButton[i];
  149. CGuiControlBar* pBar= GetBar(pBtn->m_hWnd);
  150. if(pBar == m_Bar) continue;
  151. if (pBar->IsWindowVisible())
  152. return pBar;
  153. }
  154. nSize=(isMDI==TRUE) ? pB->m_dockHideTop.m_ArrayButton.GetSize() : pB1->m_dockHideTop.m_ArrayButton.GetSize();
  155. for( i=0; i < nSize; i++)
  156. {
  157. if (isMDI==TRUE)
  158. pBtn= (CDockButton*) pB->m_dockHideTop.m_ArrayButton[i];
  159. else
  160. pBtn= (CDockButton*)pB1->m_dockHideTop.m_ArrayButton[i];
  161. CGuiControlBar* pBar= GetBar(pBtn->m_hWnd);
  162. if(pBar == m_Bar) continue;
  163. if (pBar->IsWindowVisible())
  164. return pBar;
  165. }
  166. return NULL;
  167. }
  168. CGuiControlBar* CDockButton::GetBar(HWND hWnd)
  169. {
  170. POSITION pos = GetParentFrame()->m_listControlBars.GetHeadPosition();
  171. while (pos)
  172. {
  173. CControlBar* pBar =
  174. (CControlBar*)GetParentFrame()->m_listControlBars.GetNext(pos);
  175. ASSERT_VALID(pBar);
  176. if (pBar->m_hWnd == hWnd)
  177.    return (CGuiControlBar *)pBar;
  178. }
  179. return NULL;
  180. }
  181. void CDockButton::OnPaint()
  182. {
  183. CPaintDC dc(this); // device context for painting
  184. CBrush cb;
  185. COLORREF m_clrBorder=GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style);
  186. COLORREF m_clrFace=GuiDrawLayer::GetRGBColorFace(GuiDrawLayer::m_Style);
  187. CPen cp(PS_SOLID,1,m_clrFace);
  188. CPen* cpold=dc.SelectObject(&cp);
  189. CRect m_rect;
  190. GetClientRect(m_rect);
  191. cb.CreateSolidBrush(m_clrFace);
  192. if (GuiDrawLayer::m_Style== GUISTYLE_XP)
  193. dc.FillRect(m_rect,&cb);
  194. else
  195. {
  196. CGradient M(CSize(m_rect.Width(),m_rect.Height()));
  197. if (m_nDockBarAling ==AFX_IDW_DOCKBAR_LEFT || m_nDockBarAling ==AFX_IDW_DOCKBAR_RIGHT)
  198. M.PrepareCaptionVert(&dc,GuiDrawLayer::m_Style);
  199. else
  200. M.PrepareCaption(&dc,GuiDrawLayer::m_Style);
  201. M.Draw(&dc,m_rect.left,m_rect.top,0,0,m_rect.Width(),m_rect.Height(),SRCCOPY);
  202. }
  203. dc.Draw3dRect(m_rect,m_clrBorder,m_clrBorder);
  204. GuiDrawLayer::DrawIcon(&dc,CPoint(m_rect.left+2,m_rect.top+2),m_szBtn,m_hIcon);
  205. switch(m_nDockBarAling)
  206. {
  207. case AFX_IDW_DOCKBAR_TOP:
  208. dc.MoveTo(m_rect.left,m_rect.top);
  209. dc.LineTo(m_rect.right,m_rect.top);
  210. if(m_hIcon != NULL)
  211. m_rect.left+=m_szBtn.cx+4;
  212. DrawTextHorz(&dc,m_rect);
  213. break;
  214. case AFX_IDW_DOCKBAR_LEFT:
  215. dc.MoveTo(m_rect.left,m_rect.top);
  216. dc.LineTo(m_rect.left,m_rect.bottom);
  217. if(m_hIcon != NULL)
  218. m_rect.top+=m_szBtn.cy+4;
  219. DrawTextVert(&dc,m_rect);
  220. break;
  221. case AFX_IDW_DOCKBAR_RIGHT:
  222. dc.MoveTo(m_rect.right-1,m_rect.top);
  223. dc.LineTo(m_rect.right-1,m_rect.bottom);
  224. if(m_hIcon != NULL)
  225. m_rect.top+=m_szBtn.cy+4;
  226. DrawTextVert(&dc,m_rect);
  227. break;
  228. case AFX_IDW_DOCKBAR_BOTTOM:
  229. dc.MoveTo(m_rect.left,m_rect.bottom-1);
  230. dc.LineTo(m_rect.right,m_rect.bottom-1);
  231. if(m_hIcon != NULL)
  232. m_rect.left+=m_szBtn.cx+4;
  233. DrawTextHorz(&dc,m_rect);
  234. break;
  235. }
  236. dc.SelectObject(cpold);
  237. }
  238. void CDockButton::OnTimer(UINT nIDEvent)
  239. {
  240. // TODO: Add your message handler code here and/or call default
  241. if (!m_bMouseOver) return;
  242. CRect m_rc;
  243. CPoint pt(GetMessagePos());
  244. CRect m_rect;
  245. GetClientRect(m_rect);
  246. CPoint ptB=pt;
  247. ScreenToClient(&pt);
  248. CGuiControlBar* m_tb=GetBar(m_hWnd);
  249. m_tb->GetWindowRect(&m_rc);
  250. if (m_rc.PtInRect(ptB)) return;
  251. if (m_rect.PtInRect(pt)) return;
  252. if (m_tb->IsTracking()) return;
  253. if (!m_rect.PtInRect(pt))
  254. {
  255. m_bMouseOver=0;
  256. KillTimer(1);
  257. CGuiControlBar* m_tb1=IsControlVisible(m_tb);
  258. if (!m_tb1)
  259. m_tb->ScrollOff();
  260. //aqui se debe ocultar la ventana auto hide
  261. }
  262. CWnd::OnTimer(nIDEvent);
  263. }
  264. void CDockButton::OnLButtonDown(UINT nFlags, CPoint point)
  265. {
  266. // TODO: Add your message handler code here and/or call default
  267. CWnd::OnLButtonDown(nFlags, point);
  268. }
  269. void CDockButton::OnLButtonUp(UINT nFlags, CPoint point)
  270. {
  271. // TODO: Add your message handler code here and/or call default
  272. CWnd::OnLButtonUp(nFlags, point);
  273. }
  274. void CDockButton::OnKillFocus(CWnd* pNewWnd)
  275. {
  276. CWnd::OnKillFocus(pNewWnd);
  277. // TODO: Add your message handler code here
  278. }
  279. void CDockButton::DrawTextHorz(CDC* pDC, CRect m_rect)
  280. {
  281. pDC->SetBkMode(TRANSPARENT);
  282. CFont* pOldFont = pDC->SelectObject(&m_fontHorzMenu);
  283. pDC->DrawText(m_Caption, m_rect,
  284. DT_SINGLELINE | DT_CENTER | DT_VCENTER);
  285. pDC->SelectObject(pOldFont);
  286. }
  287. void CDockButton::DrawTextVert(CDC* pDC, CRect m_rect)
  288. {
  289. COLORREF clr = ::GetSysColor(COLOR_MENUTEXT);
  290. pDC->SetTextColor(clr);
  291. // fixed for WinNT. *****fixed by Simon, thanks!*****
  292. int iGraphicsMode = ::GetGraphicsMode(pDC->m_hDC);
  293. ::SetGraphicsMode(pDC->m_hDC, GM_ADVANCED);
  294. pDC->SetBkMode(TRANSPARENT);
  295. CFont* pOldFont = pDC->SelectObject(&m_fontVertMenu);
  296. // I know precise text size
  297. CSize m_sizeHorz;
  298. CSize m_sizeCad=pDC->GetTextExtent(m_Caption);
  299. m_sizeHorz.cx = ( m_sizeCad.cx + CXTEXTMARGIN*2)+8;
  300. m_sizeHorz.cy = (_cyHorzFont + _cyTextMargin*2)+1;
  301. CRect rcString = CRect(
  302. CPoint(m_rect.right - _cyTextMargin, m_rect.top + CXTEXTMARGIN), m_sizeHorz);
  303. pDC->DrawText(m_Caption, rcString,
  304. DT_SINGLELINE | DT_NOCLIP | DT_NOPREFIX);// don't forget DT_NOCLIP
  305. pDC->SelectObject(pOldFont);
  306. // CDC::DrawText is poor, so we have to draw vertical line by ourselves
  307. ::SetGraphicsMode( pDC->m_hDC, iGraphicsMode );
  308. }
  309. /////////////////////////////////////////////////////////////////////////////
  310. // CGuiDockToolBarEx
  311. CGuiDockToolBarEx::CGuiDockToolBarEx()
  312. {
  313. m_clrface=GuiDrawLayer::GetRGBColorTabs();
  314. m_Size=24;
  315. n_numBars=0;
  316. m_ArrayButton.RemoveAll();
  317. }
  318. CGuiDockToolBarEx::~CGuiDockToolBarEx()
  319. {
  320. m_ArrayButton.RemoveAll();
  321. }
  322. void CGuiDockToolBarEx::OnDestroy()
  323. {
  324. // Libera la memoria
  325.     for( int i=0; i<n_numBars; i++ )
  326.     {
  327.     CDockButton *pBtn = (CDockButton*)m_ArrayButton.GetAt(i);
  328.     if( pBtn )
  329.         delete pBtn;
  330.     }
  331. CWnd::OnDestroy();
  332. // TODO: Add your message handler code here
  333. }
  334. BEGIN_MESSAGE_MAP(CGuiDockToolBarEx, CControlBar)
  335. //{{AFX_MSG_MAP(CGuiDockToolBarEx)
  336. ON_WM_CREATE()
  337. ON_WM_ERASEBKGND()
  338. ON_WM_PAINT()
  339. ON_WM_NCPAINT()
  340. ON_WM_NCCALCSIZE()
  341. ON_WM_SYSCOLORCHANGE()
  342. ON_WM_MOUSEMOVE()
  343. ON_WM_TIMER()
  344. ON_WM_DESTROY()
  345. //}}AFX_MSG_MAP
  346. END_MESSAGE_MAP()
  347. /////////////////////////////////////////////////////////////////////////////
  348. // CGuiDockToolBarEx message handlers
  349. BOOL CGuiDockToolBarEx::Create(CWnd* pParentWnd,DWORD dwAling)
  350. {
  351. // TODO: Add your specialized code here and/or call the base class
  352. ASSERT ( dwAling & CBRS_ALIGN_ANY);
  353. SetBarStyle (dwAling);
  354. DWORD dwStyle = CCS_NOPARENTALIGN|CCS_NOMOVEY|CCS_NODIVIDER|CCS_NORESIZE;
  355. if (pParentWnd->GetStyle() & WS_THICKFRAME)
  356. dwStyle |= SBARS_SIZEGRIP;
  357. dwStyle |= WS_CHILD;
  358. return CControlBar::Create(0,0,dwStyle, CRect(0,0,0,0),pParentWnd,0x9999);
  359. }
  360. int CGuiDockToolBarEx::OnCreate(LPCREATESTRUCT lpCreateStruct)
  361. {
  362. if (CControlBar::OnCreate(lpCreateStruct) == -1)
  363. return -1;
  364. // TODO: Add your specialized creation code here
  365. if (!InitGlobalFont())
  366.    return -1;
  367. return 0;
  368. }
  369. BOOL CGuiDockToolBarEx::OnEraseBkgnd(CDC* pDC)
  370. {
  371. // TODO: Add your message handler code here and/or call default
  372. CBrush cbr;
  373. cbr.CreateSolidBrush(GuiDrawLayer::GetRGBColorFace(GuiDrawLayer::m_Style));
  374. CRect m_rect;
  375. GetClientRect(m_rect);
  376. pDC->FillRect(m_rect,&cbr);
  377. return TRUE;
  378. }
  379. void CGuiDockToolBarEx::CalcButton()
  380. {
  381. int nPos=20;
  382. CRect rcCli;
  383. GetClientRect(rcCli);
  384. CClientDC dc(this);
  385. CRect m_Arect;
  386. for (int iCont=0; iCont< n_numBars;iCont++)
  387. {
  388. CDockButton* ct=(CDockButton*) m_ArrayButton[iCont];
  389. CSize m_sChar=dc.GetTextExtent(ct->GetString());
  390. m_Arect.SetRectEmpty();
  391. CSize szBtn=ct->GetSizeIconBtn();
  392. if (ct->GetAling() == AFX_IDW_DOCKBAR_TOP ||
  393. ct->GetAling() == AFX_IDW_DOCKBAR_BOTTOM)
  394. {
  395. m_Arect.left=nPos+4;
  396. m_Arect.right+= nPos+m_sChar.cx+4;
  397. m_Arect.right+= szBtn.cy+6;
  398. m_Arect.top=AFX_IDW_DOCKBAR_TOP?rcCli.top:rcCli.top+4;
  399. m_Arect.bottom=AFX_IDW_DOCKBAR_TOP? rcCli.bottom-2:rcCli.Width()+4;
  400. nPos+=m_Arect.Width();
  401. nPos+=2;
  402. }
  403. else
  404. {
  405. m_Arect.top=nPos+4;
  406. m_Arect.bottom+= nPos+m_sChar.cx+4;
  407. m_Arect.bottom+= szBtn.cx+6;
  408. m_Arect.right+=AFX_IDW_DOCKBAR_LEFT?rcCli.left+22: rcCli.left+22;
  409. m_Arect.left+=AFX_IDW_DOCKBAR_LEFT?0:m_Arect.right;
  410. nPos+=m_Arect.Height();
  411. nPos+=8;
  412. }
  413. ct->SetRect(m_Arect);
  414. ct->MoveWindow(m_Arect,TRUE);
  415. //ct->UpdateWindow();
  416. }
  417. }
  418. void CGuiDockToolBarEx::AddToolBars(CGuiControlBar* m_ctrlBars)
  419. {
  420. CString m_string;
  421. m_ctrlBars->GetWindowText(m_string);
  422. m_ArrayButton.SetAtGrow(n_numBars,
  423. new CDockButton());
  424. if (!((CDockButton *)m_ArrayButton[n_numBars])->Create(m_string,WS_VISIBLE,CRect(0,0,0,0),this,m_ctrlBars->GetDlgID(),m_ctrlBars->m_hWnd))
  425. return ;
  426. ((CDockButton *)m_ArrayButton[n_numBars])->SetIconBtn(m_ctrlBars->GetIcon());
  427. n_numBars++;
  428. CalcButton();
  429. UpdateBars();
  430. Invalidate();
  431. UpdateWindow();
  432. }
  433. void CGuiDockToolBarEx::DeleteToolBars(CGuiControlBar* m_ctrlBars)
  434. {
  435. for (int i=0; i < n_numBars; i++)
  436. {
  437. CGuiControlBar *m_tb=(CGuiControlBar *) ((CDockButton *)m_ArrayButton[i])->GetBar(((CDockButton *)m_ArrayButton[i])->GethWnd());
  438. if (m_tb == m_ctrlBars)
  439. break;
  440. }
  441. CDockButton *pBtn = (CDockButton*)m_ArrayButton.GetAt(i);
  442.     if( pBtn )
  443.         delete pBtn;
  444. m_ArrayButton.RemoveAt(i);
  445. n_numBars--;
  446. UpdateBars();
  447. CalcButton();
  448. Invalidate();
  449. UpdateWindow();
  450. }
  451. void CGuiDockToolBarEx::UpdateBars()
  452. {
  453. DWORD dwstyle = GetBarStyle();
  454. if (m_ArrayButton.GetSize() > 0)
  455. ShowWindow(SW_SHOW);
  456. else
  457. ShowWindow(SW_HIDE);
  458. }
  459. void CGuiDockToolBarEx::OnSysColorChange()
  460. {
  461. m_clrface=GuiDrawLayer::m_Style!= GUISTYLE_XP?GuiDrawLayer::GetRGBColorFace(GuiDrawLayer::m_Style): GuiDrawLayer::GetRGBColorTabs();
  462. CControlBar::OnSysColorChange();
  463. }
  464. void CGuiDockToolBarEx::OnPaint()
  465. {
  466. CPaintDC dc(this); // device context for painting
  467. CRect m_rect;
  468. GetClientRect(m_rect);
  469. CBrush cbr;
  470. m_clrface=GuiDrawLayer::m_Style!= GUISTYLE_XP?GuiDrawLayer::GetRGBColorFace(GuiDrawLayer::m_Style): GuiDrawLayer::GetRGBColorTabs();
  471. cbr.CreateSolidBrush(m_clrface);
  472. dc.FillRect(m_rect,&cbr);
  473. CalcButton();
  474. UpdateBars();
  475. // TODO: Add your message handler code here
  476. // Do not call CControlBar::OnPaint() for painting messages
  477. }
  478. void CGuiDockToolBarEx::OnMouseMove(UINT nFlags, CPoint point)
  479. {
  480. CControlBar::OnMouseMove(nFlags, point);
  481. }
  482. void CGuiDockToolBarEx::OnTimer(UINT nIDEvent)
  483. {
  484. // TODO: Add your message handler code here and/or call default
  485. CControlBar::OnTimer(nIDEvent);
  486. }
  487. void CGuiDockToolBarEx::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp)
  488. {
  489. // TODO: Add your message handler code here and/or call default
  490. UpdateBars();
  491. CControlBar::OnNcCalcSize(bCalcValidRects, lpncsp);
  492. }
  493. void CGuiDockToolBarEx::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
  494. {
  495. }
  496. CSize CGuiDockToolBarEx::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
  497. {
  498. if (bHorz)
  499. return CSize(32767,m_Size);
  500. else
  501. return CSize(m_Size,32767);
  502. }