Monday, April 30, 2012 12:43 PM
I have a problem with combobox. I set the DrawMode into OwnerDrawVariable so I can draw items seperately with styles, but the characters of the items are now displaying blocks.
The block characters are none ASCII. It used to display well but not now and I don't know what caused it to happen. I didn't change my system locale. At the same time, other combobox that have Normal DrawMode displays nicely fine.
My custom drawing code:
May anyone tell me where's the problem?
Thanks very much
Monday, April 30, 2012 1:15 PMDoes the font selected for your combo support this character set?
Monday, April 30, 2012 2:15 PM
Does the font selected for your combo support this character set?
Thanks for your great hint and it appears to be caused by that. I tried with a definite font (instead of 'Combo.Font') and ok.
But it is still a bit strange eh? Since the font is Segoe UI Light and it renders other controls (include combos that have DrawMode=Normal) on the form very well. Nevertheless, it used to be okay on drawing this combo but only since very recent. So I even never doubted about the font ;).
So is there anything different when drawing text with OwnerDrawVariable graphics painting regarding they are using the same font??
- Edited by VictorXP Monday, April 30, 2012 2:28 PM
Tuesday, May 01, 2012 4:00 AM
Would you please show all code about this issue? it will help us to solve your issue.
>>It used to display well but not now and I don't know what caused it to happen.
I don't think one application will be changed if you don't change anything, SO you need to show us the change of VS Or the OS.
No code, No fact.
- Edited by calanghei Tuesday, May 01, 2012 4:38 AM
Tuesday, May 01, 2012 9:09 AM
You've kindly mentioned me with some minor changes made to the environment, ie an VS update with SP1, and switched OS MUI into Chinese from Dutch (that case I can test my dual culture of app but after that not switched back). Umm, will em matter?
Also the finally drawing code:
e.Graphics.DrawString(combo.Items(e.Index), combo.Font, b2, rect.X, rect.Y)where combo.Font is the original font of this cbo that used for the whole app (works fine on other controls), debug snippet shown as image above.
Wednesday, May 02, 2012 3:04 AM
>>will em matter?
I think you can switched the OS MUI to find whether it is the root issue. :)
>>Also the finally drawing code:
Please trust me that I have read your this code in your first post. I'm afraid that we need your code or steps to check whether it can be re-appearence in my PC. So that we can help you with your issue easier. So please post your code here, OR just publish your application to the SKY-Drive. I will download it and check whether the issue is.
I'm not familiar with the Font and not sure wheher the Chinese Font is support Segoe UI Light, But I just wandered, why you need to use drwaing to deal with it. because the drawing will failed to doing some complex format. just using combobox.items.add method with drawmode setting to normal.
No code, No fact.
Friday, May 04, 2012 3:39 AM
Thanks for your patience. I just solved it by changing UI font with culture compatible ones. However, my project already laid down for further version dueing to few aspects of unstatibility of VS like resource messing. Anyway, tyvm ;)