当前位置: 首页>>代码示例>>C++>>正文


C++ TDC::set_hdc方法代码示例

本文整理汇总了C++中TDC::set_hdc方法的典型用法代码示例。如果您正苦于以下问题:C++ TDC::set_hdc方法的具体用法?C++ TDC::set_hdc怎么用?C++ TDC::set_hdc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TDC的用法示例。


在下文中一共展示了TDC::set_hdc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WndProc

WNDFN WndProc (HWND hwnd, UINT msg, UINT wParam,LONG lParam)
//----------------------------------------------------------------------------
{
//  static SWin w;
  static BOOL dragging = FALSE;
  static long MouseTime = 0;
  static UINT size_flags;
  LPMINMAXINFO pSizeInfo;
  long ret;

  TEventWindow *This = (TEventWindow *) GetWindowLong(hwnd,0);

  switch (msg)
  {
     case WM_CREATE:
      {
         LPCREATESTRUCT lpCreat = (LPCREATESTRUCT) lParam;
         PVOID *lpUser;
         lpUser  = (PVOID *)lpCreat->lpCreateParams;

      //..... 'This' pointer passed as first word of creation parms
         SetWindowLong(hwnd,0,(long)lpUser[0]);
         This = (TEventWindow *)lpUser[0];
         This->get_dc()->set_twin(This);
      }
     return 0;

    case WM_SIZE:
      This->size(LOWORD(lParam),HIWORD(lParam));
      return 0;

    case WM_MOVE:
      This->on_move();
      return 0;

    case WM_GETMINMAXINFO:
        if (This && This->cant_resize()) {
          pSizeInfo = (LPMINMAXINFO) lParam;
          pSizeInfo->ptMaxTrackSize = This->fixed_size();
          pSizeInfo->ptMinTrackSize = This->fixed_size();
        }
        return 0;

  //
    case WM_COMMAND:
      if (This->m_dispatcher) { 
            This->m_dispatcher->dispatch(LOW_WORD(wParam),HIWORD(wParam),(Handle)lParam);
            return 0;
      }
      if (This->command(LOW_WORD(wParam))) return 0;
      else break;

   case WM_USER_PLUS:
      return This->handle_user(wParam,lParam);

    case WM_KEYDOWN:
        This->keydown(wParam);
        return 0;

    case WM_CHAR:
         This->on_char(wParam,LOWORD(lParam));  // 1
         return 0;

    case WM_HSCROLL:
       if (This->m_dispatcher) { 
            int id = GetWindowLong((HWND)lParam,GWL_ID);
            This->m_dispatcher->dispatch(id,LOWORD(wParam),(Handle)lParam);
       } 
       return 0;
    case WM_VSCROLL:
       This->vscroll(wParam,This->scroll_bar()->get_pos());
       return 0;

    case WM_PAINT:
     {
        PAINTSTRUCT ps;
        TDC *dc = This->get_dc();
        dc->set_hdc(BeginPaint(hwnd,&ps));
        This->paint(*dc);
        dc->set_hdc(NULL);
        EndPaint(hwnd,&ps);
     }
     return 0;

// Mouse messages....

  case WM_LBUTTONDOWN:
  case WM_LBUTTONUP:
  case WM_RBUTTONDOWN:
  case WM_LBUTTONDBLCLK:
    {
        Point pt(LOWORD(lParam),HIWORD(lParam));
        //pt.to_logical(*This);
     switch (msg) {
        case WM_LBUTTONDOWN:
            This->mouse_down(pt);
         break;
        case WM_LBUTTONUP:
         This->mouse_up(pt);
         break;
//.........这里部分代码省略.........
开发者ID:Artorios,项目名称:rootkit.com,代码行数:101,代码来源:twl.cpp


注:本文中的TDC::set_hdc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。