Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting Picture Control

Status
Not open for further replies.

Tereus

Programmer
Sep 10, 2003
14
0
0
GR
I use Visual Studio NET

I put a Picture Control to a Dialog Form.
It (Picture Control) has properties. The question is how I can change these properties in run time? Let's say for instance Modal Frame.

Vladimir
 
When you say "I put a Picture Control to a Dialog Form" I understand that you have already assigned an ID to this CStatic control , let be it ID_MY_PICTURE and it should be defined in the resource.h and also in the .rc file.
To access the control at run time use :
CStatic * pStatic= (CStatic*)GetDlgItem( ID_MY_PICTURE );
if (pStatic)
{
pStatic->SetBitMap();
pStatic->GetBitmap();
}

Put these statements in the OnInitDialog() or when you cklick on the picture by implementing the BN_CLICKED event:
class CMyDlg : public CDialog
{
public:
//
afx_msg void OnMyPicture();
//

};

BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
//{{AFX_MSG_MAP(CMyDlg)
ON_BN_CLICKED(IDC_MY_PICTURE, OnMyPicture)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

void CMyDlg::OnMyPicture()
{
// TODO: Add your control notification handler code here

}

Another solution is to add a DDX exchange variable associated with this control.
-obislavu-
 
Thanks. I have done it. The problem is the following:

Let's look at the properties that Wizard offers for this control:

Accept Files
Border
Center Image
...
...
Modal Frame
...
...
Visible

If we look at the Help to find CStatic members or type pStatic-> and look at the list of properties and methods then there will be not above properties.
 
These properties you are referring to (e.g. Border, Modal Frame, Visible etc) are not specific to Static controls, but apply to all windows in General. Some are extended styles (for example WS_EX_DLGMODALFRAME) and others are just ordinary styles (for example WS_VISIBLE). You set this with SetWindowLong.


[sub]I REALLY hope that helps.[/sub]
Will
 
Thanks a lot!

May be there is some description of the accordance between what Wizard offers (properties) and windows styles to look to? Or is it up to me?

Thanks in advance

Vladimir
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top