Prev: VirtualAllocEx returns a bad pointer in some processes
Next: CRichEditCtrl::Create and RTF format
From: Eric on 29 Jan 2007 13:27 I need to display a small image in a dialog. So I used the Picture Control and sized it to the space I have in the dialog (VS2005 shows me 50x35). Then I created an image of 50x35 pixel and saved it as bitmap, imported it into a resource (where it reads 50x35 pixel), set the Picture Control to Type Bitmap and selected in the Image field the bitmap resource. Now I have a bitmap of 33x22 on the dialog, in other words much smaller than I wanted and than I have drawn the bitmap. The switch Real Size Image has no effect. How can I keep the image in the size I want? I know that dialogs are in dialog units, and that the picture resizes with the dialog would be ok. I don't want to write any code to resize the image (if necessary I'll redraw the image in an image program). What can I do? Eric
From: AliR (VC++ MVP) on 29 Jan 2007 13:41 You shouldn't have to. When you run the program it should display correctly. (Normally when I close the dialog and reopen it in the resource editor, it displays the correct pictrue and size). If I remember correctly the resource editor doesn't even let you resize a picture control, it automatically takes the size of the bitmap. AliR. "Eric" <bauersachs(a)kull.ch.cuthere.nospam.me.com> wrote in message news:ePsZDN9QHHA.412(a)TK2MSFTNGP02.phx.gbl... >I need to display a small image in a dialog. So I used the Picture Control >and sized it to the space I have in the dialog (VS2005 shows me 50x35). >Then I created an image of 50x35 pixel and saved it as bitmap, imported it >into a resource (where it reads 50x35 pixel), set the Picture Control to >Type Bitmap and selected in the Image field the bitmap resource. Now I have >a bitmap of 33x22 on the dialog, in other words much smaller than I wanted >and than I have drawn the bitmap. The switch Real Size Image has no effect. >How can I keep the image in the size I want? > > I know that dialogs are in dialog units, and that the picture resizes with > the dialog would be ok. I don't want to write any code to resize the image > (if necessary I'll redraw the image in an image program). What can I do? > > Eric >
From: Joseph M. Newcomer on 31 Jan 2007 15:16 See my answer to your "problem solved" posting (try to use the same subject line to make tracking the responses easier). You have confused dialog box units (DBUs) with pixels. As I mention in my answer, redrawing the image to fit the picture control area precisely is doomed, and is a completely unacceptable solution if you ever plan to run your program on any other machine in the known universe, or at any time upgrade your machine, change its display, resolution, or default font. I find fewer unpleasant artifacts by making large images smaller than small images larger when I use StretchBlt. But at no time would I consider redrawing the image to "fit precisely" as a viable solution. It won't work except in one, and only one, precise case. All attempts to redraw the image will require that you create one image for each possible combination of display screen size, display resolution, video card vendor, and version of display driver, for all possible settings of default fonts. This means a lot of pictures. That's probably about 8 screen resolutions, 6 screen sizes, 3 font sizes, and that means 124 pictures, and I've probably missed a few. And that doesn't even take into account the idiosyncrasies of display cards and drivers. joe On Mon, 29 Jan 2007 19:27:48 +0100, "Eric" <bauersachs(a)kull.ch.cuthere.nospam.me.com> wrote: >I need to display a small image in a dialog. So I used the Picture Control >and sized it to the space I have in the dialog (VS2005 shows me 50x35). Then >I created an image of 50x35 pixel and saved it as bitmap, imported it into a >resource (where it reads 50x35 pixel), set the Picture Control to Type >Bitmap and selected in the Image field the bitmap resource. Now I have a >bitmap of 33x22 on the dialog, in other words much smaller than I wanted and >than I have drawn the bitmap. The switch Real Size Image has no effect. How >can I keep the image in the size I want? > >I know that dialogs are in dialog units, and that the picture resizes with >the dialog would be ok. I don't want to write any code to resize the image >(if necessary I'll redraw the image in an image program). What can I do? > >Eric > Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Eric on 1 Feb 2007 10:16 Hello Joseph Thanks for your contribution. I thought when I redraw the image to this size, so that it fits on my screen, it later automatically causes a resize when the ratio of DU (dialog units) to pixels changes. But you make me feel that this won't work as I have thought. It looks like I have to use a much bigger bitmap and use StretchBlt(?) to resize it. Anyway, there's currently no more budget to implement this and probably this will look a little ugly on other machines. But the tool must be finished tomorrow and I currently have much bigger problems than the customer's icon on the dialog. Probably I'll fix this later (or never). Thank you for your help. Eric
|
Pages: 1 Prev: VirtualAllocEx returns a bad pointer in some processes Next: CRichEditCtrl::Create and RTF format |