Change Content Alignment in Run Time
Hello,
1. I would like to implement to let the user can change content content alignment in run time. But the left click is for sorting. How about Right click function. I want to add Right Alignment, Left Alignment, Center Alignment to the built in configure menu strip.
2. Select the cell and row not only by the row. Let's say if there is 10 column and 10 Row. I want to select only 3 row and 3 column by mouse move selection.
Thanks in advance.
-
Hi,
1. You can modify header's toolstrip in runtime. Look at the code, provided below:
grid.HeaderContextMenu.Opening += delegate(object sender, CancelEventArgs e)
{
Column column = grid.HitTests.ColumnTest(grid.PointToClient(Cursor.Position));
if(column != null)
{
ContextMenuStrip menu = sender as ContextMenuStrip;
if (menu != null)
{
menu.Items.Insert(0, new ToolStripMenuItem("Right", null, delegate
{
column.Appearance.CellTextAlignment = ContentAlignment.MiddleRight;
}));
}
}
};2. The grid doesn't support this feature yet. Our dev team will take care about your demand. If you absolutely need to implement this feature, it can be emulated in the Grid.PaintCell event handler.
Kind regards,
The Dapfor Team0
Please sign in to leave a comment.
Comments
1 comment