Icon size help WINAPI only showing small c - c

Hi there just a quick question I hope someone can help me with I am loading a logo onto my dialog application into a static picture holder using the .rc file and adding this code.
ICON IDI_MYICON,IDC_STATIC_IMAGE,120,154,21,20
However my problem is this will only display a 64x64 image max and the banner I have loaded is 242x74 in size am I using the wrong method in using ICON? I did try bitmap but didnt work either.
Thanks

The 21,20 in your statement is the width and height of the icon control in dialog units. Dialog units vary depending on things like screen DPI and the font selected. There are typically 2-4 pixels per dialog unit. You've basically given the icon something on the order of 64x64 to display in.
To get the icon control sized pixel-perfectly, you can to resize it dynamically, e.g., during WM_INITDIALOG.
Also, I'm not sure which method the dialog box code uses to load the icon--some (like LoadIcon) restrict the size to a "standard" size which others (like LoadImage) do not.

Related

Why are my menu items too small or too big?

I'm using the default theme, which I understand is effectively the theme for the platform.
If I put my menu items in the side menu, they show up way too small. If I put them in the overflow menu, the show up way too big. I don't know the UUIDs for the components that display them, so I don't know how to override the font. Here are some examples:
Here they are in a side menu. As you can see, about five of them fit in the width of a penny. These are too small to be usable.
.
Here they are in the overflow menu. They're enormous. I couldn't fit two of them in the width of a penny.
.
Here are some menus from a native application. In this example, you can see both the side menus and the overflow menus, which are a little big bigger, but they're both about 3 to the width of a penny. This is a very sensible size for my phone.
.
I never see these objects in code, so I can't fiddle with their Style objects. And I can't find them in the Resource Editor. Can anyone tell me how I can get these to show up in a sensible size?
Use the more modern flat themes (blue, red, orange), the older native themes needs to be updated to use the Toolbar and the side menu.
The style for the overflow is "Command" and for the side commands is "SideCommand" make sure the styles Fonts are declared using mm and not pixels to allow it to adjust to different resolutions.

Image displaced or absent with ImageViewer

Using the designer. My form has a layout BoxLayoutY. I just drop the ImageViewer in it. I have a pic added through "Add Picture", which is 1080 x 1400. I add it to the ImageViewer.
The "Simulate Device" command gives, in iPhone3:
And in Nexus (the pic below is static: can't be scrolled up or down):
Help?
I have installed the app locally on my Android and I get the same half cut pic as in the screenshot of the Nexus simulator.
The overal goal is to have a single form, scrollable vertically, showing pics (adjusted at the width of the screen) and text.
EDIT:
Could be a problem with the resolution of the pic. I decrease the res to 350 x 467 and it displays fine. So it will pixelize or won't scale to fit the width of the screen on larger devices?
The image viewer doesn't have a preferred size since it doesn't have an image in it. Its designed for usage full screen or within a predetermined layout. If you place it in the center of a border layout it will take up available space and work as expected.
Since it scales the image and allows manipulation of that images size, its size is flexible. If you want a component that takes up the exact image size you should use a Label.
Ok got it!
What I was doing wrong was that I had:
MainForm (in a BoxY layout)
-> a container nested in it (in Borderlayout)
---> an ImageViewer nested at the center of it.
This produced the effect above (half cut pic).
Instead, what achieved a properly sized pic was:
MainForm (in a BorderLayout).
-> The ImageViewer nested at the center of it. That's it, no container.

How to use image as icon in winforms?

I
My requirement is something like attached image.
I am designing an File editor with more options like language , copy ,paste and save. For that i tried adding icon image to menu strip. It worked but i have limitations on size adjustment , clarity all those things.
Could anyone suggest me any option/control to achieve similar to attached image.
Thanks
You can look at 2 approaches:
Use Gallery in Ribbon Control;
Shrink an image to 32 X 32 or 16 X 16 and you will get a reasonable looking icon. You can try this site to shrink you image resources.

Automatically sizing a GtkTextView in a GtkScrolledWindow

I work on gschem, a free software tool for editing electronics schematic diagrams. Recently we have encountered a problem using a GtkScrolledWindow containing a GtkTextView.
Context
Recent versions of Ubuntu use overlay scrollbars, which mean that GtkScrolledWindows no longer set a minimum height that provides enough room for a legacy scrollbar (in fact, they have a minimum height of 0). Likewise, a GtkTextView with no text to display requests a height of 0. This means that one of the scrollable GtkTextViews in gschem has been being displayed as one pixel in height, and this is obviously unusable.
In the dialog box on the right of the screenshot shown above, note the invisible widget between the "Value:" label and the "Add" button.
This has been reported independently by several users -- see also the bug report.
Question
Obviously, we could fix this by doing:
g_object_set (textview, "height-request", 100, NULL);
However, this is pretty inelegant, and will break for users who set very large font sizes in pixels (e.g. users with vision problems or who use high-DPI screens).
Ideally, therefore, we want to set the minimum size of the GtkTextView relative to the default font size, e.g. tell it to "show at least three lines of text".
Can anyone suggest a sensible/elegant approach for doing this?
Just disable the ubuntu overlay scrollbars in your application by doing:
putenv("LIBOVERLAY_SCROLLBAR=0");
Not ideal, but it's a quite good until you can find a more permanent solution. Alternatively just wait until Ubuntu disables overlay scrollbars...
I would add code to dig out the current/default style information, use that to figure out the font baseline height, and then compute some rough size allocation based on that, around three lines as you mention.
Does it have to be a textview ? If you can use an eventbox instead, then you can make a cairo surface from it, render the text with pango, and then use pango_layout_get_size() to get the text height.
Likewise, a GtkTextView with no text to display requests a height of 0.
Probably you can create GtkTextView with some text inside. Like several spaces, and set empty value after creation.

ALT-TAB Application Icon Pixelated

When a child window of my application is opened and I view the ALT+TAB menu, the application icon looks pixellated. I assume that Windows uses a low resolution version of the icon (16x16 pixel I think). What can I do that Windows selects the right version which would be 32x32 pixel?
I assigned an icon to the window in question that has 16x16, 24x24, 32x32, 48x38 and 256x256 in true color. Please note that VS says in the proterties that 32x32 is used and that it works fine for the main window of my application where I assigned the exact same icon.
The caption bar of a Windows application window display icons in 16x16 pixels. The Alt-Tab list, however, shows icons in 32x32 pixels. It uses the same icon as is set for the window. If you only set a 32x32 one, the caption bar has to scale it down, which tends to look ugly as it uses nearest-neighbor interpolation. So how does one support both?
The answer is the ICO file! It supports embedding multiple icons in one file, typically the same (or similar) icon in various sizes and, less commonly, color formats.
Browsers, Windows, and others are typically designed to smartly use the appropriately sized variant within a given ICO file. So the answer is to have an ICO file with both sizes (or more) inside. The result is that the caption bar correctly uses the 16x16 version and Alt-Tab uses the larger 32x32 one.
The methods for saving an ICO file with multiple icons inside varies from program to program. However, GIMP can easily do it (and it's free). The trick is to have your variously-sized icons as separate layers. When you go to save it as an ICO file, GIMP will prompt you with the ability to set the size and color format of each layer. A good tutorial, with images, can be read here.
If anyone has any links or suggestions for creating multi-icon ICO files in other programs, feel free to add them. Also, I'm unsure if the Visual Studio built-in image editor can do it or not — I've rarely bothered with it.
Fixed the problem. I put the icon on the wrong form. As I don't think that this question will be of any help for anybody feel free to delete it.

Resources