@@ -70,7 +70,7 @@ class MRadCtrl : public MWindowBase
70
70
public:
71
71
DWORD m_dwMagic; // magic number to verify the instance
72
72
BOOL m_bTopCtrl; // is it a top control?
73
- HWND m_hwndRubberBand; // the rubber band window
73
+ MRubberBand m_hwndRubberBand; // the rubber band window
74
74
BOOL m_bMoving; // is it moving?
75
75
BOOL m_bSizing; // is it resizing?
76
76
BOOL m_bLocking; // is it locked?
@@ -79,7 +79,7 @@ class MRadCtrl : public MWindowBase
79
79
INT m_nImageType; // the image type
80
80
81
81
// constructor
82
- MRadCtrl () : m_dwMagic(0xDEADFACE ), m_bTopCtrl(FALSE ), m_hwndRubberBand( NULL ),
82
+ MRadCtrl () : m_dwMagic(0xDEADFACE ), m_bTopCtrl(FALSE ),
83
83
m_bMoving (FALSE ), m_bSizing(FALSE ), m_bLocking(FALSE ), m_nIndex(-1 )
84
84
{
85
85
m_pt.x = m_pt.y = -1 ;
@@ -182,12 +182,7 @@ class MRadCtrl : public MWindowBase
182
182
// get the rubber band that is associated to the MRadCtrl
183
183
MRubberBand *GetRubberBand ()
184
184
{
185
- MWindowBase *base = GetUserData (m_hwndRubberBand);
186
- if (base)
187
- {
188
- return static_cast <MRubberBand *>(base);
189
- }
190
- return NULL ;
185
+ return m_hwndRubberBand.m_hwnd ? &m_hwndRubberBand : NULL ;
191
186
}
192
187
193
188
// get the MRadCtrl from a window handle
@@ -224,7 +219,7 @@ class MRadCtrl : public MWindowBase
224
219
225
220
// destroy the rubber band of the control
226
221
DestroyWindow (pCtrl->m_hwndRubberBand );
227
- pCtrl->m_hwndRubberBand = NULL ;
222
+ pCtrl->m_hwndRubberBand . m_hwnd = NULL ;
228
223
}
229
224
}
230
225
@@ -260,7 +255,7 @@ class MRadCtrl : public MWindowBase
260
255
MRubberBand *band = GetRubberBand ();
261
256
if (band)
262
257
DestroyWindow (*band);
263
- m_hwndRubberBand = NULL ;
258
+ m_hwndRubberBand. m_hwnd = NULL ;
264
259
265
260
// remove the control from targets
266
261
GetTargets ().erase (m_hwnd);
@@ -284,9 +279,8 @@ class MRadCtrl : public MWindowBase
284
279
return ;
285
280
286
281
// create the rubber band for the control
287
- auto band = new MRubberBand;
288
- band->CreateDx (GetParent (hwnd), hwnd, TRUE );
289
- pCtrl->m_hwndRubberBand = *band;
282
+ ::DestroyWindow (pCtrl->m_hwndRubberBand);
283
+ pCtrl->m_hwndRubberBand .CreateDx (GetParent (hwnd), hwnd, TRUE );
290
284
291
285
// if not group box
292
286
if (!MRadCtrl::IsGroupBox (hwnd))
0 commit comments