/// <summary> /// Creates a new Sensor for the specified RibbonTab /// </summary> /// <param name="control">Control to listen to mouse events</param> /// <param name="ribbon">Ribbon that will be affected</param> /// <param name="tab">Tab that will be sensed, from which all panels and items will be extracted to sensing also.</param> public RibbonMouseSensor(Control control, Ribbon ribbon, RibbonTab tab) : this(control, ribbon) { Tabs.Add(tab); Panels.AddRange(tab.Panels); foreach (RibbonPanel panel in tab.Panels) { Items.AddRange(panel.Items); } }
public NetStatusBarEx() { NetStatusBarPanel panel = new NetStatusBarPanel(); panel.Text = "Ready"; panel.AutoSize = StatusBarPanelAutoSize.Spring; CapsPanel.Width = NumPanel.Width = InsPanel.Width = 33; CapsPanel.Alignment = NumPanel.Alignment = InsPanel.Alignment = HorizontalAlignment.Center; InsPanel.Text = "INS"; Panels.AddRange(new StatusBarPanel[] { panel, CapsPanel, NumPanel, InsPanel }); ShowPanels = true; Application.Idle += new EventHandler(OnIdle); }
/// <summary> /// Creates a new Sensor for specified objects /// </summary> /// <param name="control">Control to listen mouse events</param> /// <param name="ribbon">Ribbon that will be affected</param> /// <param name="tabs">Tabs that will be sensed</param> /// <param name="panels">Panels that will be sensed</param> /// <param name="items">Items that will be sensed</param> public RibbonMouseSensor(Control control, Ribbon ribbon, IEnumerable <RibbonTab> tabs, IEnumerable <RibbonPanel> panels, IEnumerable <RibbonItem> items) : this(control, ribbon) { if (tabs != null) { Tabs.AddRange(tabs); } if (panels != null) { Panels.AddRange(panels); } if (items != null) { Items.AddRange(items); } }
private void AddPanels(FloorMounting floor) { // найти блоки панелей-СБ входящих внутрь границ блока стороны фасада var panels = new List <MountingPanel>(); foreach (var panelSb in floor.RemainingPanels) { if (Extents.IsPointInBounds(panelSb.ExtTransToModel.MinPoint) && Extents.IsPointInBounds(panelSb.ExtTransToModel.MaxPoint)) { panels.Add(panelSb); } } Panels.AddRange(panels); floor.RemainingPanels.RemoveAll(p => panels.Contains(p)); }
private void InitializeComponent() { iconPanel = new StatusBarPanel(); textPanel = new StatusBarPanel(); progressPanel = new StatusBarPanel(); locationPanel = new StatusBarPanel(); sizePanel = new StatusBarPanel(); ((ISupportInitialize)(iconPanel)).BeginInit(); ((ISupportInitialize)(textPanel)).BeginInit(); ((ISupportInitialize)(progressPanel)).BeginInit(); ((ISupportInitialize)(locationPanel)).BeginInit(); ((ISupportInitialize)(sizePanel)).BeginInit(); // // iconPanel // iconPanel.BorderStyle = StatusBarPanelBorderStyle.None; iconPanel.MinWidth = 20; iconPanel.Style = StatusBarPanelStyle.OwnerDraw; iconPanel.Width = 20; // // textPanel // textPanel.AutoSize = StatusBarPanelAutoSize.Spring; textPanel.BorderStyle = StatusBarPanelBorderStyle.None; textPanel.Text = "Ready"; textPanel.Width = 10; // // progressPanel // progressPanel.BorderStyle = StatusBarPanelBorderStyle.None; progressPanel.MinWidth = 0; progressPanel.Style = StatusBarPanelStyle.OwnerDraw; progressPanel.Width = 120; // // locationPanel // locationPanel.AutoSize = StatusBarPanelAutoSize.Contents; locationPanel.BorderStyle = StatusBarPanelBorderStyle.None; locationPanel.MinWidth = 1; locationPanel.Style = StatusBarPanelStyle.OwnerDraw; locationPanel.Width = 10; // // sizePanel // sizePanel.AutoSize = StatusBarPanelAutoSize.Contents; sizePanel.BorderStyle = StatusBarPanelBorderStyle.None; sizePanel.Style = StatusBarPanelStyle.OwnerDraw; sizePanel.Width = 10; // // MpeStatusBar // Panels.AddRange(new StatusBarPanel[] { iconPanel, textPanel, locationPanel, sizePanel, progressPanel }); ShowPanels = true; PanelClick += new StatusBarPanelClickEventHandler(OnPanelClick); DrawItem += new StatusBarDrawItemEventHandler(OnDrawItem); ((ISupportInitialize)(iconPanel)).EndInit(); ((ISupportInitialize)(textPanel)).EndInit(); ((ISupportInitialize)(progressPanel)).EndInit(); ((ISupportInitialize)(locationPanel)).EndInit(); ((ISupportInitialize)(sizePanel)).EndInit(); }
public DotNetStatusBar() { // This call is required by the Windows.Forms Form Designer. try { InitializeComponent(); textFont = new Font("Arial", 8, FontStyle.Bold); textBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Gray); backBrush = new System.Drawing.SolidBrush(Info.getInstance().backColor); //.SystemBrushes.InactiveBorder; // change the style to double buffering to avoid flickering this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true); ShowPanels = true; this.SizingGrip = false; // assign the same font as the Visual Studio .Net Statusbar ( on my machine :-> ) Font = new Font("Arial", 8); // create all the panels _MessagePanel = new System.Windows.Forms.StatusBarPanel(); _CenterImagePanel = new System.Windows.Forms.StatusBarPanel(); _RightMessagePanel = new System.Windows.Forms.StatusBarPanel(); _RightImagePanel = new System.Windows.Forms.StatusBarPanel(); Panels.AddRange(new StatusBarPanel[] { _MessagePanel, _CenterImagePanel, _RightMessagePanel }); // calculate a proper height according the height of the font Size = new System.Drawing.Size(292, FontHeight + 7); // calculate the width of the overwrite/insert/capslock panel Graphics g = this.CreateGraphics(); string [] aStr = new string[] { "CAP", "INS", "OVR", "NUM" }; float fMax = 0f; foreach (string str in aStr) { System.Drawing.SizeF size = g.MeasureString(str, Font); if (size.Width > fMax) { fMax = size.Width; } } int width = Convert.ToInt32(fMax + 2.5f); // _MessagePanel _MessagePanel.BorderStyle = StatusBarPanelBorderStyle.None; _MessagePanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; _MessagePanel.Width = 10; _MessagePanel.Style = StatusBarPanelStyle.OwnerDraw; _MessagePanel.Text = "Ready"; // _CenterImagePanel _CenterImagePanel.BorderStyle = StatusBarPanelBorderStyle.None; _CenterImagePanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; _CenterImagePanel.Width = 100; _CenterImagePanel.Alignment = HorizontalAlignment.Center; _RightMessagePanel.BorderStyle = StatusBarPanelBorderStyle.None; _RightMessagePanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; _RightMessagePanel.Text = "Connecting"; //_RightMessagePanel.Width=50; _RightMessagePanel.Alignment = HorizontalAlignment.Right; ///////_RightImagePanel _RightImagePanel.BorderStyle = StatusBarPanelBorderStyle.Raised; _RightImagePanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; _RightImagePanel.Width = 10; _RightImagePanel.Alignment = HorizontalAlignment.Center; //_RightImagePanel.Style = StatusBarPanelStyle.OwnerDraw; //this.Controls.Add(synchButton); comboMood.Visible = false; this.Controls.Add(comboMood); comboMood.DropDownStyle = ComboBoxStyle.DropDownList; comboMood.Items.Add("Yellow"); comboMood.Items.Add("Blue"); comboMood.Items.Add("Green"); comboMood.Items.Add("Red"); comboMood.Items.Add("Orange"); comboMood.SelectedIndexChanged += new EventHandler(comboMood_SelectedIndexChanged); comboMood.SelectedIndex = 2; /* * synchButton.Text = "Synchronize All"; * synchButton.Click+=new EventHandler(synchButton_Click); * synchButton.Visible =false; */ g.Dispose(); } catch (Exception ex) { Trace.WriteLine("Exception at the place of status bar contructor :" + ex.ToString()); ex = ex; } }