// There are 3 steps to doing a table layout: // 1) Figure out which row/column each control goes into // 2) Figure out the sizes of each row/column // 3) Size and position each control public override bool Layout (object container, LayoutEventArgs args) { TableLayoutPanel panel = container as TableLayoutPanel; TableLayoutSettings settings = panel.LayoutSettings; #if TABLE_DEBUG Console.WriteLine ("Beginning layout on panel: {0}, control count: {1}, col/row count: {2}x{3}", panel.Name, panel.Controls.Count, settings.ColumnCount, settings.RowCount); #endif // STEP 1: // - Figure out which row/column each control goes into // - Store data in the TableLayoutPanel.actual_positions panel.actual_positions = CalculateControlPositions (panel, Math.Max (settings.ColumnCount, 1), Math.Max (settings.RowCount, 1)); // STEP 2: // - Figure out the sizes of each row/column // - Store data in the TableLayoutPanel.widths/heights CalculateColumnRowSizes (panel, panel.actual_positions.GetLength (0), panel.actual_positions.GetLength (1)); // STEP 3: // - Size and position each control LayoutControls(panel); #if TABLE_DEBUG Console.WriteLine ("-- CalculatedPositions:"); OutputControlGrid (panel.actual_positions, panel); Console.WriteLine ("Finished layout on panel: {0}", panel.Name); Console.WriteLine (); #endif return false; }
protected void grdGianHang_InitializeLayout(object sender, LayoutEventArgs e) { e.Layout.Grid.Columns.FromKey("Command").AllowRowFiltering = false; e.Layout.Grid.Columns.FromKey("TenCuaHang").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("TenLoaiCuaHang").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; if (rbtTatCa.Checked) { e.Layout.Pager.AllowPaging = false; } else { e.Layout.Pager.AllowPaging = true; } }
protected void grdHangSanXuat_InitializeLayout(object sender, LayoutEventArgs e) { e.Layout.Grid.Columns.FromKey("Command").AllowRowFiltering = false; e.Layout.Grid.Columns.FromKey("TenHangSanXuat").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("ThongTin").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; //if (rbtTatCa.Checked == true) //{ // e.Layout.Pager.AllowPaging = false; //} //else //{ // e.Layout.Pager.AllowPaging = true; //} }
protected void GrdNguoiDung_InitializeLayout(object sender, LayoutEventArgs e) { e.Layout.Grid.Columns.FromKey("Command").AllowRowFiltering = false; e.Layout.Grid.Columns.FromKey("HoVaTen").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("GioiTinh").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("TaiKhoan").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("Email").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("DienThoaiDiDong").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("DienThoaiCoDinh").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("LoaiNguoiDung").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; if (rbtTatCa.Checked) { e.Layout.Pager.AllowPaging = false; } else { e.Layout.Pager.AllowPaging = true; } }
public virtual bool Layout(object container, LayoutEventArgs layoutEventArgs) { #if LAYOUT_PERFWATCH Debug.WriteLine(container.GetType().Name + "::Layout(" + (layoutEventArgs.AffectedControl != null ? layoutEventArgs.AffectedControl.Name : "null") + ", " + layoutEventArgs.AffectedProperty + ")"); Debug.Indent(); Stopwatch sw = new Stopwatch(); sw.Start(); #endif bool parentNeedsLayout = LayoutCore(CastToArrangedElement(container), layoutEventArgs); #if LAYOUT_PERFWATCH sw.Stop(); if (sw.ElapsedMilliseconds > LayoutWatch && Debugger.IsAttached) { Debugger.Break(); } Debug.Unindent(); Debug.WriteLine(container.GetType().Name + "::Layout elapsed " + sw.ElapsedMilliseconds.ToString() + " returned: " + parentNeedsLayout); #endif return parentNeedsLayout; }
void OnLayout (object sender, LayoutEventArgs e) { _dataGridView.Width = Width - 50; _dataGridView.Height = Height - _changeButton.Height * 2 - 50; _changeButton.Top = _dataGridView.Height + _changeButton.Height * 2 - 15; _changeButton.Left = Width / 2 - _changeButton.Width / 2; }
protected override void OnLayout(LayoutEventArgs levent) { // set the size and location for close and auto-hide buttons Rectangle rectCaption = ClientRectangle; int buttonWidth = ImageCloseEnabled.Width; int buttonHeight = ImageCloseEnabled.Height; int height = rectCaption.Height - ButtonGapTop - ButtonGapBottom; if (buttonHeight < height) { buttonWidth = buttonWidth * (height / buttonHeight); buttonHeight = height; } m_buttonClose.SuspendLayout(); m_buttonAutoHide.SuspendLayout(); m_buttonOptions.SuspendLayout(); Size buttonSize = new Size(buttonWidth, buttonHeight); m_buttonAutoHide.Size = buttonSize; m_buttonClose.Size = buttonSize; m_buttonOptions.Size = buttonSize; int x = rectCaption.X + rectCaption.Width - 1 - ButtonGapRight - m_buttonClose.Width; int y = rectCaption.Y + ButtonGapTop; Point point = new Point(x, y); m_buttonClose.Location = point; point.Offset(- (m_buttonAutoHide.Width + ButtonGapBetween), 0); m_buttonAutoHide.Location = point; point.Offset(- (m_buttonOptions.Width + ButtonGapBetween), 0); m_buttonOptions.Location = point; m_buttonClose.ResumeLayout(); m_buttonAutoHide.ResumeLayout(); m_buttonOptions.ResumeLayout(); base.OnLayout(levent); }
public override bool Layout (object container, LayoutEventArgs args) { Control parent = container as Control; Control[] controls = parent.Controls.GetAllControls (); LayoutDockedChildren (parent, controls); LayoutAnchoredChildren (parent, controls); LayoutAutoSizedChildren (parent, controls); if (parent is Form) LayoutAutoSizeContainer (parent); return false; }
private protected virtual bool LayoutCore(IArrangedElement container, LayoutEventArgs layoutEventArgs) { return(false); }
/// <summary> /// Sets the layout of the control. /// </summary> /// <param name="e">A LayoutEventArgs that contains event data.</param> public override void OnLayout(LayoutEventArgs e) { base.OnLayout(e); lock (lockObject) { displayBounds = ImageListView.DisplayRectangle; } }
protected override void OnLayout(LayoutEventArgs levent) { /* Right -> let me explain the whole point of this function ... Form + inherited form = issues with event bubbling & other stuff Soooo, what happens with layout suspended in the superclass form and the size is set - nothing!!! not an electronic sausage!!! Solution - do a layout override that will re-locate the child controls. */ if (SystemButtonClose != null) { SystemButtonClose.Location = new Point(GetSystemButtonsLocation(), 2); if (SystemButtonMaximize != null) { SystemButtonMaximize.Location = new Point(SystemButtonClose.Left - 36, 2); if (SystemButtonMinimize != null) { SystemButtonMinimize.Location = new Point(SystemButtonMaximize.Left - 36, 2); } } if (PanelClientArea != null) { int ValueY = (SystemButtonClose.Bottom + 2); int ValueWidth = (this.Size.Width - (BorderWidthValue * 2)); int ValueHeight = (this.Size.Height - BorderWidthValue - ValueY); PanelClientArea.Location = new Point(BorderWidthValue, ValueY); PanelClientArea.Size = new Size(ValueWidth, ValueHeight); } } base.OnLayout(levent); }
private void HandleToolStripLayout(object sender, LayoutEventArgs e) { HandleToolStripLayout(); }
// When control layout is aplied private void ArgumentBox_Layout(object sender, LayoutEventArgs e) { ArgumentBox_Resize(sender, e); }
protected override void OnLayout(LayoutEventArgs levent) { AdjustFormScrollbars(); base.OnLayout(levent); }
private void FRM_MODEL_DETAIL_LW_Layout(object sender, LayoutEventArgs e) { }
// When layout must change private void CheckboxArrayControl_Layout(object sender, LayoutEventArgs e) { PositionCheckboxes(); }
////Layout change event ////Describes changes in layout dimensions private void Layout_Change(object sender, LayoutEventArgs e) { this.windowWidth = this.Width; this.windowHeight = this.Height; }
protected override void OnLayout(LayoutEventArgs levent) { base.OnLayout(levent); RecalcLayout(); }
/// <summary> /// Recalculates the control layout. /// </summary> public void Update(bool forceUpdate) { if (mImageListView.ClientRectangle.Width == 0 || mImageListView.ClientRectangle.Height == 0) return; if (!forceUpdate && !UpdateRequired) return; // Cache current properties to determine if we will need an update later cachedView = mImageListView.View; cachedViewOffset = mImageListView.ViewOffset; cachedSize = mImageListView.ClientSize; cachedItemCount = mImageListView.Items.Count; cachedItemSize = mImageListView.mRenderer.MeasureItem(mImageListView.View); cachedHeaderHeight = mImageListView.mRenderer.MeasureColumnHeaderHeight(); cachedItemMargin = mImageListView.mRenderer.MeasureItemMargin(mImageListView.View); cachedPaneWidth = mImageListView.PaneWidth; cachedVisibleItems.Clear(); // Calculate drawing area mClientArea = mImageListView.ClientRectangle; mItemAreaBounds = mImageListView.ClientRectangle; // Item size mItemSize = cachedItemSize; mItemSizeWithMargin = mItemSize + cachedItemMargin; // Allocate space for scrollbars if (mImageListView.hScrollBar.Visible) { mClientArea.Height -= mImageListView.hScrollBar.Height; mItemAreaBounds.Height -= mImageListView.hScrollBar.Height; } if (mImageListView.vScrollBar.Visible) { mClientArea.Width -= mImageListView.vScrollBar.Width; mItemAreaBounds.Width -= mImageListView.vScrollBar.Width; } // Allocate space for column headers if (mImageListView.View == View.Details) { int headerHeight = cachedHeaderHeight; // Location of the column headers mColumnHeaderBounds.X = mClientArea.Left - mImageListView.ViewOffset.X; mColumnHeaderBounds.Y = mClientArea.Top; mColumnHeaderBounds.Height = headerHeight; mColumnHeaderBounds.Width = mClientArea.Width + mImageListView.ViewOffset.X; mItemAreaBounds.Y += headerHeight; mItemAreaBounds.Height -= headerHeight; } else { mColumnHeaderBounds = Rectangle.Empty; } // Modify item area for the gallery view mode if (mImageListView.View == View.Gallery) { mItemAreaBounds.Height = mItemSizeWithMargin.Height; mItemAreaBounds.Y = mClientArea.Bottom - mItemSizeWithMargin.Height; } // Modify item area for the pane view mode if (mImageListView.View == View.Pane) { mItemAreaBounds.Width -= cachedPaneWidth; mItemAreaBounds.X += cachedPaneWidth; } if (mItemAreaBounds.Width < 1 || mItemAreaBounds.Height < 1) return; // Let the calculated bounds modified by the renderer LayoutEventArgs eLayout = new LayoutEventArgs(mItemAreaBounds); mImageListView.mRenderer.OnLayout(eLayout); mItemAreaBounds = eLayout.ItemAreaBounds; // Maximum number of rows and columns that can be fully displayed mCols = (int)System.Math.Floor((float)mItemAreaBounds.Width / (float)mItemSizeWithMargin.Width); mRows = (int)System.Math.Floor((float)mItemAreaBounds.Height / (float)mItemSizeWithMargin.Height); if (mImageListView.View == View.Details) mCols = 1; if (mImageListView.View == View.Gallery) mRows = 1; if (mCols < 1) mCols = 1; if (mRows < 1) mRows = 1; // Check if we need the horizontal scroll bar bool hScrollRequired = false; if (mImageListView.View == View.Gallery) hScrollRequired = (mImageListView.Items.Count > 0) && (mCols * mRows < mImageListView.Items.Count); else hScrollRequired = (mImageListView.Items.Count > 0) && (mItemAreaBounds.Width < mCols * mItemSizeWithMargin.Width); if (hScrollRequired != hScrollVisible) { hScrollVisible = hScrollRequired; mImageListView.hScrollBar.Visible = hScrollRequired; Update(true); return; } // Check if we need the vertical scroll bar bool vScrollRequired = false; if (mImageListView.View == View.Gallery) vScrollRequired = (mImageListView.Items.Count > 0) && (mItemAreaBounds.Height < mRows * mItemSizeWithMargin.Height); else vScrollRequired = (mImageListView.Items.Count > 0) && (mCols * mRows < mImageListView.Items.Count); if (vScrollRequired != vScrollVisible) { vScrollVisible = vScrollRequired; mImageListView.vScrollBar.Visible = vScrollRequired; Update(true); return; } // Horizontal scroll range if (mImageListView.View == View.Gallery) { mImageListView.hScrollBar.SmallChange = mItemSizeWithMargin.Width; mImageListView.hScrollBar.LargeChange = mItemAreaBounds.Width; mImageListView.hScrollBar.Minimum = 0; mImageListView.hScrollBar.Maximum = Math.Max(0, (int)System.Math.Ceiling((float)mImageListView.Items.Count / (float)mRows) * mItemSizeWithMargin.Width - 1); } else { mImageListView.hScrollBar.SmallChange = 1; mImageListView.hScrollBar.LargeChange = mItemAreaBounds.Width; mImageListView.hScrollBar.Minimum = 0; mImageListView.hScrollBar.Maximum = mCols * mItemSizeWithMargin.Width; } if (mImageListView.ViewOffset.X > mImageListView.hScrollBar.Maximum - mImageListView.hScrollBar.LargeChange + 1) { mImageListView.hScrollBar.Value = mImageListView.hScrollBar.Maximum - mImageListView.hScrollBar.LargeChange + 1; mImageListView.ViewOffset = new Point(mImageListView.hScrollBar.Value, mImageListView.ViewOffset.Y); } // Vertical scroll range if (mImageListView.View == View.Gallery) { mImageListView.vScrollBar.SmallChange = 1; mImageListView.vScrollBar.LargeChange = mItemAreaBounds.Height; mImageListView.vScrollBar.Minimum = 0; mImageListView.vScrollBar.Maximum = mRows * mItemSizeWithMargin.Height; } else { mImageListView.vScrollBar.SmallChange = mItemSizeWithMargin.Height; mImageListView.vScrollBar.LargeChange = mItemAreaBounds.Height; mImageListView.vScrollBar.Minimum = 0; mImageListView.vScrollBar.Maximum = Math.Max(0, (int)System.Math.Ceiling((float)mImageListView.Items.Count / (float)mCols) * mItemSizeWithMargin.Height - 1); } if (mImageListView.ViewOffset.Y > mImageListView.vScrollBar.Maximum - mImageListView.vScrollBar.LargeChange + 1) { mImageListView.vScrollBar.Value = mImageListView.vScrollBar.Maximum - mImageListView.vScrollBar.LargeChange + 1; mImageListView.ViewOffset = new Point(mImageListView.ViewOffset.X, mImageListView.vScrollBar.Value); } // Zero out the scrollbars if we don't have any items if (mImageListView.Items.Count == 0) { mImageListView.hScrollBar.Minimum = 0; mImageListView.hScrollBar.Maximum = 0; mImageListView.hScrollBar.Value = 0; mImageListView.vScrollBar.Minimum = 0; mImageListView.vScrollBar.Maximum = 0; mImageListView.vScrollBar.Value = 0; mImageListView.ViewOffset = new Point(0, 0); } // Horizontal scrollbar position mImageListView.hScrollBar.Left = 0; mImageListView.hScrollBar.Top = mImageListView.ClientRectangle.Bottom - mImageListView.hScrollBar.Height; mImageListView.hScrollBar.Width = mImageListView.ClientRectangle.Width - (mImageListView.vScrollBar.Visible ? mImageListView.vScrollBar.Width : 0); // Vertical scrollbar position mImageListView.vScrollBar.Left = mImageListView.ClientRectangle.Right - mImageListView.vScrollBar.Width; mImageListView.vScrollBar.Top = 0; mImageListView.vScrollBar.Height = mImageListView.ClientRectangle.Height - (mImageListView.hScrollBar.Visible ? mImageListView.hScrollBar.Height : 0); // Find the first and last partially visible items if (mImageListView.View == View.Gallery) { mFirstPartiallyVisible = (int)System.Math.Floor((float)mImageListView.ViewOffset.X / (float)mItemSizeWithMargin.Width) * mRows; mLastPartiallyVisible = (int)System.Math.Ceiling((float)(mImageListView.ViewOffset.X + mItemAreaBounds.Width) / (float)mItemSizeWithMargin.Width) * mRows - 1; } else { mFirstPartiallyVisible = (int)System.Math.Floor((float)mImageListView.ViewOffset.Y / (float)mItemSizeWithMargin.Height) * mCols; mLastPartiallyVisible = (int)System.Math.Ceiling((float)(mImageListView.ViewOffset.Y + mItemAreaBounds.Height) / (float)mItemSizeWithMargin.Height) * mCols - 1; } if (mFirstPartiallyVisible < 0) mFirstPartiallyVisible = 0; if (mFirstPartiallyVisible > mImageListView.Items.Count - 1) mFirstPartiallyVisible = mImageListView.Items.Count - 1; if (mLastPartiallyVisible < 0) mLastPartiallyVisible = 0; if (mLastPartiallyVisible > mImageListView.Items.Count - 1) mLastPartiallyVisible = mImageListView.Items.Count - 1; // Find the first and last visible items if (mImageListView.View == View.Gallery) { mFirstVisible = (int)System.Math.Ceiling((float)mImageListView.ViewOffset.X / (float)mItemSizeWithMargin.Width) * mRows; mLastVisible = (int)System.Math.Floor((float)(mImageListView.ViewOffset.X + mItemAreaBounds.Width) / (float)mItemSizeWithMargin.Width) * mRows - 1; } else { mFirstVisible = (int)System.Math.Ceiling((float)mImageListView.ViewOffset.Y / (float)mItemSizeWithMargin.Height) * mCols; mLastVisible = (int)System.Math.Floor((float)(mImageListView.ViewOffset.Y + mItemAreaBounds.Height) / (float)mItemSizeWithMargin.Height) * mCols - 1; } if (mFirstVisible < 0) mFirstVisible = 0; if (mFirstVisible > mImageListView.Items.Count - 1) mFirstVisible = mImageListView.Items.Count - 1; if (mLastVisible < 0) mLastVisible = 0; if (mLastVisible > mImageListView.Items.Count - 1) mLastVisible = mImageListView.Items.Count - 1; // Cache visible items if (mFirstPartiallyVisible >= 0 && mLastPartiallyVisible >= 0 && mFirstPartiallyVisible <= mImageListView.Items.Count - 1 && mLastPartiallyVisible <= mImageListView.Items.Count - 1) { for (int i = mFirstPartiallyVisible; i <= mLastPartiallyVisible; i++) cachedVisibleItems.Add(mImageListView.Items[i].Guid, false); } }
private void draw(object sender, LayoutEventArgs e) => draw();
internal virtual void ProcessSuspendedLayoutEventArgs(IArrangedElement container, LayoutEventArgs args) {}
protected override void OnLayout(LayoutEventArgs levent) { base.OnLayout(levent); AutoSize = false; Size = new System.Drawing.Size(120, 30); }
//UI private void Layout_Change(object sender, LayoutEventArgs e) { width = this.Width; height = this.Height; }
private void Rename_Layout(object sender, LayoutEventArgs e) { renameTextBox.Width = Width - 40; }
private void Form1_Layout(object sender, LayoutEventArgs e) { Console.WriteLine("Layout"); }
private void toolStripPanel1_Layout(object sender, LayoutEventArgs e) { }
internal override bool LayoutCore(IArrangedElement container, LayoutEventArgs args) { Size garbage; // PreferredSize is garbage if we are not measuring. return xLayout(container, /* measureOnly = */ false, out garbage); }
protected override void OnLayout(LayoutEventArgs e) { bool plentyWidthBefore = (this.mainMenu.Width >= this.mainMenu.PreferredSize.Width) && (this.commonActionsStrip.Width >= this.commonActionsStrip.PreferredSize.Width) && (this.viewConfigStrip.Width >= this.viewConfigStrip.PreferredSize.Width) && (this.toolChooserStrip.Width >= this.toolChooserStrip.PreferredSize.Width) && (this.toolConfigStrip.Width >= this.toolConfigStrip.PreferredSize.Width); if (!plentyWidthBefore) { UI.SuspendControlPainting(this); } else { // if we don't do this then we get some terrible flickering of the right scroll arrow UI.SuspendControlPainting(this.documentStrip); } this.mainMenu.Location = new Point(0, 0); this.mainMenu.Height = this.mainMenu.PreferredSize.Height; this.toolStripPanel.Location = new Point(0, this.mainMenu.Bottom); this.toolStripPanel.RowMargin = new Padding(0); this.mainMenu.Padding = new Padding(0, this.mainMenu.Padding.Top, 0, this.mainMenu.Padding.Bottom); this.commonActionsStrip.Width = this.commonActionsStrip.PreferredSize.Width; this.viewConfigStrip.Width = this.viewConfigStrip.PreferredSize.Width; this.toolChooserStrip.Width = this.toolChooserStrip.PreferredSize.Width; this.toolConfigStrip.Width = this.toolConfigStrip.PreferredSize.Width; if (!this.computedMaxRowHeight) { ToolBarConfigItems oldTbci = this.toolConfigStrip.ToolBarConfigItems; this.toolConfigStrip.ToolBarConfigItems = ToolBarConfigItems.All; this.toolConfigStrip.PerformLayout(); this.maxRowHeight = Math.Max(this.commonActionsStrip.PreferredSize.Height, Math.Max(this.viewConfigStrip.PreferredSize.Height, Math.Max(this.toolChooserStrip.PreferredSize.Height, this.toolConfigStrip.PreferredSize.Height))); this.toolConfigStrip.ToolBarConfigItems = oldTbci; this.toolConfigStrip.PerformLayout(); this.computedMaxRowHeight = true; } this.commonActionsStrip.Height = this.maxRowHeight; this.viewConfigStrip.Height = this.maxRowHeight; this.toolChooserStrip.Height = this.maxRowHeight; this.toolConfigStrip.Height = this.maxRowHeight; this.commonActionsStrip.Location = new Point(0, 0); this.viewConfigStrip.Location = new Point(this.commonActionsStrip.Right, this.commonActionsStrip.Top); this.toolChooserStrip.Location = new Point(0, this.viewConfigStrip.Bottom); this.toolConfigStrip.Location = new Point(this.toolChooserStrip.Right, this.toolChooserStrip.Top); this.toolStripPanel.Height = Math.Max(this.commonActionsStrip.Bottom, Math.Max(this.viewConfigStrip.Bottom, Math.Max(this.toolChooserStrip.Bottom, this.toolConfigStrip.Visible ? this.toolConfigStrip.Bottom : this.toolChooserStrip.Bottom))); // Compute how wide the toolStripContainer would like to be int widthRow1 = this.commonActionsStrip.Left + this.commonActionsStrip.PreferredSize.Width + this.commonActionsStrip.Margin.Horizontal + this.viewConfigStrip.PreferredSize.Width + this.viewConfigStrip.Margin.Horizontal; int widthRow2 = this.toolChooserStrip.Left + this.toolChooserStrip.PreferredSize.Width + this.toolChooserStrip.Margin.Horizontal + this.toolConfigStrip.PreferredSize.Width + this.toolConfigStrip.Margin.Horizontal; int preferredMinTscWidth = Math.Max(widthRow1, widthRow2); // Throw in the documentListButton if necessary bool showDlb = this.documentStrip.DocumentCount > 1; this.documentListButton.Visible = showDlb; this.documentListButton.Enabled = showDlb; if (showDlb) { int documentListButtonWidth = UI.ScaleWidth(15); this.documentListButton.Width = documentListButtonWidth; } else { this.documentListButton.Width = 0; } // Figure out the DocumentStrip's size -- we actually make two passes at setting its Width // so that we can toss in the documentListButton if necessary if (this.documentStrip.DocumentCount == 0) { this.documentStrip.Width = 0; } else { this.documentStrip.Width = Math.Max( this.documentStrip.PreferredMinClientWidth, Math.Min(this.documentStrip.PreferredSize.Width, ClientSize.Width - preferredMinTscWidth - this.documentListButton.Width)); } this.documentStrip.Location = new Point(ClientSize.Width - this.documentStrip.Width, 0); this.documentListButton.Location = new Point(this.documentStrip.Left - this.documentListButton.Width, 0); this.imageListMenu.Location = new Point(this.documentListButton.Left, this.documentListButton.Bottom - 1); this.imageListMenu.Width = this.documentListButton.Width; this.imageListMenu.Height = 0; this.documentListButton.Visible = showDlb; this.documentListButton.Enabled = showDlb; // Finish setting up widths and heights int oldDsHeight = this.documentStrip.Height; this.documentStrip.Height = this.toolStripPanel.Bottom; this.documentListButton.Height = this.documentStrip.Height; int tsWidth = ClientSize.Width - (this.documentStrip.Width + this.documentListButton.Width); this.mainMenu.Width = tsWidth; this.toolStripPanel.Width = tsWidth; this.Height = this.toolStripPanel.Bottom; // Now get stuff to paint right this.documentStrip.PerformLayout(); if (!plentyWidthBefore) { UI.ResumeControlPainting(this); Invalidate(true); } else { UI.ResumeControlPainting(this.documentStrip); this.documentStrip.Invalidate(true); } if (this.documentStrip.Width == 0) { this.mainMenu.Invalidate(); } if (oldDsHeight != this.documentStrip.Height) { this.documentStrip.RefreshAllThumbnails(); } base.OnLayout(e); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.Layout"/> event. /// </summary> /// <param name="levent">A <see cref="T:System.Windows.Forms.LayoutEventArgs"/> that contains the event data. </param> protected override void OnLayout(LayoutEventArgs levent) { base.OnLayout(levent); UpdateScrollbars(); }
private void Form1_Layout(object sender, LayoutEventArgs e) { }
protected void grdKhuVuc_InitializeLayout(object sender, LayoutEventArgs e) { e.Layout.Grid.Columns.FromKey("Command").AllowRowFiltering = false; e.Layout.Grid.Columns.FromKey("TenKhuVuc").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("GhiChu").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; }
protected override void OnLayout(LayoutEventArgs levent) { RefreshChanges(); base.OnLayout(levent); }
private void actionsGroup_Layout(object sender, LayoutEventArgs e) { actionsFlow.MaximumSize = new Size(actionsGroup.ClientRectangle.Width - 8, 0); }
private void capOptsGroup_Layout(object sender, LayoutEventArgs e) { capOptsFlow.MaximumSize = new Size(capOptsGroup.ClientRectangle.Width - 8, 0); }
protected override void OnLayout(LayoutEventArgs levent) { calls.Add(String.Format("OnLayout [Control \"{0}\", Property \"{1}\"]", CT(levent.AffectedControl), levent.AffectedProperty)); base.OnLayout (levent); }
internal virtual bool LayoutCore(IArrangedElement container, LayoutEventArgs layoutEventArgs) { return false; }
public override bool Layout (object container, LayoutEventArgs args) { if (container is ToolStripPanel) return false; if (container is ToolStrip) return LayoutToolStrip ((ToolStrip)container); Control parent = container as Control; FlowLayoutSettings settings; if (parent is FlowLayoutPanel) settings = (parent as FlowLayoutPanel).LayoutSettings; else settings = default_settings; // Nothing to layout, exit method if (parent.Controls.Count == 0) return false; // Use DisplayRectangle so that parent.Padding is honored. Rectangle parentDisplayRectangle = parent.DisplayRectangle; Point currentLocation; // Set our starting point based on flow direction switch (settings.FlowDirection) { case FlowDirection.BottomUp: currentLocation = new Point (parentDisplayRectangle.Left, parentDisplayRectangle.Bottom); break; case FlowDirection.LeftToRight: case FlowDirection.TopDown: default: currentLocation = parentDisplayRectangle.Location; break; case FlowDirection.RightToLeft: currentLocation = new Point (parentDisplayRectangle.Right, parentDisplayRectangle.Top); break; } bool forceFlowBreak = false; List<Control> rowControls = new List<Control> (); foreach (Control c in parent.Controls) { // Only apply layout to visible controls. if (!c.Visible) { continue; } // Resize any AutoSize controls to their preferred size if (c.AutoSize == true) { Size new_size = c.GetPreferredSize (c.Size); c.SetBoundsInternal (c.Left, c.Top, new_size.Width, new_size.Height, BoundsSpecified.None); } switch (settings.FlowDirection) { case FlowDirection.BottomUp: // Decide if it's time to start a new column // - Our settings must be WrapContents, and we ran out of room or the previous control's FlowBreak == true if (settings.WrapContents) if ((currentLocation.Y) < (c.Height + c.Margin.Top + c.Margin.Bottom) || forceFlowBreak) { currentLocation.X = FinishColumn (rowControls); currentLocation.Y = parentDisplayRectangle.Bottom; forceFlowBreak = false; rowControls.Clear (); } // Offset the right margin and set the control to our point currentLocation.Offset (0, c.Margin.Bottom * -1); c.SetBoundsInternal (currentLocation.X + c.Margin.Left, currentLocation.Y - c.Height, c.Width, c.Height, BoundsSpecified.None); // Update our location pointer currentLocation.Y -= (c.Height + c.Margin.Top); break; case FlowDirection.LeftToRight: default: // Decide if it's time to start a new row // - Our settings must be WrapContents, and we ran out of room or the previous control's FlowBreak == true if (settings.WrapContents && !(parent is ToolStripPanel)) if ((parentDisplayRectangle.Width + parentDisplayRectangle.Left - currentLocation.X) < (c.Width + c.Margin.Left + c.Margin.Right) || forceFlowBreak) { currentLocation.Y = FinishRow (rowControls); currentLocation.X = parentDisplayRectangle.Left; forceFlowBreak = false; rowControls.Clear (); } // Offset the left margin and set the control to our point currentLocation.Offset (c.Margin.Left, 0); c.SetBoundsInternal (currentLocation.X, currentLocation.Y + c.Margin.Top, c.Width, c.Height, BoundsSpecified.None); // Update our location pointer currentLocation.X += c.Width + c.Margin.Right; break; case FlowDirection.RightToLeft: // Decide if it's time to start a new row // - Our settings must be WrapContents, and we ran out of room or the previous control's FlowBreak == true if (settings.WrapContents) if ((currentLocation.X) < (c.Width + c.Margin.Left + c.Margin.Right) || forceFlowBreak) { currentLocation.Y = FinishRow (rowControls); currentLocation.X = parentDisplayRectangle.Right; forceFlowBreak = false; rowControls.Clear (); } // Offset the right margin and set the control to our point currentLocation.Offset (c.Margin.Right * -1, 0); c.SetBoundsInternal (currentLocation.X - c.Width, currentLocation.Y + c.Margin.Top, c.Width, c.Height, BoundsSpecified.None); // Update our location pointer currentLocation.X -= (c.Width + c.Margin.Left); break; case FlowDirection.TopDown: // Decide if it's time to start a new column // - Our settings must be WrapContents, and we ran out of room or the previous control's FlowBreak == true if (settings.WrapContents) if ((parentDisplayRectangle.Height + parentDisplayRectangle.Top - currentLocation.Y) < (c.Height + c.Margin.Top + c.Margin.Bottom) || forceFlowBreak) { currentLocation.X = FinishColumn (rowControls); currentLocation.Y = parentDisplayRectangle.Top; forceFlowBreak = false; rowControls.Clear (); } // Offset the top margin and set the control to our point currentLocation.Offset (0, c.Margin.Top); c.SetBoundsInternal (currentLocation.X + c.Margin.Left, currentLocation.Y, c.Width, c.Height, BoundsSpecified.None); // Update our location pointer currentLocation.Y += c.Height + c.Margin.Bottom; break; } // Add it to our list of things to adjust the second dimension of rowControls.Add (c); // If user set a flowbreak on this control, it will be the last one in this row/column if (settings.GetFlowBreak (c)) forceFlowBreak = true; } // Set the control heights/widths for the last row/column if (settings.FlowDirection == FlowDirection.LeftToRight || settings.FlowDirection == FlowDirection.RightToLeft) FinishRow (rowControls); else FinishColumn (rowControls); return false; }
private void callback_LayoutToBeRemoved(object sender, LayoutEventArgs e) { WriteLine(String.Format("LayoutToBeRemoved - {0}", e.Name)); }
// Make sure property grid columns are properly sized private void modinfo_inspect_propertygrid_Layout(object sender, LayoutEventArgs e) { modinfo_inspect_propertygrid.SetLabelColumnWidth(100); }
private void globalGroup_Layout(object sender, LayoutEventArgs e) { globalFlow.MaximumSize = new Size(globalGroup.ClientRectangle.Width - 8, 0); }
private void callback_AbortLayoutCopied(object sender, LayoutEventArgs e) { WriteLine(String.Format("AbortLayoutCopied - {0}", e.Name)); }
void CenterPanel_Layout(object sender, LayoutEventArgs e) { this.Refresh(); }
protected void UltraWebGridOTMMonthTotal_InitializeLayout(object sender, LayoutEventArgs e) { int i; DateTime YearMonth = Convert.ToDateTime(this.txtYearMonth.Text + "/01"); if (this.HiddenYearMonth.Value.Length == 0) { this.HiddenYearMonth.Value = this.txtYearMonth.Text.Replace("/", ""); foreach (UltraGridColumn c in e.Layout.Bands[0].Columns) { c.Header.RowLayoutColumnInfo.OriginY = 1; } ColumnHeader ch = new ColumnHeader(true) { Caption = Resources.ControlText.gvApplyHours }; ch.RowLayoutColumnInfo.OriginY = 0; ch.RowLayoutColumnInfo.OriginX = 8; ch.RowLayoutColumnInfo.SpanX = 3; ch.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(ch); ColumnHeader ch2 = new ColumnHeader(true) { Caption = Resources.ControlText.gvRelSalaryHours }; ch2.RowLayoutColumnInfo.OriginY = 0; ch2.RowLayoutColumnInfo.OriginX = 11; ch2.RowLayoutColumnInfo.SpanX = 3; ch2.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(ch2); ColumnHeader ch3 = new ColumnHeader(true) { Caption = Resources.ControlText.gvSpecApplyHours }; ch3.RowLayoutColumnInfo.OriginY = 0; ch3.RowLayoutColumnInfo.OriginX = 14; ch3.RowLayoutColumnInfo.SpanX = 3; ch3.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(ch3); ColumnHeader ch4 = new ColumnHeader(true) { Caption = Resources.ControlText.gvSpecrelSalary }; ch4.RowLayoutColumnInfo.OriginY = 0; ch4.RowLayoutColumnInfo.OriginX = 17; ch4.RowLayoutColumnInfo.SpanX = 3; ch4.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(ch4); for (i = 1; i < 0x20; i++) { ColumnHeader chr = new ColumnHeader(true) { Caption = i.ToString() }; chr.RowLayoutColumnInfo.OriginY = 0; chr.RowLayoutColumnInfo.OriginX = i + 0x1D; chr.RowLayoutColumnInfo.SpanX = 1; chr.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(chr); } ch = e.Layout.Bands[0].Columns.FromKey("CheckBoxAll").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("WorkNo").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("BillNo").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("LocalName").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("BuName").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("DName").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("OverTimeType").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("G2Remain").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("MAdjust1").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("MRelAdjust").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("ApproveFlagName").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("AdvanceAdjust").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("RestAdjust").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("auditer").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("auditdate").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("auditidea").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("jindutu").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; } else { this.HiddenYearMonth.Value = this.txtYearMonth.Text.Replace("/", ""); } string FromKeyName = ""; for (i = 1; i < 0x20; i++) { FromKeyName = "Day" + i.ToString(); e.Layout.Bands[0].Columns.FromKey(FromKeyName).Header.Caption = this.GetWeek(YearMonth.AddDays((double)(i - 1))); if (this.isHoliday(i, YearMonth)) { e.Layout.Rows.Band.Columns[e.Layout.Bands[0].Columns.FromKey(FromKeyName).Index].CellStyle.BackColor = Color.DarkKhaki; } else { e.Layout.Rows.Band.Columns[e.Layout.Bands[0].Columns.FromKey(FromKeyName).Index].CellStyle.BackColor = Color.White; } } }
void OnContentLayoutUpdated(object sender, LayoutEventArgs e) { UpdateContentSize(); }
protected override void OnLayout(LayoutEventArgs levent) { SetButtonsPosition(); base.OnLayout(levent); }
public virtual bool Layout(object container, LayoutEventArgs layoutEventArgs) { return(false); }
public virtual bool Layout (object container, LayoutEventArgs layoutEventArgs) { return false; }
/// <exclude/> protected override void OnLayout(LayoutEventArgs levent) { CalculateTabs(); base.OnLayout(levent); }
protected override void OnLayout(LayoutEventArgs levent) { CalculateTabs(); base.OnLayout(levent); }
protected override void OnLayout(LayoutEventArgs e) { base.OnLayout(e); reset_view(); }
protected void UltraWebGridKQM_InitializeLayout(object sender, LayoutEventArgs e) { int i; string str = ""; string time = ""; OTMTotalQryModel modelMonthTotal = new OTMTotalQryModel(); OTMTotalQryBll bllOTMQry = new OTMTotalQryBll(); modelMonthTotal.BillNo = this.HiddenBillNo.Value; DataTable dt_monthtotal = bllOTMQry.GetOTMQryList(modelMonthTotal); if (dt_monthtotal.Rows.Count > 0) { str = dt_monthtotal.Rows[0]["YearMonth"].ToString(); time = (str.Substring(0, 4) + "/" + str.Substring(4, 2)).ToString(); } DateTime YearMonth = Convert.ToDateTime(time + "/01"); if (this.HiddenYearMonth.Value.Length == 0) { this.HiddenYearMonth.Value = YearMonth.ToString(); foreach (UltraGridColumn c in e.Layout.Bands[0].Columns) { c.Header.RowLayoutColumnInfo.OriginY = 1; } ColumnHeader ch = new ColumnHeader(true) { Caption = Resources.ControlText.gvApplyHours }; ch.RowLayoutColumnInfo.OriginY = 0; ch.RowLayoutColumnInfo.OriginX = 8; ch.RowLayoutColumnInfo.SpanX = 3; ch.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(ch); ColumnHeader ch2 = new ColumnHeader(true) { Caption = Resources.ControlText.gvRelSalaryHours }; ch2.RowLayoutColumnInfo.OriginY = 0; ch2.RowLayoutColumnInfo.OriginX = 11; ch2.RowLayoutColumnInfo.SpanX = 3; ch2.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(ch2); ColumnHeader ch3 = new ColumnHeader(true) { Caption = Resources.ControlText.gvSpecApplyHours }; ch3.RowLayoutColumnInfo.OriginY = 0; ch3.RowLayoutColumnInfo.OriginX = 14; ch3.RowLayoutColumnInfo.SpanX = 3; ch3.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(ch3); ColumnHeader ch4 = new ColumnHeader(true) { Caption = Resources.ControlText.gvSpecrelSalary }; ch4.RowLayoutColumnInfo.OriginY = 0; ch4.RowLayoutColumnInfo.OriginX = 17; ch4.RowLayoutColumnInfo.SpanX = 3; ch4.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(ch4); for (i = 1; i < 0x20; i++) { ColumnHeader chr = new ColumnHeader(true) { Caption = i.ToString() }; chr.RowLayoutColumnInfo.OriginY = 0; chr.RowLayoutColumnInfo.OriginX = i + 0x19; chr.RowLayoutColumnInfo.SpanX = 1; chr.Style.HorizontalAlign = HorizontalAlign.Center; e.Layout.Bands[0].HeaderLayout.Add(chr); } ch = e.Layout.Bands[0].Columns.FromKey("CheckBoxAll").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("DISSIGNRMARK").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("WorkNo").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("LocalName").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("BuName").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("DName").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("OverTimeType").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("G2Remain").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("MAdjust1").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("MRelAdjust").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("AdvanceAdjust").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; ch = e.Layout.Bands[0].Columns.FromKey("RestAdjust").Header; ch.RowLayoutColumnInfo.SpanY = 2; ch.RowLayoutColumnInfo.OriginY = 0; } else { HiddenYearMonth.Value = dt_monthtotal.Rows[0]["YearMonth"].ToString().Replace("/", ""); //this.HiddenYearMonth.Value = this.txtYearMonth.Text.Replace("/", ""); } YearMonth = Convert.ToDateTime(HiddenYearMonth.Value); string FromKeyName = ""; for (i = 1; i < 0x20; i++) { FromKeyName = "Day" + i.ToString(); e.Layout.Bands[0].Columns.FromKey(FromKeyName).Header.Caption = this.GetWeek(YearMonth.AddDays((double)(i - 1))); if (this.isHoliday(i, YearMonth)) { e.Layout.Rows.Band.Columns[e.Layout.Bands[0].Columns.FromKey(FromKeyName).Index].CellStyle.BackColor = Color.DarkKhaki; } else { e.Layout.Rows.Band.Columns[e.Layout.Bands[0].Columns.FromKey(FromKeyName).Index].CellStyle.BackColor = Color.White; } } }
protected override void OnLayout(LayoutEventArgs levent) { Rectangle rectTabStrip = ClientRectangle; // Set position and size of the buttons int buttonWidth = ImageCloseEnabled.Width; int buttonHeight = ImageCloseEnabled.Height; int height = rectTabStrip.Height - DocumentButtonGapTop - DocumentButtonGapBottom; if (buttonHeight < height) { buttonWidth = buttonWidth * (height / buttonHeight); buttonHeight = height; } Size buttonSize = new Size(buttonWidth, buttonHeight); m_buttonClose.Size = buttonSize; m_buttonOptions.Size = buttonSize; int x = rectTabStrip.X + rectTabStrip.Width - DocumentTabGapLeft - DocumentButtonGapRight - buttonWidth; int y = rectTabStrip.Y + DocumentButtonGapTop; m_buttonClose.Location = new Point(x, y); Point point = m_buttonClose.Location; point.Offset(- (DocumentButtonGapBetween + buttonWidth), 0); m_buttonOptions.Location = point; OnRefreshChanges(); base.OnLayout(levent); }
protected void grdProduct_InitializeLayout(object sender, LayoutEventArgs e) { e.Layout.Grid.Columns.FromKey("CheckBox").AllowRowFiltering = false; e.Layout.Grid.Columns.FromKey("TenSanPham").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("Anh").AllowRowFiltering = false; e.Layout.Grid.Columns.FromKey("DonViTienTe").AllowRowFiltering = false; e.Layout.Grid.Columns.FromKey("TenCuaHang").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("TenNhomSanPham").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; if (rbtTatCa.Checked) { e.Layout.Pager.AllowPaging = false; } else { e.Layout.Pager.AllowPaging = true; } }
private void toolStripPanel2_Layout(object sender, LayoutEventArgs e) { dockPanel.Location = new Point(0, toolStripPanel1.Height); dockPanel.Height = ClientSize.Height - toolStripPanel2.Height - toolStripPanel1.Height; dockPanel.Width = ClientSize.Width; }
public override bool Layout(object objContainer, LayoutEventArgs layoutEventArgs) { _table.SuspendLayout(); int[] widths = new int[_table._columns.Count]; int y = 0; // determine minimal widths for (int i = 0; i < widths.Length; i++) { Size headerMinSize = _table._lstCells[i].header.MinimumSize; int width = Math.Max(_table._columns[i].MinWidth, headerMinSize.Width); if (y < headerMinSize.Height) { y = headerMinSize.Height; } widths[i] = width; } for (int i = 0; i < _table._lstRowCells.Count; i++) { TableRow row = _table._lstRowCells[i]; if (row.Parent != null) { for (int j = 0; j < widths.Length; j++) { int w = _table._lstCells[j].cells[i].MinimumSize.Width; if (widths[j] < w) { widths[j] = w; } } } } int widthSum = 0; foreach (int w in widths) { widthSum += w; } if (widthSum > _table.Width) { // modify container size if content does not fit _table.Width = widthSum; } else { // grow columns to preferred sizes starting at the leftmost int delta = _table.Width - widthSum; for (int i = 0; delta > 0 && i < widths.Length; i++) { int w = widths[i]; int pW = _table._columns[i].PrefWidth; if (w < pW) { int diff = pW - w; if (delta > diff) { widths[i] = pW; delta -= diff; } else { widths[i] = w + delta; break; } } } } int x = 0; // layout headers for (int i = 0; i < widths.Length; i++) { Control header = _table._lstCells[i].header; header.Location = new Point(x, 0); header.Size = new Size(widths[i], y); x += widths[i]; } int rowIndex = 0; // layout cells foreach (int index in _table._lstPermutation) { int dy = 0; x = 0; TableRow row = _table._lstRowCells[index]; if (row.Parent != null) { row.SuspendLayout(); row.Index = rowIndex; row.Selected = (_table._intSelectedIndex == index); row.Location = new Point(0, y); row.Width = widthSum; for (int i = 0; i < _table._columns.Count; i++) { TableCell cell = _table._lstCells[i].cells[index]; cell.Location = new Point(x, row.Margin.Top); if (dy < cell.Height) { dy = cell.Height; } x += widths[i]; } for (int i = 0; i < _table._columns.Count; i++) { TableCell cell = _table._lstCells[i].cells[index]; cell.UpdateAvailableSize(widths[i], dy); } row.Height = dy + row.Margin.Top + row.Margin.Bottom; row.ResumeLayout(false); y += row.Height; rowIndex++; } } if (y > _table.Height) { _table.Height = y; } _table.ResumeLayout(false); return(true); }
private void EDDiscoveryForm_Layout(object sender, LayoutEventArgs e) // Manually position, could not get gripper under tab control with it sizing for the life of me { }
protected void grdAdv_InitializeLayout(object sender, LayoutEventArgs e) { e.Layout.Grid.Columns.FromKey("CheckBox").AllowRowFiltering = false; e.Layout.Grid.Columns.FromKey("DuongDan").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("NoiDungQuangCao").FilterOperatorDefaultValue = FilterComparisionOperator.Contains; e.Layout.Grid.Columns.FromKey("Anh").AllowRowFiltering = false; if (rbtTatCa.Checked) { e.Layout.Pager.AllowPaging = false; } else { e.Layout.Pager.AllowPaging = true; } }
internal virtual void ProcessSuspendedLayoutEventArgs(IArrangedElement container, LayoutEventArgs args) { }