简体   繁体   English

如何在devexpress gridcontrol组件中设置从右到左对齐?

[英]How can set right-to-left align in devexpress gridcontrol component?

How i can set right-to-left align in devexpress gridcontrol component ? 我如何在devexpress gridcontrol组件中设置从右到左对齐? (without using wpf) (不使用wpf)

like this picture: 像这张照片:

网格控件

In release 15.1 DevExpress introduced Right-To-Left (RTL) support across the following controls: 在版本15.1中,DevExpress在以下控件中引入了从右向左(RTL)支持:

  • Charts 图表
  • Grid controls (Grid, Treelist, Pivot Grid, Vertical Grid and Property Grid) 网格控件(网格,树列表,数据透视网格,垂直网格和属性网格)
  • Data Editors and Controls (Range Control, Rating Control, etc.) 数据编辑器和控件(范围控件,评分控件等)
  • Ribbon, Menus and related controls (BackstageView, AppMenu, еtс.) 功能区,菜单和相关控件(BackstageView,AppMenu等)
  • Layout Control and layout containers (TabControl, GroupControl, etc.) 布局控件和布局容器(TabControl,GroupControl等)
  • Navigation Controls (Navigation Bar, Tile Control, etc.) 导航控件(导航栏,平铺控件等)
  • Application UI Controls (Docking, DocumentManager, etc.) 应用程序UI控件(对接,DocumentManager等)

So, just set GridControl.RightToLeft property to RightToLeft.Yes and you will get the RTL layout. 因此,只需将GridControl.RightToLeft属性设置为RightToLeft.Yes ,您将获得RTL布局。

you can use ms trick: 您可以使用ms技巧:

make new component and in code view add the following lines: 制作新组件并在代码视图中添加以下行:

Imports System.ComponentModel
Imports DevExpress.XtraGrid.Localization
Imports System.Windows.Forms
Imports System.Drawing

Public Class MirroredDevExpressGrid
   Private _Mirrored As Boolean
   Const WS_EX_LAYOUTRTL = &H400000

   Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
      Get
         Dim CP As System.Windows.Forms.CreateParams = _
               MyBase.CreateParams
         If Mirrored Then
            CP.ExStyle = CP.ExStyle Or WS_EX_LAYOUTRTL
            MyBase.Refresh()
         End If
         Return CP
      End Get
   End Property

   <Description("Change to the right-to-left layout."), _
  DefaultValue(False), Localizable(True), _
  Category("Appearance"), Browsable(True)> _
   Public Property Mirrored() As Boolean
      Get
         Return _Mirrored
      End Get
      Set(ByVal value As Boolean)
         If _Mirrored <> value Then
            _Mirrored = value
            MyBase.OnRightToLeftChanged(EventArgs.Empty)
         End If
      End Set
   End Property

   Private Sub InitializeComponent()
      Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView
      CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
      CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
      Me.SuspendLayout()
      Me.LookAndFeel.SetSkinStyle("Money Twins")
      Me.LookAndFeel.UseDefaultLookAndFeel = False
      Me.Mirrored = True
      '
      'GridView1
      '
      Me.GridView1.GridControl = Me
      Me.GridView1.Name = "GridView1"
      '
      'MirroredDevExpressGrid
      '
      Me.MainView = Me.GridView1
      Me.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
         CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
      CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
      Me.ResumeLayout(False)

   End Sub


   Private Sub MirroredDevExpressGrid_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseMove

      Invalidate()
   End Sub

End Class

and in designer class:

you can use ms trick:

make new component and in code view add the following lines:

Imports System.ComponentModel
Imports DevExpress.XtraGrid.Localization
Imports System.Windows.Forms
Imports System.Drawing

Public Class MirroredDevExpressGrid
   Private _Mirrored As Boolean
   Const WS_EX_LAYOUTRTL = &H400000

   Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
      Get
         Dim CP As System.Windows.Forms.CreateParams = _
               MyBase.CreateParams
         If Mirrored Then
            CP.ExStyle = CP.ExStyle Or WS_EX_LAYOUTRTL
            MyBase.Refresh()
         End If
         Return CP
      End Get
   End Property

   <Description("Change to the right-to-left layout."), _
  DefaultValue(False), Localizable(True), _
  Category("Appearance"), Browsable(True)> _
   Public Property Mirrored() As Boolean
      Get
         Return _Mirrored
      End Get
      Set(ByVal value As Boolean)
         If _Mirrored <> value Then
            _Mirrored = value
            MyBase.OnRightToLeftChanged(EventArgs.Empty)
         End If
      End Set
   End Property

   Private Sub InitializeComponent()
      Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView
      CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
      CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
      Me.SuspendLayout()
      Me.LookAndFeel.SetSkinStyle("Money Twins")
      Me.LookAndFeel.UseDefaultLookAndFeel = False
      Me.Mirrored = True
      '
      'GridView1
      '
      Me.GridView1.GridControl = Me
      Me.GridView1.Name = "GridView1"
      '
      'MirroredDevExpressGrid
      '
      Me.MainView = Me.GridView1
      Me.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
         CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
      CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
      Me.ResumeLayout(False)

   End Sub


   Private Sub MirroredDevExpressGrid_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseMove

      Invalidate()
   End Sub

End Class

and in designer class:

Partial Class MirroredDevExpressGrid
   Inherits DevExpress.XtraGrid.GridControl

   <System.Diagnostics.DebuggerNonUserCode()> _
 Protected Overrides Sub Dispose(ByVal disposing As Boolean)
      MyBase.Dispose(disposing)
   End Sub
   Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView

End Class

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将devexpress defaultLookAndFeel组件放入devexpress网格控件中? - How can I put a devexpress defaultLookAndFeel Component inside of a devexpress gridcontrol? 如何在 DevExpress GridControl 的 CustomDrawGroupRow 事件中将自定义文本设置为 GroupRow? - How to set custom text to a GroupRow in the CustomDrawGroupRow event of a DevExpress GridControl? Devexpress-GridControl-Tab键-我希望Tab从右移到左 - Devexpress - GridControl - Tab Key - I Want Tab Move From Right To Left 如何使用.Net system.drawing.drawstring编写从右到左的字符串(项目是dll)? - How can I use .Net system.drawing.drawstring to write right-to-left string (project is a dll)? 如何解决C#蒙版文本框从右到左的输入行为? - How can I fix c# masked textbox right-to-left input behaviour? 如何访问DevExpress GridControl中的所有行? - How can I Access to all rows in DevExpress GridControl? 在WinForms中,如何在DevExpress GridControl中创建删除按钮? - In WinForms, how can I create a delete button in a DevExpress GridControl? 如何在 devexpress 中向 GridControl 添加控件? - How to add controls to a GridControl in devexpress? 如何在devexpress gridcontrol中使用buttonedit - how to use buttonedit in devexpress gridcontrol 如何检测从右到左的Windows界面C#? - how to detect a right-to-left windows interface c#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM