It is observed in some fonts sat Verdana, that the rendering for bold and normal text does not occupy the same width for a given text.
In my application i am making use of one such font ,and there is UI with list and highlighted item.
for highlighted item the font is same with bold attribute ,because of above mentioned font issue the text appears to move(enlarge and occupy more space )horizontally when the list is scrolled.
I can use bold font with one less in font size which seem ok but not perfect
Is there any corrective measure to resolve this?
What you describe is the default attribute of most proportional fonts. If having the string width increased seems ugly, try using other visual methods to draw attention to the selected item, such as changing the background color.
You could make the list items wide enough to accommodate size increase when it becomes bold.
If the highlight has to be bold, most likely your only option is using a proportional font (doesn't need to be courier, you may find some sans-serif proportional fonts acceptable).
Related
I wanted to wrap the existing text of checkbox into multiline if the width of row exceeds the width of its parent window. I am not really sure how to do that.
The image I want to show the checkbox string
The image where the string is cropped and only shows if window is resized or maximized
You are going to have a problem with this I am afraid.
The setting for making a checkbox multiline is ES_MULTILINE and if you look here you will see that it states:
To create an edit control using the CreateWindow or CreateWindowEx function, specify the EDIT class, appropriate window style constants, and a combination of the following edit control styles. After the control has been created, these styles cannot be modified, except as noted.
So, it would seem to me that you have three ways forward, depending on what you feel is the best or most elegant for you.
Set your control in the resource editor as multiline anyway. Then it doesn't matter and will wrap. No need to have to change the setting.
Implement the needed functionality to limit the size the window can be reduced to. I can show you how if you are interested. This way, if you set the control resize properties correctly it can resize larger but only reduce down the a known dimension (ie: the dimensions you created it in the resource editor).
Possibly have two controls in the same place, one as multiline and one as single. And when you decide which you want to show, swap the visibility. But I think this is a bad idea, bit of a headache, and not worth the hassle.
IMHO I would do both ideas 1 and 2 and I would happily extend my answer to provide more information.
Update
Having looked at your images and the comments about translations then there is a fourth idea. If you use a third party application to manage the translations and use satellite DLL files then you can adjust the resources on a language by language basis. I sometimes have to make the default width for some windows wider due to their verbose nature.
I have set BS_MULTILINE for the checkbox. The minimum size of the window is fixed but I just want the checkbox to fit in that. I expect it to show at least one word in the same line as other labels and remaining words in second line. So I am checking if the total width of the first row is greater than the width of window then show the string with \r\n in it else show normal string. However, I want to align first line or the first word of the checkbox with the checkbox and remaining words should come below the first word. Currently, the checkbox is in between two lines which looks weird. Is there anyway I can do this?
I want to increase the size of my tooltip as i want to insert an image as background to my tooltip. I am able to apply an image to my tooltip but the problem is the size of the tooltip being small only the upper part of the image is being displayed.
I am displaying image using Graphics Draw Image function. And I want the tooltip to take original size of an image without creating a rectangle as I tried all already.
I don't want to create my own tooltip. Just increase size of existing one.
I resolved it!! Just needed to add spaces on the property Tool tip on mytooltip on that control on which tool tip is used.Here i have used tool tip on my buttons.
I have required styles (from designer) applied on my TABs used in Actionbar for navigation and I use Actionbar Sherlock. They look perfectly from ldpi to xhdpi devices, but situation changes on xxhdpi devices.
I have only 2tabs and except mentioned styling, I have the same code as Sherlock DEMO app in "Tab Navigation". I found 2 older simmilar questions not answered yet.
Stacked ActionBar tab bar not filling parent
(I've got a simmilar problem, centered tabs. Sorry for inconvenience, I can't attach images because of rep points.)
and
action bar tabs not fill screen in android
Since the time of their posts, this is not only the issue of tablets, but now, there are many FULLHD (flagship) smartphones and this is becomming the big "design" issue.
I want my 2tabs to fill/match the full width of ANY device size, so in my case to fill 50% width each. Default Holo styled tabs doesn't look that bad (as shown in previous link), but my styled tabs on this big screen look much worse.
PS: Situation doesn't change if I make a text in tabs bigger or longer. Tabs don't adujst their width, instead they change their height and text takes 2 lines.
Unfortunatelly, this is a another JB changes:
https://android.googlesource.com/platform/frameworks/base/+/b8139af3dcae80c0030afd0354dc424a7c72c3d9
One of solution: set target SDK 15 or lower.
How can one make a CStatic with text auto-wrap (multiline) which vertically centeres the result in the control's rectangle?
The problem I'm trying to solve is this: I have a CStatic control next to a CComboBox which updates information text depending on the choice. This text can be either short or long, requiring the CStatic to sometimes use multi-lines, and sometimes not. I want the info-text be vertically center-aligned with the CComboBox.
Now here is the problem:
If I make the CStatic only 1 textline high, it looks good for 1-line texts, but multi-lines do not fit and are not displayed.
If I make the CStatic higher to fit 2 lines, it looks good for long texts (with 2 lines), but 1-line-texts are shifted upwards, as the CStatic aligns the text on the top. A CStatic with the behavior mentioned in the question would solve this...
If I can't easily get a vertically centered CStatic multi-line control, the alternative would be to resize the control rect depending on the amount of text in it. But in this case I have a different problem:
How can I programatically find out how many lines a text will need in a CStatic of specific width?
Unfortunately you can't vcenter multi-line text in a CStatic.
Your next question has a solution but it's a bit of a pain to use. What you do is you use CDC::DrawTextEx with the DT_CALCRECT flag to get the size (in pixels) of the text you want to format. By dividing that by the height of a line of text (given in the font info you can get from the DC, plus some spacing which I'm not sure of how much that is - presumably it's a fixed amount, I don't think you can specify line spacing with DrawText), you will get (an approximation of) the number of lines you will get. You can then resize the control rect.
Come to think of it, you are probably better off not converting to lines and just resize your control to the extent you get from DrawTextEx :)
Things like this usually require some experimentation to get exactly right, and sometimes behave differently between OS versions. Proceed with caution.
In my MFC program,I want to display different size images in a list!
I use CListCtrl and CImageList!
But the CImageList only can load fixed images!
Variable row heights in CListCtrl is not supported. You could take a look at this article that describes a control based on CWnd that handles drawing of variable row heights.
I would consider to use the so called "owner drawn" mode to draw these myself. I don't know about another option (there is no built-in mode)... Maybe you can also take the biggest size and fit the smaller images into the bigger frames but I think it will be the same effort and be less efficient...
I mean use the
CListCtrl::DrawItem()
method
Create a "grid," a non-symmetrical grid most likely, on a dialog or Form. Then populate it with irregular shaped images as you choose. If you need more space look into a Scrollable “whatever,” view, dialog, etc.
Irregular or non rectangular shaped bitmaps seems a good place to start.