Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtLabel centering a bitmap whilst retained aspect Collapse All
Subject Author Date
Alastair Watts Jun 30, 2010 - 9:25 AM

I’ve got a CExtLabel control in a CExtResizableDialog and have called m_myExtLabel.ModifyStyle(0, SS_CENTER | SS_CENTERIMAGE);


Is it possible to retain the aspect of the bitmap like SetImageMode(CExtLabel::eTouchInside) does AND fully centre the bitmap like SetImageMode(CExtLabel::eAlign) does?


 


 

Alastair Watts Jul 1, 2010 - 10:09 AM

Any chance of an updated CExtLabel where SS_CENTER and SS_CENTERIMAGE are honoured when using eTouchInside?


Thanks!


 

Technical Support Jul 1, 2010 - 12:15 PM

The label control’s styles do support bottom alignment. We think we should design our own API instead.

Alastair Watts Jul 1, 2010 - 9:16 AM

I put the supplied code into CExtResizableDialog::OnSize() ... when drawing it flickers terribly and doens’t position correctly.


Any suggestions?

Technical Support Jul 1, 2010 - 12:14 PM

Please invoke this code in the OnInitDialog() virtual method, then add anchors to the label control if needed.

Technical Support Jun 30, 2010 - 10:23 AM

The CExtLabel::eTouchInside and CExtLabel::eTouchOutside modes of the CExtLabel and CExtAviLabel controls do not currently use the SS_CENTER|SS_CENTERIMAGE styles. You should move the label window according to the bitmap size displayed in it. Horizontal shift is half of width difference between label and bitmap. Vertical shift is half of height difference between label and bitmap. Here is the example:

CDialog * pThisDlg = . . .
CExtLabel * pLabel = . . .
CExtBitmap * pBitmap  = . . .
CRect rcLabel;
            pLabel->GetWindowRect( &rcLabel );
            pThisDlg->ScreenToClient( &rcLabel );
CSize sizeLabel = rcLabel.Size(), sizeBitmap = pBitmap->GetSize();
CSize sizeShift( ( sizeLabel.cx - sizeBitmap.cx ) / 2, ( sizeLabel.cy - sizeBitmap.cy ) / 2 );
            rcLabel.SetRect(
                        rcLabel.left + sizeShift.cx,
                        rcLabel.top + sizeShift.cy,
                        rcLabel.left + sizeShift.cx + sizeBitmap.cx,
                        rcLabel.top + sizeShift.cy + sizeBitmap.cy
                        );
            pLabel->MoveWindow( &rcLabel );