MFC – size of picture control-Collection of common programming errors
.png)
msdn Hi,how can I know and set the size in pixel of a picture control in a MFC dialog with vc++ 2008?-
13 Answers
.png)
msdn1 Right bottom of the Visual Studio screen, in the status bar you can see the widht and height of the control.If you edit the .rc file, you can see the coordinate values for left,top,right and bottom of your picture control.
.png)
msdn2 Of course it exist! Look at the toolbox! It´s a window for bitmap.I need to know the size now! In the dialog “form” not at run time. I want to set a panel at 320×240! There must be a file where the size is saved !?.png)
msdn3If you set the bitmap at the design time, then open the bitmap in the resource editor and go to its properties where you can see the width and height of the bitmap.
.png)
msdn4 actually it´s more for a webcam stream! I just use the picture control as rectangle.Isn´t there a table in a file were the size are saved for the compiler?.png)
msdn5 Right bottom of the Visual Studio screen, in the status bar you can see the widht and height of the control.If you edit the .rc file, you can see the coordinate values for left,top,right and bottom of your picture control.
.png)
msdn6thanks!
.png)
msdn7It doesn’t work that way. The resource editor does not work in units of pixels, it works in “dialog units.” Dialog units are scaled at run time depending on screen resolution and user settings for font DPI. The only way to set the control size in units of pixels is at run time, using MoveWindow or SetWindowPos.
.png)
msdn8ok then that´s the reason… I was wondering why the 320*240 are so small. Because it´s a windowless mode it could give weird stuff if I set the size at run time… maybe the window could become bigger than the dialog?!
.png)
msdn9The dialog designer edit on resource files, not MFC classes. If you want to move a window at runtime, use the methods I mentioned above.
.png)
msdn10The problem is, I´m relly not in touch with what you mentioned. What is the difference with SetWindowPos?
.png)
msdn11SetWindowPos works with pixels, not dialog units.
.png)
msdn12I get that but I´m still wondering if a panel can become so big, because of pixel setting, that the application goes weird when I change the screen resolution. For example the panel, where the video is shown, goes over the start button when I decrease the screen resolution.
.png)
msdn13 Are you using Vista? If the process is DPI aware, and changing the resolution also changes the DPI, then some scaling can still take place. If you really need absolute positioning, make sure the process isn’t DPI aware. Read here for more information.