GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : AllowUserToResize Property |
<DefaultValueAttribute()> <SRCategoryAttribute("Behavior")> <FeatureAttribute(Name="Resize", Version="v5.0")> <SRDescriptionAttribute("Indicates whether users can resize the cells.")> Public Property AllowUserToResize As Boolean
Dim instance As GcMultiRow Dim value As Boolean instance.AllowUserToResize = value value = instance.AllowUserToResize
[DefaultValue()] [SRCategory("Behavior")] [Feature(Name="Resize", Version="v5.0")] [SRDescription("Indicates whether users can resize the cells.")] public bool AllowUserToResize {get; set;}
public class ResizeDemo : Form { private GcMultiRow gcMultiRow1 = new GcMultiRow(); private FlowLayoutPanel panel = new FlowLayoutPanel(); private Label label = new Label(); public ResizeDemo() { this.Text = "Resize Demo"; this.Size = new Size(600, 350); // Initial flow layout panel and add to form. this.panel.Dock = DockStyle.Left; this.panel.Size = new Size(250, 200); this.panel.FlowDirection = FlowDirection.TopDown; this.panel.WrapContents = false; this.panel.Padding = new Padding(5); this.Controls.Add(panel); // Add MultiRow to form this.gcMultiRow1.Dock = DockStyle.Left; this.gcMultiRow1.Width = 350; this.gcMultiRow1.CellResizeCompleted += new EventHandler<CellEventArgs>(gcMultiRow1_CellResizeCompleted); this.Controls.Add(this.gcMultiRow1); this.label.Height = 30; this.label.Dock = DockStyle.Bottom; this.label.BackColor = SystemColors.Info; this.label.Text = "You can resize the Cell at the right or bottom edge."; this.Controls.Add(label); gcMultiRow1.Template = Template.CreateGridTemplate(3); gcMultiRow1.RowCount = 5; FillValue(); this.Load += new EventHandler(Form1_Load); InitButton(); } void FillValue() { // Fill values. for (int rowIndex = 0; rowIndex < gcMultiRow1.RowCount; rowIndex++) { for (int cellIndex = 0; cellIndex < 3; cellIndex++) { gcMultiRow1[rowIndex, cellIndex].Value = "RowIndex: " + rowIndex.ToString() + " CellIndex: " + cellIndex.ToString(); } } } private void Form1_Load(object sender, EventArgs e) { // Use AllowUserToResize property to disable/enable MultiRow control's UIResize. this.gcMultiRow1.AllowUserToResize = true; // Show resize tip when UI resize. this.gcMultiRow1.ShowResizeTip = ResizeMode.Both; // Customize resize tip. this.gcMultiRow1.ResizeTipTextNeeded += new EventHandler<ResizeTipTextNeededEventArgs>(gcMultiRow1_ResizeTipTextNeeded); } void gcMultiRow1_ResizeTipTextNeeded(object sender, ResizeTipTextNeededEventArgs e) { // Customize 1nd column's resize tip and 1nd rows resize tip. if (e.CellIndex == 0 || e.RowIndex == 0) { string direction = "height"; if (e.Direction == Orientation.Horizontal) { direction = "width"; } e.ResizeTipText = "Cell " + direction + " resize from " + e.OldValue + " to " + e.NewValue; } }
Public Class ResizeDemo Inherits Form Friend WithEvents gcMultiRow1 As New GcMultiRow() Private panel As New FlowLayoutPanel() Private label As New Label() Public Sub New() Me.Text = "Resize Demo" Me.Size = New Size(600, 350) ' Initial flow layout panel and add to form. Me.panel.Dock = DockStyle.Left Me.panel.Size = New Size(250, 200) Me.panel.FlowDirection = FlowDirection.TopDown Me.panel.WrapContents = False Me.panel.Padding = New Padding(5) Me.Controls.Add(panel) ' Add MultiRow to form Me.gcMultiRow1.Dock = DockStyle.Left Me.gcMultiRow1.Width = 350 Me.Controls.Add(Me.gcMultiRow1) Me.label.Height = 30 Me.label.Dock = DockStyle.Bottom Me.label.BackColor = SystemColors.Info Me.label.Text = "You can resize the Cell at the right or bottom edge." Me.Controls.Add(label) gcMultiRow1.Template = Template.CreateGridTemplate(3) gcMultiRow1.RowCount = 5 FillValue() InitButton() End Sub Private Sub FillValue() ' Fill values. For rowIndex As Integer = 0 To Me.gcMultiRow1.RowCount - 1 For cellIndex As Integer = 0 To 2 gcMultiRow1(rowIndex, cellIndex).Value = "RowIndex: " + rowIndex.ToString() + " CellIndex: " + cellIndex.ToString() Next Next End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load ' Use AllowUserToResize property to disable/enable MultiRow control's UIResize. Me.gcMultiRow1.AllowUserToResize = True ' Show resize tip when UI resize. Me.gcMultiRow1.ShowResizeTip = ResizeMode.Both End Sub Private Sub gcMultiRow1_ResizeTipTextNeeded(ByVal sender As Object, ByVal e As ResizeTipTextNeededEventArgs) Handles gcMultiRow1.ResizeTipTextNeeded ' Customize 1nd column's resize tip and 1nd rows resize tip. If e.CellIndex = 0 OrElse e.RowIndex = 0 Then Dim direction As String = "height" If e.Direction = Orientation.Horizontal Then direction = "width" End If e.ResizeTipText = "Cell " + direction + " resize from " + e.OldValue.ToString() + " to " + e.NewValue.ToString() End If End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2