private void userDataExplorerBar_MouseMove(object sender, MouseEventArgs e) { UltraExplorerBar explorerBar = sender as UltraExplorerBar; // If the mouse has moved outside the area in which it was pressed, // start a drag operation if (lastMouseDown.HasValue) { Size dragSize = SystemInformation.DragSize; Rectangle dragRect = new Rectangle(lastMouseDown.Value, dragSize); dragRect.X -= dragSize.Width / 2; dragRect.Y -= dragSize.Height / 2; if (!dragRect.Contains(e.Location)) { if (explorerBar != null) { UltraExplorerBarItem itemAtPoint = explorerBar.ItemFromPoint(e.Location); if (itemAtPoint != null) { lastMouseDown = null; dragExplorerItem = itemAtPoint; explorerBar.DoDragDrop(dragExplorerItem, DragDropEffects.Move); } } } } }
private void InitializeComponent() { this.components = new Container(); this.ultraExplorerBar1 = new UltraExplorerBar(); this.imageListExplorerbar = new ImageList(this.components); this.ultraDockSmartPartInfo1 = new UltraDockSmartPartInfo(); this.infoProvider = new SmartPartInfoProvider(); ((ISupportInitialize)this.ultraExplorerBar1).BeginInit(); base.SuspendLayout(); this.ultraExplorerBar1.Dock = DockStyle.Fill; this.ultraExplorerBar1.ImageListLarge = this.imageListExplorerbar; this.ultraExplorerBar1.ImageListSmall = this.imageListExplorerbar; this.ultraExplorerBar1.Location = new Point(0, 0); this.ultraExplorerBar1.Name = "ultraExplorerBar1"; this.ultraExplorerBar1.Size = new Size(150, 150); this.ultraExplorerBar1.TabIndex = 0; this.imageListExplorerbar.ColorDepth = ColorDepth.Depth8Bit; this.imageListExplorerbar.ImageSize = new Size(0x10, 0x10); this.imageListExplorerbar.TransparentColor = Color.Transparent; this.ultraDockSmartPartInfo1.DefaultLocation = DockedLocation.DockedBottom; this.ultraDockSmartPartInfo1.Description = "Search"; this.ultraDockSmartPartInfo1.PreferredSize = new Size(140, 100); this.ultraDockSmartPartInfo1.Title = "Search"; this.ultraDockSmartPartInfo1.Pinned = false; this.infoProvider.Items.Add(this.ultraDockSmartPartInfo1); base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.Controls.Add(this.ultraExplorerBar1); base.Name = "SearchPanel"; ((ISupportInitialize)this.ultraExplorerBar1).EndInit(); base.ResumeLayout(false); }
private void userDataExplorerBar_DragOver(object sender, DragEventArgs e) { UltraExplorerBar explorerBar = sender as UltraExplorerBar; Point clientPos = explorerBar.PointToClient(new Point(e.X, e.Y)); if (dragExplorerItem != null) { dropExplorerItem = explorerBar.ItemFromPoint(clientPos); e.Effect = dropExplorerItem != null && dropExplorerItem != dragExplorerItem ? DragDropEffects.Move : DragDropEffects.None; } // If the cursor is within {dragScrollAreaHeight} pixels // of the top or bottom edges of the control, scroll int dragScrollAreaHeight = 8; Rectangle displayRect = explorerBar.DisplayRectangle; Rectangle topScrollArea = displayRect; topScrollArea.Height = (dragScrollAreaHeight * 2); Rectangle bottomScrollArea = displayRect; bottomScrollArea.Y = bottomScrollArea.Bottom - dragScrollAreaHeight; bottomScrollArea.Height = dragScrollAreaHeight; ISelectionManager selectionManager = explorerBar; if (topScrollArea.Contains(clientPos) || bottomScrollArea.Contains(clientPos)) { selectionManager.DoDragScrollVertical(0); } }
/// <summary> /// Initializes a new instance of the <see cref="NavigatorHeaderHelper"/> class. /// </summary> /// <param name="navigator">The UltraExplorerBar</param> /// <param name="image">The image to draw.</param> public NavigatorHeaderHelper(UltraExplorerBar navigator, Image image) { this.navigator = navigator; this.navigator.DrawFilter = new NavigatorHeaderDrawFilter(image); this.navigator.MouseMove += new MouseEventHandler(this.OnMouseMove); this.navigator.Click += new EventHandler(this.OnClick); }
private void userDataExplorerBar_QueryContinueDrag(object sender, QueryContinueDragEventArgs e) { UltraExplorerBar explorerBar = sender as UltraExplorerBar; // Cancel the drag operation if the escape key was pressed if (e.EscapePressed) { OnDragEnd(explorerBar, true); e.Action = DragAction.Cancel; } }
public static Mode GroupsBuilder(UltraExplorerBar exBar) { var startMode = new Mode(); exBar.Groups.Clear(); var modeGroup = new UltraExplorerBarGroup() {Text = "Modes"}; var modes = DataHelper.GetModes(); var modeCnt = 0; foreach (var mode in modes) { if(modeCnt++ == 0) { startMode.ModeID = mode.ModeID; startMode.ModeName = mode.ModeName; } var modeItem = modeGroup.Items.Add("M" + mode.ModeID.ToString(), mode.ModeName); modeItem.Tag = mode.ModeID; } exBar.Groups.Add(modeGroup); var stateGroup = new UltraExplorerBarGroup() {Text = "States"}; var states = DataHelper.GetStates(); foreach (var state in states) { var stateItem = stateGroup.Items.Add("S" + state.StateID.ToString(), state.StateName); stateItem.Tag = state.StateID; } exBar.Groups.Add(stateGroup); var eventGroup = new UltraExplorerBarGroup() {Text = "Events"}; var events = DataHelper.GetEvents(); foreach (var myEvent in events) { var eventItem = eventGroup.Items.Add("S" + myEvent.EventID.ToString(), myEvent.EventName); eventItem.Tag = myEvent.EventID; } exBar.Groups.Add(eventGroup); var functionGroup = new UltraExplorerBarGroup() { Text = "Functions" }; var functionList = FSMFunctionLoader.GetFunctionList(); var functions = DataHelper.GetFunctions(functionList); foreach (var function in functions) { var functionItem = functionGroup.Items.Add("S" + function.FunctionID.ToString(), function.FunctionName); functionItem.Tag = function.FunctionID; } exBar.Groups.Add(functionGroup); return startMode; }
/* * ultraExplorerBarGroup1.Items.AddRange(new Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarItem[] { * ultraExplorerBarItem1}); * ultraExplorerBarGroup1.ItemSettings.Style = Infragistics.Win.UltraWinExplorerBar.ItemStyle.Button; * ultraExplorerBarGroup1.Text = "Tareas"; * ultraExplorerBarGroup2.Text = "Favoritos"; * this.explorerBar.Groups.AddRange(new Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarGroup[] { * ultraExplorerBarGroup1, * ultraExplorerBarGroup2}); * */ /*public static void Load( UltraExplorerBar toolbar) * { * //sy_HerramientasDataset data = businessrules.sy_Herramientas.GetList( ID_EXPLORER_BAR, Security.IdPerfil ); * //LoadItems( new DataView( data.sy_Herramientas, "IsNull( IdHerramientaPadre, -1 ) = -1", "IdHerramienta", DataViewRowState.OriginalRows ), toolbar, null ); * * sy_HerramientasDataset data = businessrules.sy_Herramientas.GetList( ID_EXPLORER_BAR, Security.IdPerfil ); * * if (data.sy_Herramientas.Count == 0) * { * toolbar.Visible = false; * } * else * { * LoadItems( new DataView( data.sy_Herramientas, "IsNull( IdHerramientaPadre, -1 ) = -1", "IdHerramienta", DataViewRowState.OriginalRows ), toolbar, null ); * toolbar.Visible = true; * } * }*/ public static void Load(UltraExplorerBar toolbar, UltraDockManager ultraDockManager) { sy_HerramientasDataset data = businessrules.sy_Herramientas.GetList(ID_EXPLORER_BAR, Security.IdPerfil); if (data.sy_Herramientas.Count == 0) { ultraDockManager.Visible = false; } else { LoadItems(new DataView(data.sy_Herramientas, "IsNull( IdHerramientaPadre, -1 ) = -1", "IdHerramienta", DataViewRowState.OriginalRows), toolbar, null); ultraDockManager.Visible = true; } }
private void InitializeComponent() { this.components = new Container(); ComponentResourceManager manager = new ComponentResourceManager(typeof(TaskPanel)); this.ultraExplorerBar1 = new UltraExplorerBar(); this.ultraDockSmartPartInfo1 = new UltraDockSmartPartInfo(); this.infoProvider = new SmartPartInfoProvider(); this.imageListExplorerbar = new ImageList(this.components); ((ISupportInitialize)this.ultraExplorerBar1).BeginInit(); base.SuspendLayout(); this.ultraExplorerBar1.Dock = DockStyle.Fill; this.ultraExplorerBar1.ImageListLarge = this.imageListExplorerbar; this.ultraExplorerBar1.ImageListSmall = this.imageListExplorerbar; this.ultraExplorerBar1.Location = new Point(0, 0); this.ultraExplorerBar1.Name = "ultraExplorerBar1"; this.ultraExplorerBar1.Size = new Size(150, 150); this.ultraExplorerBar1.TabIndex = 0; this.ultraDockSmartPartInfo1.DefaultLocation = DockedLocation.DockedRight; this.ultraDockSmartPartInfo1.Description = "Tasks"; this.ultraDockSmartPartInfo1.Pinned = true; this.ultraDockSmartPartInfo1.PreferredSize = new Size(180, 100); this.ultraDockSmartPartInfo1.Title = "Tasks"; this.ultraDockSmartPartInfo1.AllowClose = false; this.infoProvider.Items.Add(this.ultraDockSmartPartInfo1); /*this.imageListExplorerbar.ImageStream = (ImageListStreamer) manager.GetObject("imageListExplorerbar.ImageStream"); * this.imageListExplorerbar.TransparentColor = Color.Transparent; * this.imageListExplorerbar.Images.SetKeyName(0, ""); * this.imageListExplorerbar.Images.SetKeyName(1, ""); * this.imageListExplorerbar.Images.SetKeyName(2, ""); * this.imageListExplorerbar.Images.SetKeyName(3, ""); * this.imageListExplorerbar.Images.SetKeyName(4, ""); * this.imageListExplorerbar.Images.SetKeyName(5, ""); * this.imageListExplorerbar.Images.SetKeyName(6, ""); * this.imageListExplorerbar.Images.SetKeyName(7, ""); * this.imageListExplorerbar.Images.SetKeyName(8, ""); * this.imageListExplorerbar.Images.SetKeyName(9, ""); * this.imageListExplorerbar.Images.SetKeyName(10, ""); * this.imageListExplorerbar.Images.SetKeyName(11, ""); * this.imageListExplorerbar.Images.SetKeyName(12, ""); * this.imageListExplorerbar.Images.SetKeyName(13, "dataprovider.ico");*/ base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.Controls.Add(this.ultraExplorerBar1); base.Name = "TaskPanel"; ((ISupportInitialize)this.ultraExplorerBar1).EndInit(); base.ResumeLayout(false); }
private void WfIniUltraWinExplorBar(UltraExplorerBar pUbe) { try { //設定 ultraexplorbar 外觀 pUbe.NavigationPaneExpansionMode = NavigationPaneExpansionMode.OnButtonClick; pUbe.NavigationPaneFlyoutSize = new Size(175, 0); pUbe.GroupSettings.ExplorerBar.SelectedGroupChanged += ExplorerBar_SelectedGroupChanged; pUbe.NavigationOverflowButtonAreaVisible = false; //下方功能按鈕隱藏 } catch (Exception ex) { throw ex; } }
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.infoProvider = new Microsoft.Practices.CompositeUI.SmartParts.SmartPartInfoProvider(); this.ultraDockSmartPartInfo1 = new Infragistics.Practices.CompositeUI.WinForms.UltraDockSmartPartInfo(); this.ultraExplorerBar1 = new Infragistics.Win.UltraWinExplorerBar.UltraExplorerBar(); this.imageListExplorerbar = new System.Windows.Forms.ImageList(this.components); ((System.ComponentModel.ISupportInitialize)(this.ultraExplorerBar1)).BeginInit(); this.SuspendLayout(); // // ultraDockSmartPartInfo1 // this.ultraDockSmartPartInfo1.AllowClose = false; this.ultraDockSmartPartInfo1.DefaultPaneStyle = Infragistics.Win.UltraWinDock.ChildPaneStyle.VerticalSplit; this.ultraDockSmartPartInfo1.Description = "Main Menu"; this.ultraDockSmartPartInfo1.Pinned = true; this.ultraDockSmartPartInfo1.PreferredSize = new System.Drawing.Size(210, 100); this.ultraDockSmartPartInfo1.Title = "Main Menu"; this.infoProvider.Items.Add(this.ultraDockSmartPartInfo1); // // ultraExplorerBar1 // this.ultraExplorerBar1.Dock = System.Windows.Forms.DockStyle.Fill; this.ultraExplorerBar1.ImageListLarge = this.imageListExplorerbar; this.ultraExplorerBar1.ImageListSmall = this.imageListExplorerbar; this.ultraExplorerBar1.Location = new System.Drawing.Point(0, 0); this.ultraExplorerBar1.Name = "ultraExplorerBar1"; this.ultraExplorerBar1.Size = new System.Drawing.Size(345, 150); this.ultraExplorerBar1.Style = Infragistics.Win.UltraWinExplorerBar.UltraExplorerBarStyle.OutlookNavigationPane; this.ultraExplorerBar1.TabIndex = 0; // // imageListExplorerbar // this.imageListExplorerbar.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; this.imageListExplorerbar.ImageSize = new System.Drawing.Size(16, 16); this.imageListExplorerbar.TransparentColor = System.Drawing.Color.Transparent; // // MenuPanel // this.Controls.Add(this.ultraExplorerBar1); this.Name = "MenuPanel"; this.Size = new System.Drawing.Size(345, 150); ((System.ComponentModel.ISupportInitialize)(this.ultraExplorerBar1)).EndInit(); this.ResumeLayout(false); }
private void OnDragEnd(UltraExplorerBar explorerBar, bool canceled) { if (canceled == false && dragExplorerItem != null && dropExplorerItem != null) { explorerBar.BeginUpdate(); int index = dropExplorerItem.Index; explorerBar.Groups[0].Items.Remove(dragExplorerItem); explorerBar.Groups[0].Items.Insert(index, dragExplorerItem); explorerBar.EndUpdate(); UpdateCategoriesTabOrder(); RefreshTab(); } dragExplorerItem = dropExplorerItem = null; lastMouseDown = null; }
/// <summary> /// Restores a UltraExplorerBar using the provided Preferences. /// </summary> /// <param name="explorerBar">UltraExplorerBar</param> /// <param name="store">Settings</param> /// <param name="preferenceId">String. The ID the settings should come from /// (multiple sets may exist in the Preference store)</param> /// <exception cref="ArgumentNullException">If any of the parameters is null</exception> /// <exception cref="InvalidOperationException">If the collection of groups allow duplicate keys /// or any group does not have a unique key</exception> internal static void LoadExplorerBar(UltraExplorerBar explorerBar, UiStateSettings store, string preferenceId) { if (explorerBar == null) { throw new ArgumentNullException("explorerBar"); } if (store == null) { throw new ArgumentNullException("store"); } if (preferenceId == null || preferenceId.Length == 0) { throw new ArgumentNullException("preferenceId"); } if (explorerBar.Groups.AllowDuplicateKeys) { throw new InvalidOperationException("UltraExplorerBarGroupsCollection must provide unique Keys to support Load/Save settings operations."); } // explorerBar.LoadFromXml(@"D:\expl.xml"); // return; Preferences prefReader = store.GetSubnode(preferenceId); int version = prefReader.GetInt32("version", 0); // make the impl. extendable if (version < 1) { return; // wrong version } Rectangle dimensions = new Rectangle(); dimensions.X = prefReader.GetInt32("Location.X", explorerBar.Location.X); dimensions.Y = prefReader.GetInt32("Location.Y", explorerBar.Location.Y); dimensions.Width = prefReader.GetInt32("Size.Width", explorerBar.Size.Width); dimensions.Height = prefReader.GetInt32("Size.Height", explorerBar.Size.Height); if (explorerBar.Dock == DockStyle.None && explorerBar.Anchor == AnchorStyles.None) { explorerBar.Bounds = dimensions; } explorerBar.NavigationMaxGroupHeaders = prefReader.GetInt32("MaxGroupHeaders", explorerBar.NavigationMaxGroupHeaders); // no groups: nothing more to initialize if (explorerBar.Groups.Count == 0) { return; } // First handle order of groups. // build the default order array: string defaultOrder = GetKeyOrderArray(explorerBar.Groups, ";"); // read saved order: string orderArray = prefReader.GetString("groupOrder", defaultOrder); ArrayList groupOrder = new ArrayList(orderArray.Split(new char[] { ';' })); for (int i = 0; i < groupOrder.Count; i++) { string key = (string)groupOrder[i]; if (explorerBar.Groups.Exists(key) && explorerBar.Groups.IndexOf(key) != i && i < explorerBar.Groups.Count) { // restore: UltraExplorerBarGroup group = explorerBar.Groups[key]; explorerBar.Groups.Remove(group); explorerBar.Groups.Insert(i, group); } } string selectedGroup = prefReader.GetString("selected", explorerBar.SelectedGroup.Key); for (int i = 0; i < explorerBar.Groups.Count; i++) { UltraExplorerBarGroup group = explorerBar.Groups[i]; string key = String.Format("group.{0}", i); if (group.Key != null && group.Key.Length > 0) { key = String.Format("group.{0}", group.Key); } group.Visible = prefReader.GetBoolean(String.Format("{0}.Visible", key), group.Visible); if (selectedGroup == key) { group.Selected = true; } } }
public static void LoadItems(DataView dv, UltraExplorerBar explorerBar, UltraExplorerBarGroup explorerBarGroup) { foreach (DataRowView drv in dv) { long IdHerramienta = ( long )drv["IdHerramienta"]; string id = ( string )drv["id"]; System.Console.WriteLine(IdHerramienta); System.Console.WriteLine(id); if (HasChilds(dv.Table, IdHerramienta)) { UltraExplorerBarGroup newExplorerBarGroup = new UltraExplorerBarGroup(GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta)); newExplorerBarGroup.Text = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta); explorerBar.Groups.Add(newExplorerBarGroup); LoadItems(new DataView(dv.Table, string.Format("IdHerramientaPadre = {0}", drv["IdHerramienta"]), null, DataViewRowState.OriginalRows), explorerBar, newExplorerBarGroup); } else { UltraExplorerBarItem newExplorerBarItem = new UltraExplorerBarItem(id); newExplorerBarItem.Text = GetRecurso(ID_TIPO_RECURSO_TITULO, IdHerramienta); if (GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta) != string.Empty) { //German 20110329 - Tarea 0000093 ImageList ilSmall = explorerBar.ImageListSmall; string prueba = string.Format( mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" + GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "16"); Image image1 = null; try { System.Drawing.Icon c = new Icon(prueba); image1 = c.ToBitmap(); } catch (Exception e) { image1 = Image.FromFile(prueba); //int smallIndexImage = ilSmall.Images.Add( Image.FromFile( prueba), System.Drawing.Color.Magenta ); } int smallIndexImage = ilSmall.Images.Add(image1, System.Drawing.Color.Magenta); ImageList ilLarge = explorerBar.ImageListLarge; prueba = string.Format( mz.erp.systemframework.Util.ResourcePath() + "\\resources\\Icons\\" + GetRecurso(ID_TIPO_RECURSO_IMAGEN, IdHerramienta), "24"); //int largeIndexImage = ilLarge.Images.Add(Image.FromFile(prueba), System.Drawing.Color.Magenta); try { System.Drawing.Icon c = new Icon(prueba); image1 = c.ToBitmap(); } catch (Exception e) { image1 = Image.FromFile(prueba); //int smallIndexImage = ilSmall.Images.Add( Image.FromFile( prueba), System.Drawing.Color.Magenta ); } int largeIndexImage = ilLarge.Images.Add(image1, System.Drawing.Color.Magenta); //Fin German 20110329 - Tarea 0000093 newExplorerBarItem.Settings.AppearancesSmall.Appearance.Image = smallIndexImage; newExplorerBarItem.Settings.AppearancesLarge.Appearance.Image = largeIndexImage; } try { explorerBarGroup.Items.Add(newExplorerBarItem); } catch {} } } }
/*public static void Load( UltraToolbarsManager toolbar, UltraExplorerBar explorerbar) * { * _indexSeparator = 1; * Load( toolbar ); * Load( explorerbar); * }*/ public static void Load(UltraToolbarsManager toolbar, UltraExplorerBar explorerbar, UltraDockManager ultraDockManager) { _indexSeparator = 1; Load(toolbar); Load(explorerbar, ultraDockManager); }
public ExplorerBarBatchUpdateableControl(UltraExplorerBar explorerBar) { this.m_ExplorerBar = explorerBar; }
/// <summary> /// Saves a UltraExplorerBar using the provided Preferences store. /// </summary> /// <param name="explorerBar">UltraExplorerBar</param> /// <param name="store">Settings</param> /// <param name="preferenceId">String. The ID the settings should come from /// (multiple sets may exist in the Preference store)</param> /// <exception cref="ArgumentNullException">If any of the parameters is null</exception> /// <exception cref="InvalidOperationException">If the collection of groups allow duplicate keys /// or any group does not have a unique key</exception> internal static void SaveExplorerBar(UltraExplorerBar explorerBar, UiStateSettings store, string preferenceId) { if (explorerBar == null) { throw new ArgumentNullException("explorerBar"); } if (store == null) { throw new ArgumentNullException("store"); } if (string.IsNullOrEmpty(preferenceId)) { throw new ArgumentNullException("preferenceId"); } if (explorerBar.Groups.AllowDuplicateKeys) { throw new InvalidOperationException("UltraExplorerBarGroupsCollection must provide unique Keys to support Load/Save settings operations."); } // explorerBar.SaveAsXml(@"D:\expl.xml"); // return; Preferences prefWriter = store.GetSubnode(preferenceId); prefWriter.SetProperty("version", 1); // make the impl. extendable prefWriter.SetProperty("Location.X", explorerBar.Location.X); prefWriter.SetProperty("Location.Y", explorerBar.Location.Y); prefWriter.SetProperty("Size.Width", explorerBar.Size.Width); prefWriter.SetProperty("Size.Height", explorerBar.Size.Height); prefWriter.SetProperty("MaxGroupHeaders", explorerBar.NavigationMaxGroupHeaders); // no groups: nothing more to write if (explorerBar.Groups.Count == 0) { prefWriter.SetProperty("groupOrder", null); return; } // build/write the order array: prefWriter.SetProperty("groupOrder", GetKeyOrderArray(explorerBar.Groups, ";")); for (int i = 0; i < explorerBar.Groups.Count; i++) { UltraExplorerBarGroup group = explorerBar.Groups[i]; string key = String.Format("group.{0}", i); if (group.Key != null && group.Key.Length > 0) { key = String.Format("group.{0}", group.Key); } if (group.Selected) { prefWriter.SetProperty("selected", key); } prefWriter.SetProperty(String.Format("{0}.Visible", key), group.Visible); } }
private void userDataExplorerBar_DragDrop(object sender, DragEventArgs e) { UltraExplorerBar explorerBar = sender as UltraExplorerBar; OnDragEnd(explorerBar, false); }