Home > Back-end >  E2468 value of type void is not allowed.
E2468 value of type void is not allowed.

Time:12-12


# include "stdafx. H"
# include "BitItem. H"
# include "BitSlider. H"

# ifdef _DEBUG
# define new DEBUG_NEW
# undef THIS_FILE
The static char THIS_FILE []=__FILE__;
# pragma link "nafxcwd lib"
# the else
# pragma link "nafxcw lib"
# endif

CBitSlider: : CBitSlider ()
: m_bAllocFlag (FALSE),
M_lpActive (NULL),
M_lpNormal (NULL),
M_hHand (NULL),
M_nOffset (0)
{
}

CBitSlider: : ~ CBitSlider ()
{
This -> DestroyBackItem ();
}

BEGIN_MESSAGE_MAP (CBitSlider CSliderCtrl)
//{{AFX_MSG_MAP (CBitSlider)
ON_WM_PAINT ()
ON_WM_ERASEBKGND ()
ON_WM_LBUTTONUP ()
ON_WM_LBUTTONDOWN ()
ON_WM_MOUSEMOVE ()
ON_WM_MOUSEWHEEL ()
ON_WM_SETCURSOR ()
//}} AFX_MSG_MAP
END_MESSAGE_MAP ()

BOOL CBitSlider: : OnEraseBkgnd (pDC) CDC *
{
Return TRUE;
}

BOOL CBitSlider: : onm ouseWheel (UINT nFlags, short zDelta, CPoint pt)
{
Return TRUE;
}

Void CBitSlider: : OnLButtonDown (UINT nFlags, CPoint point)
{
CSliderCtrl: : OnLButtonDown (nFlags, point);
}

Void CBitSlider: : OnLButtonUp (UINT nFlags, CPoint point)
{
This -> Invalidate ();
This -> UpdateToolTips ();
CSliderCtrl: : OnLButtonUp (nFlags, point);
}

Void CBitSlider: : onm ouseMove (UINT nFlags, CPoint point)
{
The CDC * pDC=this -> GetDC ();
This -> DrawSlider (pDC, FALSE);
This -> ReleaseDC (pDC);

This -> UpdateToolTips ();

CSliderCtrl: onm ouseMove (nFlags, point);
}

BOOL CBitSlider: : OnSetCursor (CWnd * pWnd, UINT nHitTest, UINT message)
{
If (m_hHand!=NULL)
{
: : SetCursor (m_hHand);
Return TRUE;
}
return FALSE;
}

Void CBitSlider: : OnPaint ()
{
CPaintDC dc (this);
This -> DrawSlider (& dc, TRUE);
}

Void CBitSlider: : DrawSlider (CDC * pDC, BOOL bPaint)
{
If (m_Thumb m_hWnd!=NULL && m_lpNormal!=NULL && m_lpActive!=NULL)
{
CRect rcRect;
CRect rcThumb;

This -> GetClientRect (rcRect);
This -> GetNewThumbRect (rcThumb);
If ((GetStyle () & TBS_VERT)==TBS_VERT)
{
M_lpActive -> CopyHoleDC (pDC, 0, 0, rcRect Width (), bPaint? RcThumb. Bottom: rcThumb. Top);
M_lpNormal -> CopyHoleDC (pDC, 0, rcThumb. Bottom, rcRect Width (), rcRect. The bottom - rcThumb. Bottom, 0, rcThumb, bottom);
}
The else
{
M_lpActive -> CopyHoleDC (pDC, 0, 0, bPaint? RcThumb. Right: rcThumb. Left, rcRect Height ());
M_lpNormal -> CopyHoleDC (pDC, rcThumb. Right, 0, rcRect. Right - rcThumb. Right, rcRect. Height (), rcThumb. Right, 0).
}
bPaint? M_Thumb. MoveWindow (rcThumb) : NULL;

}
}

Void CBitSlider: : DestroyBackItem ()
{
If (m_lpActive!=NULL && m_bAllocFlag)
{
The delete m_lpActive;
M_lpActive=NULL;
}
If (m_lpNormal!=NULL && m_bAllocFlag)
{
The delete m_lpNormal;
M_lpNormal=NULL;
}
M_bAllocFlag=FALSE;
}

Void CBitSlider: : BuildBackItem (UINT nNormalRes, UINT nActiveRes)
{
This -> DestroyBackItem ();
ASSERT (m_lpActive==NULL);
ASSERT (m_lpNormal==NULL);

M_lpNormal=new CBitItem (nNormalRes, 0, 0);
M_lpActive=new CBitItem (nActiveRes, 0, 0);
ASSERT (m_lpActive!=NULL);
ASSERT (m_lpNormal!=NULL);

M_bAllocFlag=TRUE;

This -> SetWindowPos (NULL, 0, 0, m_lpActive -> GetImageWidth (),
M_lpActive -> GetImageHeight (), SWP_NOMOVE);
}

Void CBitSlider: : BuildBackItem (CBitItem * lpNBit, CBitItem * lpABit)
{
If (this -> m_hWnd==NULL | | lpNBit==NULL | | lpABit==NULL)
return;

M_lpNormal=lpNBit;
M_lpActive=lpABit;

This -> SetWindowPos (NULL, 0, 0, m_lpActive -> GetItemWidth (),
M_lpActive -> GetItemHeight (), SWP_NOMOVE);
}

Void CBitSlider: : UpdateToolTips ()
{
Cstrings strTips;
StrTips. The Format (" % d % % ", this -> GetPos ());

M_ctlTips. UpdateTipText (strTips, this);
M_ctlTips. UpdateTipText (strTips, & m_Thumb);
}

Void CBitSlider: : BuildThumbItem (UINT nThumbRes, cx, int int cy)
{
If (m_Thumb m_hWnd!=NULL | | nThumbRes <=0)
return;
M_Thumb. Create (WS_CHILD | WS_VISIBLE, this, 0).
ASSERT (m_Thumb m_hWnd!=NULL);
M_Thumb. ReLoadBitItem (nThumbRes, cx, cy);
M_Thumb. SetNotifyParent (TRUE);

M_ctlTips. Create (this);
M_ctlTips. AddTool (this);
M_ctlTips. AddTool (& m_Thumb);
M_ctlTips. SetDelayTime (100);

This -> UpdateToolTips ();
}

Void CBitSlider: : BuildThumbItem (CBitItem * lpBit)
{
If (lpBit==NULL | | m_Thumb. M_hWnd!=NULL)
return;
M_Thumb. Create (WS_CHILD | WS_VISIBLE, this, 0).
ASSERT (m_Thumb m_hWnd!=NULL);
M_Thumb. SetBitItem (lpBit);
M_Thumb. SetNotifyParent (TRUE);

M_ctlTips. Create (this); nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related