// 描画のみ
void Test::OnPaint()
{
// サイズ変更ボックス(描画のみ)
// http://msdn.microsoft.com/ja-jp/library/0e2003b3(VS.71).aspx
CPaintDC dc( this );
CRect rect;
CDialog::GetClientRect( &rect );
rect.left = rect.right - ::GetSystemMetrics( SM_CXHSCROLL );
rect.top = rect.bottom - ::GetSystemMetrics( SM_CYVSCROLL );
dc.DrawFrameControl( &rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP );
}
void Test::OnSize()
{
RECT rect;
CDialog::GetClientRect( &rect );
// サイズ変更ボックス
// rect.right -= ::GetSystemMetrics( SM_CXHSCROLL );
// rect.bottom -= ::GetSystemMetrics( SM_CYVSCROLL );
}
/////////////////////////////////////////////////////////////////
class Test : public CDialog
{
CScrollBar m_size_box;
}
BOOL Test::OnInitDialog()
{
// サイズ変更ボックス
m_size_box.Create( SBS_SIZEBOX | SBS_SIZEBOXBOTTOMRIGHTALIGN | SBS_SIZEGRIP |
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
rect, this, 1000 );
}
/**
* マウスカーソル
*/
BOOL Test::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if( nHitTest == HTCLIENT ){
// サイズ変更ボックス
if( ::IsWindow( m_size_box.GetSafeHwnd() ) ){
RECT rect;
m_size_box.GetWindowRect( &rect );
POINT point;
::GetCursorPos( &point );
if( ::PtInRect( &rect, point ) ){
::SetCursor( ::AfxGetApp()->LoadStandardCursor( IDC_SIZENWSE ) );
return TRUE;
}
}
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
最終更新:2009年02月09日 10:47