次の方法で共有


CComControlBase::GetAmbientAppearance

コントロールの現在の外観の設定を示す DISPID_AMBIENT_APPEARANCE を取得します。0 はフラット、1 は 3D を表します。

HRESULT GetAmbientAppearance(
   short& nAppearance
); 

パラメーター

  • nAppearance
    プロパティ DISPID_AMBIENT_APPEARANCE

戻り値

標準の HRESULT 値のいずれか 1 つが。

使用例

   HRESULT OnDraw(ATL_DRAWINFO& di)
   {
      short nAppearance;
      RECT& rc = *(RECT*)di.prcBounds;

      // draw 3D border if AmbientAppearance is not supported or is set to 1 
      HRESULT hr = GetAmbientAppearance(nAppearance);
      if (hr != S_OK || nAppearance==1)
      {
         DrawEdge(di.hdcDraw, &rc, EDGE_SUNKEN, BF_RECT);
      }
      else
      {
         Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
      }

      SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
      LPCTSTR pszText = _T("ATL 8.0 : MyControl");

      // For security reasons, we recommend that you use the lstrlen function
      // with caution. Here, we can guarantee that pszText is NULL terminated,
      // and therefore it is safe to use this function.
      TextOut(di.hdcDraw, 
         (rc.left + rc.right) / 2, 
         (rc.top + rc.bottom) / 2, 
         pszText, 
         lstrlen(pszText));

      return S_OK;
   }

必要条件

ヘッダー : atlctl.h

参照

関連項目

CComControlBase クラス