private void radButton4_Click(object sender, EventArgs e) { int count = 0; foreach (CheckItem item in this.radListBox1.Items) { if (!(item.ToggleState == ToggleState.On)) { count++; } } if (count > 0) { DialogResult d = MessageBox.Show( RadToolStripLocalizationProvider.CurrentProvider.GetLocalizationString(RadToolStripLocalizationStringId.ResetToolBarsAlertMessage) , "RadToolStrip", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (d == DialogResult.OK) { foreach (CheckItem item in this.radListBox1.Items) { RadToolStripManager manager = item.AssociatedManager; manager.SuspendLayout(); for (int i = 0; i < manager.elementList.Count; i++) { RadToolStripElement element = manager.elementList[i] as RadToolStripElement; if (element != null && element.Items.Contains(item.AssociatedItem)) { element.Orientation = manager.Orientation; manager.Items.Add(element); manager.elementList.Remove(element); break; } } manager.ResumeLayout(false); if (item.AssociatedItem != null) { item.AssociatedItem.Visibility = ElementVisibility.Visible; item.AssociatedItem.Margin = new Padding(0, 0, 0, 0); item.ToggleState = ToggleState.On; } else if (item.AssociatedForm != null) { item.AssociatedForm.Show(); item.ToggleState = ToggleState.On; } } } } }
private void InsertToAppropriatePosition(RadToolStripManager toolStripManager, RadToolStripItem item, Rectangle rangeRect) { toolStripManager.SuspendLayout(); if (toolStripManager.Items.Count > 0) { if (toolStripManager.Orientation == Orientation.Horizontal) { RadToolStripElement element = new RadToolStripElement(); Rectangle topRect = new Rectangle(rangeRect.X, rangeRect.Y, rangeRect.Width, 25); Rectangle bottomRect = new Rectangle(rangeRect.X, rangeRect.Bottom - 25, rangeRect.Width, 25); if ((topRect.Contains(this.Location)) && (toolStripManager.parentAutoSize)) { toolStripManager.Items.Insert(0, element); element.Items.Add(item); item.InvalidateLayout(); } else { if (bottomRect.Contains(this.Location) && toolStripManager.parentAutoSize) { toolStripManager.Items.Add(element); element.Items.Add(item); item.InvalidateLayout(); } else { (toolStripManager.Items[0] as RadToolStripElement).Items.Add(item); item.InvalidateLayout(); } } } else { RadToolStripElement element = new RadToolStripElement(); element.Orientation = Orientation.Vertical; Rectangle leftRect = new Rectangle(rangeRect.X - 25, rangeRect.Y, 25, rangeRect.Height); Rectangle rightRect = new Rectangle(rangeRect.Right - 25, rangeRect.Y, 25, rangeRect.Height); if (leftRect.Contains(this.Location) && toolStripManager.parentAutoSize) { toolStripManager.Items.Insert(0, element); element.Items.Add(item); item.InvalidateLayout(); } else { if (rightRect.Contains(this.Location) && toolStripManager.parentAutoSize) { toolStripManager.Items.Add(element); element.Items.Add(item); item.InvalidateLayout(); } else { (toolStripManager.Items[0] as RadToolStripElement).Items.Add(item); item.InvalidateLayout(); } } } } else { RadToolStripElement element = new RadToolStripElement(); toolStripManager.Items.Add(element); (toolStripManager.Items[0] as RadToolStripElement).Items.Add(item); item.InvalidateLayout(); } if (this.fadeTimer != null) { this.fadeTimer.Stop(); } if (this.fadeStartTimer != null) { this.fadeStartTimer.Stop(); } if (this.backFadeTimer != null) { this.backFadeTimer.Stop(); } toolStripManager.ResumeLayout(true); }