about slider control and static text

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am coding a property page for a directshow-based filter.<br/> class CMyAVCProperties : public CBasePropertyPage<br/> {<br/> ...<br/> };<br/> I added a slider control and a static text to the property page and use the following code to display a bitmap on the static text and set the position of the slider control.<br/> <br/> #define mssgboxu32(a) {wchar_t bufgldk[32];MessageBox(NULL, _ltow(a, bufgldk, 32), TEXT("Filter Name"), MB_OK);}<br/> HRESULT CMyAVCProperties::OnActivate()<br/> {<br/> CStatic *pStatic=(CStatic*)CStatic::FromHandle(GetDlgItem(m_Dlg, IDC_STATIC_Picture));<br/> if(pStatic)<br/> {<br/> CBitmap pbtmp;<br/> pbtmp.LoadBitmapW(IDB_BITMAP1);<br/> HBITMAP hBitmap = pbtmp;<br/> pStatic->ModifyStyle(0xf,SS_BITMAP);<br/> <br/> HBITMAP ret = pStatic->SetBitmap(hBitmap);<br/> mssgboxu32((u_int32)(&hBitmap))<br/> mssgboxu32((u_int32)(&ret))<br/> }<br/> <br/> CSliderCtrl *psldctrl;<br/> psldctrl = (CSliderCtrl*)CSliderCtrl::FromHandle(GetDlgItem(m_Dlg, IDC_SLIDER2));<br/> psldctrl->SetRange(-127, 127);<br/> psldctrl->SetPos(0);<br/> }<br/> <br/> The bitmap never appears. I output the &hBitmap and &ret by message box, and found they are 15uj0 and 15uj4 seperately. They are not equal.<br/> <br/> The slider of the slider control should be in the middle of the slider control after setting. But it stay at the left of the slider control. But if I click at the slider control, the slider immediately jumps to the right half part of the slider control.

View the full article
 
Back
Top