public virtual void MoveToUpperLine(CommandBarStripElement element, CommandBarRowElement currentHolder) { Debug.Assert(currentHolder.Children.Contains(element), "Current holder must contains element"); int index = this.lines.IndexOf(currentHolder); Debug.Assert(index > -1, "Lines must contains currentHolder"); int prevLineIndex = index - 1; if (prevLineIndex < 0) { //this.lines.Insert(0,RadCommandBarToolstripsHolderFactory.CreateLayoutPanel(this)); prevLineIndex = 0; } currentHolder.Children.Remove(element); if (currentHolder.Children.Count == 0) { this.lines.Remove(currentHolder); } lines[prevLineIndex].Children.Add(element); SyncStackLayoutWithLines(); }
public void MoveToDownerLine(CommandBarStripElement element, CommandBarRowElement currentHolder) { int index = this.Rows.IndexOf(currentHolder) + 1; if (index >= this.Rows.Count && currentHolder.Strips.Count == 1) { this.CreateFloatingStrip(element, currentHolder, Control.MousePosition); } else { if (index >= this.Rows.Count) { this.Rows.Add(RadCommandBarToolstripsHolderFactory.CreateLayoutPanel(this)); index = this.Rows.Count - 1; } bool capture = element.Grip.Capture; currentHolder.Strips.Remove((RadItem)element); this.Rows[index].Strips.Add(element); if (currentHolder.Strips.Count == 0) { this.Rows.Remove((RadItem)currentHolder); } element.Grip.Capture = capture; } }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); Cursor.Current = Cursors.SizeAll; if (!this.isDragging && e.Button == MouseButtons.Left && this.IsMouseDown && (Math.Abs(e.X - oldMousePosition.X) >= 1 || Math.Abs(e.Y - oldMousePosition.Y) >= 1)) { this.BeginDrag(e); } if (this.isDragging) { this.Capture = true; this.ElementTree.Control.Capture = true; PointF location = (this.orientation == System.Windows.Forms.Orientation.Horizontal)? new PointF(e.X - currentX, e.Y): new PointF(e.X, e.Y - currentY); CommandBarRowElement parentRow = (this.owner.Parent as CommandBarRowElement); if (parentRow != null && parentRow.RightToLeft && parentRow.Orientation == System.Windows.Forms.Orientation.Horizontal) { location.X = parentRow.Size.Width - location.X; } this.owner.DesiredLocation = location; this.delta = new PointF(location.X - oldMouseLocation.X, location.Y - oldMouseLocation.Y); this.oldMouseLocation = location; this.OnDragging(e); } }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); Cursor.Current = Cursors.SizeAll; if (!this.isDragging && e.Button == MouseButtons.Left && this.IsMouseDown && (Math.Abs(e.X - this.oldMousePosition.X) >= 1 || Math.Abs(e.Y - this.oldMousePosition.Y) >= 1)) { this.BeginDrag(e); } if (!this.isDragging) { return; } this.Capture = true; this.ElementTree.Control.Capture = true; PointF pointF = this.Orientation == Orientation.Horizontal ? new PointF((float)e.X - this.currentX, (float)e.Y) : new PointF((float)e.X, (float)e.Y - this.currentY); pointF.X /= this.DpiScaleFactor.Width; pointF.Y /= this.DpiScaleFactor.Height; CommandBarRowElement parent = this.owner.Parent as CommandBarRowElement; if (parent != null && parent.RightToLeft && parent.Orientation == Orientation.Horizontal) { pointF.X = ((float)parent.Size.Width - pointF.X) / this.DpiScaleFactor.Width; } this.owner.DesiredLocation = pointF; this.delta = new PointF((pointF.X - this.oldMouseLocation.X) / this.DpiScaleFactor.Width, (pointF.Y - this.oldMouseLocation.Y) / this.DpiScaleFactor.Height); this.oldMouseLocation = pointF; this.OnDragging(e); }
/// <summary> /// Creates a floating form of a specified <c ref="CommandBarStripElement"/>. /// </summary> /// <param name="stripElement">The strip element of which the floating form should be created.</param> /// <param name="currentRow">The <c ref="CommandBarRowElement"/> that contains the strip element.</param> /// <param name="initialLocation">The initial location of the floating form.</param> public void CreateFloatingStrip(CommandBarStripElement stripElement, CommandBarRowElement currentRow, Point initialLocation) { if (!stripElement.EnableFloating || this.OnFloatingStripCreating(stripElement)) { return; } CommandBarFloatingForm floatingForm = new CommandBarFloatingForm(); floatingForm.ParentControl = this.ElementTree.Control.Parent; Point initialDragOffset = Point.Empty; if (!this.RightToLeft) { floatingForm.RightToLeft = System.Windows.Forms.RightToLeft.No; floatingForm.Location = Point.Add(initialLocation, new Size(-5, -5)); initialDragOffset = new Point(5, 5); } else { floatingForm.RightToLeft = System.Windows.Forms.RightToLeft.Yes; floatingForm.Location = Point.Add(Point.Add(initialLocation, new Size(-stripElement.Size.Width, 0)), new Size(5, -5)); initialDragOffset = new Point(stripElement.Size.Width - 5, 5); } floatingForm.Text = stripElement.Name; stripElement.EnableDragging = false; stripElement.Capture = false; stripElement.ForceEndDrag(); Size screenSize = Screen.GetWorkingArea(this.ElementTree.Control).Size; stripElement.Orientation = System.Windows.Forms.Orientation.Horizontal; floatingForm.ClientSize = (stripElement.GetExpectedSize(screenSize).ToSize()); stripElement.FloatingForm = floatingForm; floatingForm.StripElement = stripElement; if (currentRow != null) { currentRow.Strips.Remove(stripElement); } floatingForm.StripInfoHolder.AddStripInfo(stripElement); floatingForm.Show(); this.OnFloatingStripCreated(stripElement); floatingForm.InitializeMove(initialDragOffset); Cursor.Current = Cursors.SizeAll; if (currentRow != null && currentRow.Strips.Count == 0) { this.Rows.Remove(currentRow); } }
public void CreateFloatingStrip( CommandBarStripElement stripElement, CommandBarRowElement currentRow, Point initialLocation) { if (!stripElement.EnableFloating || this.OnFloatingStripCreating((object)stripElement)) { return; } CommandBarFloatingForm commandBarFloatingForm = new CommandBarFloatingForm(); commandBarFloatingForm.ParentControl = this.ElementTree.Control.Parent; Point offset = Point.Empty; if (!this.RightToLeft) { commandBarFloatingForm.RightToLeft = RightToLeft.No; commandBarFloatingForm.Location = Point.Add(initialLocation, new Size(-5, -5)); offset = new Point(5, 5); } else { commandBarFloatingForm.RightToLeft = RightToLeft.Yes; commandBarFloatingForm.Location = Point.Add(Point.Add(initialLocation, new Size(-stripElement.Size.Width, 0)), new Size(5, -5)); offset = new Point(stripElement.Size.Width - 5, 5); } commandBarFloatingForm.Text = stripElement.DisplayName; stripElement.EnableDragging = false; stripElement.Capture = false; stripElement.ForceEndDrag(); Size size = Screen.GetWorkingArea(this.ElementTree.Control).Size; stripElement.Orientation = Orientation.Horizontal; commandBarFloatingForm.ClientSize = stripElement.GetExpectedSize((SizeF)size).ToSize(); stripElement.FloatingForm = commandBarFloatingForm; commandBarFloatingForm.StripElement = stripElement; currentRow?.Strips.Remove((RadItem)stripElement); commandBarFloatingForm.StripInfoHolder.AddStripInfo(stripElement); commandBarFloatingForm.Show(); this.OnFloatingStripCreated((object)stripElement); commandBarFloatingForm.InitializeMove(offset); Cursor.Current = Cursors.SizeAll; if (currentRow == null || currentRow.Strips.Count != 0) { return; } this.Rows.Remove((RadItem)currentRow); }
protected virtual void ItemsChanged(RadCommandBarLinesElementCollection changed, CommandBarRowElement target, ItemsChangeOperation operation) { if (operation != ItemsChangeOperation.Inserted) { return; } CommandBarRowElement panel = target as CommandBarRowElement; if (panel == null) { return; } panel.Owner = this; panel.Orientation = this.Orientation; }
protected override void CreateChildElements() { base.CreateChildElements(); this.commandBar = new RadCommandBarElement(); this.commandBar.Margin = new Padding(0, 0, 0, -3); this.commandBar.AllowDrag = false; this.commandBar.AllowDrop = false; this.commandBar.DesignTimeAllowDrag = false; this.commandBar.DesignTimeAllowDrop = false; this.commandBarRowElement = new CommandBarRowElement(); this.commandBarRowElement.Margin = new Padding(1, 0, 1, 0); this.commandBar.Rows.Add(this.CommandBarRowElement); this.CreateButtonsStripElementChildElements(); this.CreateTextBoxStripElementChildElements(); this.Children.Add((RadElement)this.commandBar); this.WireEvents(); }
public virtual void MoveToUpperLine( CommandBarStripElement element, CommandBarRowElement currentHolder) { int index = this.lines.IndexOf(currentHolder) - 1; if (index < 0) { index = 0; } currentHolder.Children.Remove((RadElement)element); if (currentHolder.Children.Count == 0) { this.lines.Remove(currentHolder); } this.lines[index].Children.Add((RadElement)element); this.SyncStackLayoutWithLines(); }
/// <summary> /// Moves a specific <see cref="CommandBarStripElement"/> to the lower <see cref="CommandBarRowElement"/>. /// </summary> /// <param name="element">The element to move.</param> /// <param name="currentHolder">The <see cref="CommandBarRowElement"/> that contains the element to move.</param> public void MoveToDownerLine(CommandBarStripElement element, CommandBarRowElement currentHolder) { Debug.Assert(currentHolder.Strips.Contains(element), "Current holder must contains element"); int index = this.Rows.IndexOf(currentHolder); Debug.Assert(index > -1, "Lines must contains currentHolder"); int nextHolderPanelIndex = index + 1; if (nextHolderPanelIndex >= this.Rows.Count && currentHolder.Strips.Count == 1) { CreateFloatingStrip(element, currentHolder, Control.MousePosition); return; } if (nextHolderPanelIndex >= this.Rows.Count) { CommandBarRowElement newPanel = RadCommandBarToolstripsHolderFactory.CreateLayoutPanel(this); this.Rows.Add(newPanel); nextHolderPanelIndex = this.Rows.Count - 1; } bool capture = element.Grip.Capture; currentHolder.Strips.Remove(element); CommandBarRowElement panelToAdd = this.Rows[nextHolderPanelIndex]; Debug.Assert(panelToAdd != null, "Panel to add cannot be null"); panelToAdd.Strips.Add(element); if (currentHolder.Strips.Count == 0) { this.Rows.Remove(currentHolder); } element.Grip.Capture = capture; }
/// <summary> /// Moves a specific <see cref="CommandBarStripElement"/> to the upper <see cref="CommandBarRowElement"/>. /// </summary> /// <param name="element">The element to move.</param> /// <param name="currentHolder">The <see cref="CommandBarRowElement"/> that contains the element to move.</param> public void MoveToUpperLine(CommandBarStripElement element, CommandBarRowElement currentHolder) { Debug.Assert(currentHolder.Strips.Contains(element), "Current holder must contains element"); int index = this.Rows.IndexOf(currentHolder); Debug.Assert(index > -1, "Rows must contain currentHolder"); int prevHolderPanelIndex = index - 1; if (prevHolderPanelIndex < 0 && currentHolder.Strips.Count == 1) { CreateFloatingStrip(element, currentHolder, Control.MousePosition); return; } if (prevHolderPanelIndex < 0) { CommandBarRowElement newPanel = RadCommandBarToolstripsHolderFactory.CreateLayoutPanel(this); this.Rows.Insert(0, newPanel); prevHolderPanelIndex = 0; } bool capture = element.Grip.Capture; currentHolder.Strips.Remove(element); CommandBarRowElement panelToAdd = this.Rows[prevHolderPanelIndex]; Debug.Assert(panelToAdd != null, "Panel to add cannot be null"); panelToAdd.Strips.Add(element); if (currentHolder.Strips.Count == 0) { this.Rows.Remove(currentHolder); } // this.ElementTree.Control.FindForm(); element.Grip.Capture = capture; }
public virtual void AddStandardItems() { if (this.Navigator.Site == null) { this.commandBarRowElement = new CommandBarRowElement(); this.Rows.Add(this.commandBarRowElement); } else { this.designerHost = this.Navigator.Site.GetService(typeof(IDesignerHost)) as IDesignerHost; this.changeService = this.Navigator.Site.GetService(typeof(IComponentChangeService)) as IComponentChangeService; this.commandBarRowElement = (CommandBarRowElement)this.designerHost.CreateComponent(typeof(CommandBarRowElement), this.Navigator.Name + "RowElement"); this.changeService.OnComponentChanging((object)this.Navigator.Site.Component, (MemberDescriptor)null); this.Rows.Add(this.commandBarRowElement); this.changeService.OnComponentChanged((object)this.Navigator.Site.Component, (MemberDescriptor)null, (object)null, (object)null); } this.CreateFirstTopStripElementChildElements(); this.CreateSecondBottomStripElementChildElements(); if (!this.attachedEvents) { this.AttachEvents(); } this.ElementTree.ApplyThemeToElementTree(); }
private void InitializeComponent() { ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(RadPrintPreviewDialog)); this.printPreviewControl = new RadPrintPreviewControl(); this.radCommandBar = new RadCommandBar(); this.commandBarRowElement1 = new CommandBarRowElement(); this.stripElementTools = new CommandBarStripElement(); this.buttonPrint = new CommandBarButton(); this.buttonSettings = new CommandBarButton(); this.commandBarButtonWatermark = new CommandBarButton(); this.stripElementNavigation = new CommandBarStripElement(); this.buttonPrevPage = new CommandBarButton(); this.buttonNextPage = new CommandBarButton(); this.textBoxCurrentPage = new CommandBarTextBox(); this.labelTotalPages = new CommandBarLabel(); this.commandBarSeparator1 = new CommandBarSeparator(); this.buttonZoomOut = new CommandBarButton(); this.buttonZoomIn = new CommandBarButton(); this.dropDownZoom = new CommandBarDropDownList(); this.dropDownButtonLayout = new CommandBarDropDownButton(); this.menuItemFile = new RadMenuItem(); this.menuItemPrint = new RadMenuItem(); this.menuItemExit = new RadMenuItem(); this.menuItemView = new RadMenuItem(); this.radMenuSeparatorItem1 = new RadMenuSeparatorItem(); this.menuItemPreviousPage = new RadMenuItem(); this.menuItemNextPage = new RadMenuItem(); this.radMenuSeparatorItem2 = new RadMenuSeparatorItem(); this.menuItemLayout = new RadMenuItem(); this.menuItemTools = new RadMenuItem(); this.menuItemPrintSettings = new RadMenuItem(); this.menuItemWatermark = new RadMenuItem(); this.radMenu = new RadMenu(); this.radCommandBar.BeginInit(); this.radMenu.BeginInit(); this.BeginInit(); this.SuspendLayout(); this.printPreviewControl.AutoZoom = false; this.printPreviewControl.BackColor = Color.FromArgb(156, 179, 207); this.printPreviewControl.Dock = DockStyle.Fill; this.printPreviewControl.Location = new Point(0, 58); this.printPreviewControl.Name = "printPreviewControl"; this.printPreviewControl.PageBorderColor = Color.White; this.printPreviewControl.PageInnerBorderColor = Color.White; this.printPreviewControl.PageShadowColor = Color.FromArgb(109, 125, 144); this.printPreviewControl.ScrollOffset = new Point(0, 0); this.printPreviewControl.ShadowThickness = 6; this.printPreviewControl.Size = new Size(713, 399); this.printPreviewControl.TabIndex = 1; this.printPreviewControl.StartPageChanged += new EventHandler(this.printPreviewControl1_StartPageChanged); this.printPreviewControl.MouseDown += new MouseEventHandler(this.printPreviewControl1_MouseDown); this.printPreviewControl.MouseMove += new MouseEventHandler(this.printPreviewControl1_MouseMove); this.printPreviewControl.MouseUp += new MouseEventHandler(this.printPreviewControl1_MouseUp); this.printPreviewControl.MouseWheel += new MouseEventHandler(this.printPreviewControl1_MouseWheel); this.radCommandBar.AutoSize = true; this.radCommandBar.Dock = DockStyle.Top; this.radCommandBar.Location = new Point(0, 20); this.radCommandBar.Name = "radCommandBar"; this.radCommandBar.Rows.AddRange(this.commandBarRowElement1); this.radCommandBar.Size = new Size(713, 38); this.radCommandBar.TabIndex = 3; this.radCommandBar.Text = "radCommandBar1"; this.commandBarRowElement1.DisplayName = (string)null; this.commandBarRowElement1.MinSize = new Size(25, 25); this.commandBarRowElement1.Strips.AddRange(this.stripElementTools, this.stripElementNavigation); this.stripElementTools.DisplayName = "Tools"; this.stripElementTools.Items.AddRange((RadCommandBarBaseItem)this.buttonPrint, (RadCommandBarBaseItem)this.buttonSettings, (RadCommandBarBaseItem)this.commandBarButtonWatermark); this.stripElementTools.Name = "commandBarStripElement1"; this.stripElementTools.Text = ""; this.buttonPrint.AccessibleDescription = "Print"; this.buttonPrint.AccessibleName = "Print"; this.buttonPrint.DisplayName = "Print..."; this.buttonPrint.DrawText = false; this.buttonPrint.Image = (Image)componentResourceManager.GetObject("print"); this.buttonPrint.Name = "buttonPrint"; this.buttonPrint.Text = "Print"; this.buttonPrint.ToolTipText = "Print..."; this.buttonPrint.Visibility = ElementVisibility.Visible; this.buttonPrint.MouseDown += new MouseEventHandler(this.buttonPrint_Click); this.buttonSettings.AccessibleDescription = "Settings"; this.buttonSettings.AccessibleName = "Settings"; this.buttonSettings.DisplayName = "Print Settings..."; this.buttonSettings.DrawText = false; this.buttonSettings.Image = (Image)componentResourceManager.GetObject("page-setup"); this.buttonSettings.Name = "buttonSettings"; this.buttonSettings.Text = "Settings"; this.buttonSettings.ToolTipText = "Print Settings..."; this.buttonSettings.Visibility = ElementVisibility.Visible; this.buttonSettings.MouseDown += new MouseEventHandler(this.buttonSettings_Click); this.commandBarButtonWatermark.AccessibleDescription = "Watermark"; this.commandBarButtonWatermark.AccessibleName = "Watermark"; this.commandBarButtonWatermark.DisplayName = "Watermark"; this.commandBarButtonWatermark.DrawText = false; this.commandBarButtonWatermark.Image = (Image)componentResourceManager.GetObject("watermark"); this.commandBarButtonWatermark.Name = "commandBarButtonWatermark"; this.commandBarButtonWatermark.Text = "Watermark"; this.commandBarButtonWatermark.ToolTipText = "Watermark"; this.commandBarButtonWatermark.Visibility = ElementVisibility.Visible; this.commandBarButtonWatermark.MouseUp += new MouseEventHandler(this.commandBarButtonWatermark_Click); this.stripElementNavigation.DisplayName = "Navigation"; this.stripElementNavigation.Items.AddRange((RadCommandBarBaseItem)this.buttonPrevPage, (RadCommandBarBaseItem)this.buttonNextPage, (RadCommandBarBaseItem)this.textBoxCurrentPage, (RadCommandBarBaseItem)this.labelTotalPages, (RadCommandBarBaseItem)this.commandBarSeparator1, (RadCommandBarBaseItem)this.buttonZoomOut, (RadCommandBarBaseItem)this.buttonZoomIn, (RadCommandBarBaseItem)this.dropDownZoom, (RadCommandBarBaseItem)this.dropDownButtonLayout); this.stripElementNavigation.Name = "commandBarStripElement2"; this.stripElementNavigation.Text = ""; this.buttonPrevPage.AccessibleDescription = "<"; this.buttonPrevPage.AccessibleName = "<"; this.buttonPrevPage.DisplayName = "Previous Page"; this.buttonPrevPage.DrawText = false; this.buttonPrevPage.Image = (Image)componentResourceManager.GetObject("arrow-up"); this.buttonPrevPage.Name = "buttonPrevPage"; this.buttonPrevPage.Text = "<"; this.buttonPrevPage.ToolTipText = "Previous Page"; this.buttonPrevPage.Visibility = ElementVisibility.Visible; this.buttonPrevPage.MouseDown += new MouseEventHandler(this.buttonPrevPage_Click); this.buttonNextPage.AccessibleDescription = ">"; this.buttonNextPage.AccessibleName = ">"; this.buttonNextPage.DisplayName = "Next Page"; this.buttonNextPage.DrawText = false; this.buttonNextPage.Image = (Image)componentResourceManager.GetObject("arrow-down"); this.buttonNextPage.Name = "buttonNextPage"; this.buttonNextPage.Text = ">"; this.buttonNextPage.ToolTipText = "Next Page"; this.buttonNextPage.Visibility = ElementVisibility.Visible; this.buttonNextPage.MouseDown += new MouseEventHandler(this.buttonNextPage_Click); this.textBoxCurrentPage.DisplayName = "Current Page"; this.textBoxCurrentPage.Font = new Font("Segoe UI Semibold", 12f, FontStyle.Bold, GraphicsUnit.Point, (byte)204); this.textBoxCurrentPage.MaxSize = new Size(0, 0); this.textBoxCurrentPage.Name = "textBoxCurrentPage"; this.textBoxCurrentPage.StretchVertically = true; this.textBoxCurrentPage.Text = ""; this.textBoxCurrentPage.Visibility = ElementVisibility.Visible; this.textBoxCurrentPage.KeyDown += new KeyEventHandler(this.commandBarTextBox1_KeyDown); ((RadItem)this.textBoxCurrentPage.GetChildAt(0)).Text = ""; this.textBoxCurrentPage.GetChildAt(0).Alignment = ContentAlignment.MiddleCenter; this.textBoxCurrentPage.GetChildAt(0).MinSize = new Size(40, 20); this.labelTotalPages.AccessibleDescription = "of 0"; this.labelTotalPages.AccessibleName = "of 0"; this.labelTotalPages.DisplayName = "Total Pages"; this.labelTotalPages.Font = new Font("Segoe UI Semibold", 12f, FontStyle.Bold, GraphicsUnit.Point, (byte)204); this.labelTotalPages.Name = "labelTotalPages"; this.labelTotalPages.Text = "/ 0"; this.labelTotalPages.Visibility = ElementVisibility.Visible; this.commandBarSeparator1.AccessibleDescription = "commandBarSeparator1"; this.commandBarSeparator1.AccessibleName = "commandBarSeparator1"; this.commandBarSeparator1.DisplayName = "commandBarSeparator1"; this.commandBarSeparator1.Name = "commandBarSeparator1"; this.commandBarSeparator1.Visibility = ElementVisibility.Visible; this.commandBarSeparator1.VisibleInOverflowMenu = false; this.buttonZoomOut.AccessibleDescription = "-"; this.buttonZoomOut.AccessibleName = "-"; this.buttonZoomOut.DisplayName = "Zoom Out"; this.buttonZoomOut.DrawText = false; this.buttonZoomOut.Image = (Image)componentResourceManager.GetObject("zoom-out"); this.buttonZoomOut.Name = "buttonZoomOut"; this.buttonZoomOut.Text = "-"; this.buttonZoomOut.ToolTipText = "Zoom Out"; this.buttonZoomOut.Visibility = ElementVisibility.Visible; this.buttonZoomIn.AccessibleDescription = "+"; this.buttonZoomIn.AccessibleName = "+"; this.buttonZoomIn.DisplayName = "Zoom In"; this.buttonZoomIn.DrawText = false; this.buttonZoomIn.Image = (Image)componentResourceManager.GetObject("zoom-in"); this.buttonZoomIn.Name = "buttonZoomIn"; this.buttonZoomIn.Text = "+"; this.buttonZoomIn.ToolTipText = "Zoom In"; this.buttonZoomIn.Visibility = ElementVisibility.Visible; this.dropDownZoom.DisplayName = "Zoom"; this.dropDownZoom.DropDownAnimationEnabled = true; this.dropDownZoom.MinSize = new Size(90, 22); this.dropDownZoom.Name = "dropDownZoom"; this.dropDownZoom.Text = ""; this.dropDownZoom.Visibility = ElementVisibility.Visible; this.dropDownButtonLayout.AccessibleDescription = "commandBarDropDownButton1"; this.dropDownButtonLayout.AccessibleName = "commandBarDropDownButton1"; this.dropDownButtonLayout.DisplayName = "Layout"; this.dropDownButtonLayout.Image = (Image)componentResourceManager.GetObject("view-thumbnail"); this.dropDownButtonLayout.Name = "dropDownButtonLayout"; this.dropDownButtonLayout.Text = "commandBarDropDownButton1"; this.dropDownButtonLayout.ToolTipText = "Layout"; this.dropDownButtonLayout.Visibility = ElementVisibility.Visible; this.menuItemFile.AccessibleDescription = "File"; this.menuItemFile.AccessibleName = "File"; this.menuItemFile.Items.AddRange((RadItem)this.menuItemPrint, (RadItem)this.menuItemExit); this.menuItemFile.Name = "menuItemFile"; this.menuItemFile.Text = "File"; this.menuItemFile.Visibility = ElementVisibility.Visible; this.menuItemPrint.AccessibleDescription = "Print..."; this.menuItemPrint.AccessibleName = "Print..."; this.menuItemPrint.Name = "menuItemPrint"; this.menuItemPrint.Text = "Print..."; this.menuItemPrint.Visibility = ElementVisibility.Visible; this.menuItemPrint.Click += new EventHandler(this.buttonPrint_Click); this.menuItemExit.AccessibleDescription = "Exit"; this.menuItemExit.AccessibleName = "Exit"; this.menuItemExit.Name = "menuItemExit"; this.menuItemExit.Text = "Exit"; this.menuItemExit.Visibility = ElementVisibility.Visible; this.menuItemExit.Click += new EventHandler(this.radMenuItem6_Click); this.menuItemView.AccessibleDescription = "View"; this.menuItemView.AccessibleName = "View"; this.menuItemView.Items.AddRange((RadItem)this.radMenuSeparatorItem1, (RadItem)this.menuItemPreviousPage, (RadItem)this.menuItemNextPage, (RadItem)this.radMenuSeparatorItem2, (RadItem)this.menuItemLayout); this.menuItemView.Name = "menuItemView"; this.menuItemView.Text = "View"; this.menuItemView.Visibility = ElementVisibility.Visible; this.radMenuSeparatorItem1.Name = "radMenuSeparatorItem1"; this.radMenuSeparatorItem1.Visibility = ElementVisibility.Visible; this.menuItemPreviousPage.AccessibleDescription = "Previous Page"; this.menuItemPreviousPage.AccessibleName = "Previous Page"; this.menuItemPreviousPage.Name = "menuItemPreviousPage"; this.menuItemPreviousPage.Text = "Previous Page"; this.menuItemPreviousPage.Visibility = ElementVisibility.Visible; this.menuItemPreviousPage.Click += new EventHandler(this.buttonPrevPage_Click); this.menuItemNextPage.AccessibleDescription = "Next Page"; this.menuItemNextPage.AccessibleName = "Next Page"; this.menuItemNextPage.Name = "menuItemNextPage"; this.menuItemNextPage.Text = "Next Page"; this.menuItemNextPage.Visibility = ElementVisibility.Visible; this.menuItemNextPage.Click += new EventHandler(this.buttonNextPage_Click); this.radMenuSeparatorItem2.Name = "radMenuSeparatorItem2"; this.radMenuSeparatorItem2.Visibility = ElementVisibility.Visible; this.menuItemLayout.AccessibleDescription = "Layout"; this.menuItemLayout.AccessibleName = "Layout"; this.menuItemLayout.Name = "menuItemLayout"; this.menuItemLayout.Text = "Layout"; this.menuItemLayout.Visibility = ElementVisibility.Visible; this.menuItemTools.AccessibleDescription = "Tools"; this.menuItemTools.AccessibleName = "Tools"; this.menuItemTools.Items.AddRange((RadItem)this.menuItemPrintSettings, (RadItem)this.menuItemWatermark); this.menuItemTools.Name = "menuItemTools"; this.menuItemTools.Text = "Tools"; this.menuItemTools.Visibility = ElementVisibility.Visible; this.menuItemPrintSettings.AccessibleDescription = "Printer Settings"; this.menuItemPrintSettings.AccessibleName = "Printer Settings"; this.menuItemPrintSettings.Name = "menuItemPrintSettings"; this.menuItemPrintSettings.Text = "Printer Settings..."; this.menuItemPrintSettings.Visibility = ElementVisibility.Visible; this.menuItemPrintSettings.Click += new EventHandler(this.buttonSettings_Click); this.menuItemWatermark.AccessibleDescription = "Watermark Settings..."; this.menuItemWatermark.AccessibleName = "Watermark Settings..."; this.menuItemWatermark.Name = "menuItemWatermark"; this.menuItemWatermark.Text = "Watermark Settings..."; this.menuItemWatermark.Visibility = ElementVisibility.Visible; this.menuItemWatermark.Click += new EventHandler(this.commandBarButtonWatermark_Click); this.radMenu.Items.AddRange((RadItem)this.menuItemFile, (RadItem)this.menuItemView, (RadItem)this.menuItemTools); this.radMenu.Location = new Point(0, 0); this.radMenu.Name = "radMenu"; this.radMenu.Size = new Size(713, 20); this.radMenu.TabIndex = 4; this.radMenu.Text = "radMenu1"; this.radMenu.Visible = false; this.AutoScaleDimensions = new SizeF(96f, 96f); this.AutoScaleMode = AutoScaleMode.Dpi; this.ClientSize = new Size(713, 457); this.Controls.Add((Control)this.printPreviewControl); this.Controls.Add((Control)this.radCommandBar); this.Controls.Add((Control)this.radMenu); this.Icon = (Icon)componentResourceManager.GetObject("$this.Icon"); this.MinimizeBox = false; this.Name = nameof(RadPrintPreviewDialog); this.RootElement.ApplyShapeToControl = true; this.ShowInTaskbar = false; this.StartPosition = FormStartPosition.CenterScreen; this.Text = "Print Preview"; this.radCommandBar.EndInit(); this.radMenu.EndInit(); this.EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
protected virtual XmlDocument SaveLayoutCore() { XmlDocument doc = new XmlDocument(); XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", (string)null, (string)null); doc.AppendChild((XmlNode)xmlDeclaration); XmlElement element1 = doc.CreateElement(nameof(RadCommandBarElement)); element1.SetAttribute("Orientation", this.Orientation.ToString()); element1.SetAttribute("Name", this.Name); element1.SetAttribute("RTL", this.RightToLeft.ToString()); for (int index1 = 0; index1 < this.Rows.Count; ++index1) { CommandBarRowElement row = this.Rows[index1]; XmlElement element2 = doc.CreateElement("CommandBarRowElement"); element2.SetAttribute("Orientation", row.Orientation.ToString()); element2.SetAttribute("Name", row.Name); element2.SetAttribute("LineIndex", index1.ToString()); foreach (CommandBarStripElement strip in row.Strips) { XmlElement element3 = doc.CreateElement("CommandBarStripElement"); element3.SetAttribute("Orientation", strip.Orientation.ToString()); element3.SetAttribute("Name", strip.Name); element3.SetAttribute("DesiredLocationX", strip.DesiredLocation.X.ToString()); element3.SetAttribute("DesiredLocationY", strip.DesiredLocation.Y.ToString()); element3.SetAttribute("VisibleInCommandBar", strip.VisibleInCommandBar.ToString()); element3.SetAttribute("StretchHorizontally", strip.StretchHorizontally.ToString()); element3.SetAttribute("StretchVertically", strip.StretchVertically.ToString()); element3.SetAttribute("EnableFloating", strip.EnableFloating.ToString()); element3.SetAttribute("EnableDragging", strip.EnableDragging.ToString()); int num = 0; for (int index2 = 0; index2 < strip.Items.Count; ++index2) { RadCommandBarBaseItem commandBarBaseItem = strip.Items[index2]; XmlElement element4 = doc.CreateElement("RadCommandBarBaseItem"); element4.SetAttribute("Orientation", commandBarBaseItem.Orientation.ToString()); element4.SetAttribute("Name", commandBarBaseItem.Name); element4.SetAttribute("VisibleInStrip", commandBarBaseItem.VisibleInStrip.ToString()); element4.SetAttribute("StretchHorizontally", commandBarBaseItem.StretchHorizontally.ToString()); element4.SetAttribute("StretchVertically", commandBarBaseItem.StretchVertically.ToString()); element4.SetAttribute("Index", num.ToString()); element3.AppendChild((XmlNode)element4); ++num; } for (int index2 = 0; index2 < strip.OverflowButton.OverflowPanel.Layout.Children.Count; ++index2) { RadCommandBarBaseItem child = strip.OverflowButton.OverflowPanel.Layout.Children[index2] as RadCommandBarBaseItem; if (child != null) { XmlElement element4 = doc.CreateElement("RadCommandBarBaseItem"); element4.SetAttribute("Orientation", child.Orientation.ToString()); element4.SetAttribute("Name", child.Name); element4.SetAttribute("VisibleInStrip", child.VisibleInStrip.ToString()); element4.SetAttribute("StretchHorizontally", child.StretchHorizontally.ToString()); element4.SetAttribute("StretchVertically", child.StretchVertically.ToString()); element4.SetAttribute("Index", num.ToString()); element3.AppendChild((XmlNode)element4); ++num; } } element2.AppendChild((XmlNode)element3); } element1.AppendChild((XmlNode)element2); } XmlElement xmlElement = this.SaveFloatingStripsLayout(doc); element1.AppendChild((XmlNode)xmlElement); doc.AppendChild((XmlNode)element1); return(doc); }
private void LoadStripsLayout(XmlNode lineNode, int maxLineIndex) { int currentLineIndex = 0; int.TryParse(lineNode.Attributes["LineIndex"].Value, out currentLineIndex); if (currentLineIndex < 0 || currentLineIndex > maxLineIndex) { currentLineIndex = 0; } foreach (XmlNode stripNode in lineNode.ChildNodes) { if (stripNode.Name != "CommandBarStripElement") { continue; } CommandBarStripElement strip = this.GetStripByName(stripNode.Attributes["Name"].Value); if (strip == null) { continue; } if (strip.FloatingForm != null && !strip.FloatingForm.IsDisposed) { strip.FloatingForm.TryDocking(this.ElementTree.Control as RadCommandBar); } if (strip.FloatingForm != null && !strip.FloatingForm.IsDisposed) { continue; } strip.SuspendLayout(true); strip.EnableFloating = false; for (int attr = 0; attr < stripNode.Attributes.Count; attr++) { switch (stripNode.Attributes[attr].Name) { case "Orientation": strip.Orientation = (stripNode.Attributes["Orientation"].Value == "Vertical") ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInCommandBar": strip.VisibleInCommandBar = (stripNode.Attributes["VisibleInCommandBar"].Value == "True"); break; case "StretchHorizontally": strip.StretchHorizontally = (stripNode.Attributes["StretchHorizontally"].Value == "True"); break; case "StretchVertically": strip.StretchVertically = (stripNode.Attributes["StretchVertically"].Value == "True"); break; case "EnableFloating": strip.EnableFloating = (stripNode.Attributes["EnableFloating"].Value == "True"); break; case "EnableDragging": strip.EnableDragging = (stripNode.Attributes["EnableDragging"].Value == "True"); break; } } if (stripNode.Attributes["DesiredLocationX"] != null && stripNode.Attributes["DesiredLocationY"] != null) { strip.DesiredLocation = new PointF(float.Parse(stripNode.Attributes["DesiredLocationX"].Value), float.Parse(stripNode.Attributes["DesiredLocationY"].Value)); } CommandBarRowElement parentRow = (strip.Parent as CommandBarRowElement); if (parentRow != null) { parentRow.Strips.Remove(strip); } this.lines[currentLineIndex].Strips.Add(strip); foreach (XmlNode itemNode in stripNode.ChildNodes) { if (itemNode.Name != "RadCommandBarBaseItem") { continue; } RadCommandBarBaseItem item = this.GetItemByName(itemNode.Attributes["Name"].Value); if (item == null) { continue; } for (int attr = 0; attr < itemNode.Attributes.Count; attr++) { switch (itemNode.Attributes[attr].Name) { case "Orientation": item.Orientation = (itemNode.Attributes["Orientation"].Value == "Vertical") ? Orientation.Vertical : Orientation.Horizontal; break; case "VisibleInStrip": item.VisibleInStrip = (itemNode.Attributes["VisibleInStrip"].Value == "True"); break; case "StretchHorizontally": item.StretchHorizontally = (itemNode.Attributes["StretchHorizontally"].Value == "True"); break; case "StretchVertically": item.StretchVertically = (itemNode.Attributes["StretchVertically"].Value == "True"); break; case "Index": int index = int.Parse(itemNode.Attributes["Index"].Value); item.Parent.Children.Remove(item); strip.Items.Remove(item); strip.Items.Insert(index, item); break; } } } strip.ResumeLayout(true, true); strip.EnableFloating = true; } }
/// <summary> /// Creates an XmlDocument containing the current visual state data of the <see cref="RadCommandBarElement"/>. /// </summary> /// <returns>The created document.</returns> protected virtual XmlDocument SaveLayoutCore() { XmlDocument doc = new XmlDocument(); XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, null); doc.AppendChild(dec); XmlElement rootNode = doc.CreateElement("RadCommandBarElement"); rootNode.SetAttribute("Orientation", this.Orientation.ToString()); rootNode.SetAttribute("Name", this.Name); rootNode.SetAttribute("RTL", this.RightToLeft.ToString()); for (int i = 0; i < this.Rows.Count; i++) { CommandBarRowElement lineElement = this.Rows[i]; XmlElement lineNode = doc.CreateElement("CommandBarRowElement"); lineNode.SetAttribute("Orientation", lineElement.Orientation.ToString()); lineNode.SetAttribute("Name", lineElement.Name); lineNode.SetAttribute("LineIndex", i.ToString()); foreach (CommandBarStripElement stripElement in lineElement.Strips) { XmlElement stripNode = doc.CreateElement("CommandBarStripElement"); stripNode.SetAttribute("Orientation", stripElement.Orientation.ToString()); stripNode.SetAttribute("Name", stripElement.Name); stripNode.SetAttribute("DesiredLocationX", stripElement.DesiredLocation.X.ToString()); stripNode.SetAttribute("DesiredLocationY", stripElement.DesiredLocation.Y.ToString()); stripNode.SetAttribute("VisibleInCommandBar", stripElement.VisibleInCommandBar.ToString()); stripNode.SetAttribute("StretchHorizontally", stripElement.StretchHorizontally.ToString()); stripNode.SetAttribute("StretchVertically", stripElement.StretchVertically.ToString()); stripNode.SetAttribute("EnableFloating", stripElement.EnableFloating.ToString()); stripNode.SetAttribute("EnableDragging", stripElement.EnableDragging.ToString()); int currentIndex = 0; for (int j = 0; j < stripElement.Items.Count; j++) { RadCommandBarBaseItem itemElement = stripElement.Items[j]; XmlElement itemNode = doc.CreateElement("RadCommandBarBaseItem"); itemNode.SetAttribute("Orientation", itemElement.Orientation.ToString()); itemNode.SetAttribute("Name", itemElement.Name); itemNode.SetAttribute("VisibleInStrip", itemElement.VisibleInStrip.ToString()); itemNode.SetAttribute("StretchHorizontally", itemElement.StretchHorizontally.ToString()); itemNode.SetAttribute("StretchVertically", itemElement.StretchVertically.ToString()); itemNode.SetAttribute("Index", currentIndex.ToString()); stripNode.AppendChild(itemNode); ++currentIndex; } for (int j = 0; j < stripElement.OverflowButton.OverflowPanel.Layout.Children.Count; j++) { RadCommandBarBaseItem itemElement = stripElement.OverflowButton.OverflowPanel.Layout.Children[j] as RadCommandBarBaseItem; if (itemElement == null) { continue; } XmlElement itemNode = doc.CreateElement("RadCommandBarBaseItem"); itemNode.SetAttribute("Orientation", itemElement.Orientation.ToString()); itemNode.SetAttribute("Name", itemElement.Name); itemNode.SetAttribute("VisibleInStrip", itemElement.VisibleInStrip.ToString()); itemNode.SetAttribute("StretchHorizontally", itemElement.StretchHorizontally.ToString()); itemNode.SetAttribute("StretchVertically", itemElement.StretchVertically.ToString()); itemNode.SetAttribute("Index", currentIndex.ToString()); stripNode.AppendChild(itemNode); ++currentIndex; } lineNode.AppendChild(stripNode); } rootNode.AppendChild(lineNode); } XmlElement floatingFormsNode = SaveFloatingStripsLayout(doc); rootNode.AppendChild(floatingFormsNode); doc.AppendChild(rootNode); return(doc); }
protected virtual void MapControls() { foreach (CommandBarRowElement row in this.Rows) { if (row.Name == this.Navigator.Name + "RowElement" && this.commandBarRowElement == null) { this.commandBarRowElement = row; } foreach (CommandBarStripElement strip in row.Strips) { if (strip.DisplayName == this.Navigator.Name + "FirstStrip" && this.firstTopStripElement == null) { this.firstTopStripElement = strip; } else if (strip.DisplayName == this.Navigator.Name + "SecondStrip" && this.secondBottomStripElement == null) { this.secondBottomStripElement = strip; } foreach (RadCommandBarBaseItem commandBarBaseItem in strip.Items) { string name = commandBarBaseItem.Name; if (commandBarBaseItem.Site != null) { name = commandBarBaseItem.Site.Name; } if (commandBarBaseItem is CommandBarButton && name == this.Navigator.Name + "MoveFirstItem" && this.firstButton == null) { this.firstButton = commandBarBaseItem as CommandBarButton; } else if (commandBarBaseItem is CommandBarButton && name == this.Navigator.Name + "MovePreviousItem" && this.previousButton == null) { this.previousButton = commandBarBaseItem as CommandBarButton; } else if (commandBarBaseItem is CommandBarButton && name == this.Navigator.Name + "MoveNextItem" && this.nextButton == null) { this.nextButton = commandBarBaseItem as CommandBarButton; } else if (commandBarBaseItem is CommandBarButton && name == this.Navigator.Name + "MoveLastItem" && this.lastButton == null) { this.lastButton = commandBarBaseItem as CommandBarButton; } else if (commandBarBaseItem is CommandBarButton && name == this.Navigator.Name + "AddNewItem" && this.addNewButton == null) { this.addNewButton = commandBarBaseItem as CommandBarButton; } else if (commandBarBaseItem is CommandBarButton && name == this.Navigator.Name + "DeleteItem" && this.deleteButton == null) { this.deleteButton = commandBarBaseItem as CommandBarButton; } else if (commandBarBaseItem is CommandBarTextBox && name == this.Navigator.Name + "PositionItem" && this.currentNumberTextBox == null) { this.currentNumberTextBox = commandBarBaseItem as CommandBarTextBox; } else if (commandBarBaseItem is CommandBarLabel && name == this.Navigator.Name + "CountItem" && this.pageLabel == null) { this.pageLabel = commandBarBaseItem as CommandBarLabel; } } } } }