C#ListView和从右至左 [英] C# ListView and RightToLeft

查看:358
本文介绍了C#ListView和从右至左的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在列表视图,查看英文文本与RightToLeft属性设置为真。结果
当我把在文中括号内似乎被逆转。结果
如果我尝试写堆栈(溢)​​我会看到(堆栈(溢出。结果
有没有办法解决这一问题?

这是我的code的一部分:

 项目=(ListViewItem的)myList.Items.Add(ID,MyString的,iconIndex);
                    MyListView.SetSubItemText(项目,1,S1);
                    MyListView.SetSubItemText(项目,2,S2);
                    MyListView.SetSubItemText(项目; 3,S3);
                    MyListView.SetSubItemText(项目,4,S4);


解决方案

这在很大程度上取决于您使用的Windows版本,列表视图实现为在Windows本地控制,ListView控件类是只针对它的托管包装。从右到左呈现行为已在不同版本的改变。

在一般情况下,你应该永远只能设置为从右至左是,当你的本地化用户界面到需要的文字从右到左呈现的语言。希伯来文或阿拉伯文。掌握串用另一种语言异常的行为并不意外。如果你的目的是使用该属性来获取不同的取向,那么你就必须找到一种替代。喜欢的OwnerDraw或ColumnHeader.TextAlign

I need to view english text in a listview with the RightToLeft property set to "true".
When I put brackets in the text it seems to be reversed.
If I try to write "Stack(Overflow)" I will see "(Stack(Overflow".
Is there a way to fix this?

this is a part of my code:

                    Item = (ListViewItem) myList.Items.Add(id, myString, iconIndex);
                    MyListView.SetSubItemText(Item, 1, s1);
                    MyListView.SetSubItemText(Item, 2, s2);
                    MyListView.SetSubItemText(Item, 3, s3);
                    MyListView.SetSubItemText(Item, 4, s4);

解决方案

This strongly depends on the version of Windows you use, list view is implemented as a native control in Windows, the ListView class is only a managed wrapper for it. The right-to-left rendering behavior has changed across different versions.

In general, you should only ever set RightToLeft to Yes when you localized your user interface to a language that requires right-to-left rendering of text. Hebrew or Arabic. Getting unusual behavior with strings in another language is not unexpected. If your intent was to get different alignment using that property then you'll have to find an alternative. Like OwnerDraw or ColumnHeader.TextAlign

这篇关于C#ListView和从右至左的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆