{"id":4138,"date":"2014-03-30T08:06:36","date_gmt":"2014-03-30T08:06:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/mfc-size-of-picture-control-collection-of-common-programming-errors\/"},"modified":"2014-03-30T08:06:36","modified_gmt":"2014-03-30T08:06:36","slug":"mfc-size-of-picture-control-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/mfc-size-of-picture-control-collection-of-common-programming-errors\/","title":{"rendered":"MFC &#8211; size of picture control-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn Hi,how can I know and set the size in pixel of a picture control in a MFC dialog with vc++ 2008?<\/li>\n<li>\n<h3>13 Answers<\/h3>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn1 Right bottom of the Visual Studio screen, in the status bar you can see the widht and height of the control.<\/p>\n<p>If you edit the .rc file, you can see the coordinate values for left,top,right and bottom of your picture control.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn2 Of course it exist! Look at the toolbox! It\u00b4s a window for bitmap.I need to know the size now! In the dialog &#8220;form&#8221; not at run time. I want to set a panel at 320&#215;240! There must be a file where the size is saved !?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn3<\/p>\n<p>If 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.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn4 actually it\u00b4s more for a webcam stream! I just use the picture control as rectangle.Isn\u00b4t there a table in a file were the size are saved for the compiler?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn5 Right bottom of the Visual Studio screen, in the status bar you can see the widht and height of the control.<\/p>\n<p>If you edit the .rc file, you can see the coordinate values for left,top,right and bottom of your picture control.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn6<\/p>\n<p>thanks!<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn7<\/p>\n<p>It doesn&#8217;t work that way.\u00a0 The resource editor does not work in units of pixels, it works in &#8220;dialog units.&#8221;\u00a0 Dialog units are scaled at run time depending on screen resolution and user settings for font\u00a0DPI.\u00a0 The only way to set the control size in units of pixels is at run time, using\u00a0MoveWindow or SetWindowPos.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn8<\/p>\n<p>ok then that\u00b4s the reason&#8230; I was wondering why the 320*240 are so small. Because it\u00b4s a windowless mode it could give weird stuff if I set the size at run time&#8230; maybe the window could become bigger than the dialog?!<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn9<\/p>\n<p>The dialog designer edit on resource files, not MFC classes. If you want to move a window at runtime, use the methods I mentioned above.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn10<\/p>\n<p>The problem is, I\u00b4m relly not in touch with what you mentioned. What is the difference with SetWindowPos?<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn11<\/p>\n<p>SetWindowPos works with pixels, not dialog units.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn12<\/p>\n<p>I get that but I\u00b4m 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.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn13 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&#8217;t DPI aware. Read here for more information.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4138","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4138"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4138\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}