我已下载自定义ListView
控件,该控件不包含从右到左布局的属性。
我写了这段代码:
public class CustomListView : SourceListView
{
const int WS_EX_LAYOUTRTL = 0x400000;
const int WS_EX_NOINHERITLAYOUT = 0x100000;
private bool rightToLeftLayout = false;
public CustomListView() : base()
{
//SetStyle(ControlStyles.UserPaint, true);
}
[Localizable(true)]
public bool RightToLeftLayout
{
get { return rightToLeftLayout; }
set
{
if (rightToLeftLayout != value)
{
rightToLeftLayout = value;
this.RecreateHandle();
}
}
}
protected override CreateParams CreateParams
{
get
{
CreateParams CP;
CP = base.CreateParams;
if (this.RightToLeftLayout &&
this.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
CP.ExStyle = CP.ExStyle | WS_EX_LAYOUTRTL | WS_EX_NOINHERITLAYOUT;
return CP;
}
}
翻转ListView
水平而不是从右到左绘制文字
示例:
我需要做些什么来解决它?