private object AddTopMenuItem(MenuAction c) { if (m_BarManager != null) { var category = new BarSubItem { ImageIndex = c.SmallIconIndex, Caption = c.Caption }; category.Tag = c; MenuItemsInfo.Add(category, c); m_BarManager.Items.Add(category); if (c.ShowInToolbar) { var toolbarButton = new BarLargeButtonItem(m_BarManager, c.Caption); toolbarButton.Hint = GetToolTipText(toolbarButton.Caption); toolbarButton.ImageIndex = c.SmallIconIndex; toolbarButton.LargeImageIndex = c.BigIconIndex; toolbarButton.ButtonStyle = BarButtonStyle.DropDown; toolbarButton.DropDownControl = new PopupMenu(); toolbarButton.ShowCaptionOnBar = m_ShowButtonCaption; toolbarButton.CaptionAlignment = BarItemCaptionAlignment.Bottom; toolbarButton.PaintStyle = BarItemPaintStyle.CaptionInMenu; m_CategoryInToolbar.Add(category, toolbarButton); var bl = m_Bar.AddItem(toolbarButton); if (m_IsGroup || c.BeginGroup) { bl.BeginGroup = true; } } return(category); } return(null); }
public void InitEditToolBar() { barManager.Form = this; barManager.BeginUpdate(); //create tool and barButton var mbb = new MapBarButton(); InputTool = new mtInputPoint { MapImage = m_mapImage }; mbb.MapTool = InputTool; //create edit bar Bar editBar = new Bar(barManager, "EditBar"); editBar.OptionsBar.AllowDelete = false; editBar.OptionsBar.AllowQuickCustomization = false; editBar.OptionsBar.DisableClose = true; editBar.OptionsBar.DisableCustomization = true; editBar.DockStyle = BarDockStyle.Top; editBar.CanDockStyle = BarCanDockStyle.Top; editBar.OptionsBar.BarState = BarState.Expanded; editBar.Visible = true; editBar.DockRow = 0; editBar.DockCol = 4; editBar.ApplyDockRowCol(); editBar.AddItem(mbb); barManager.EndUpdate(); }
public void refreshProducts() { Bar bar1 = new Bar(); BarItemLink link = bar1.AddItem(btnRefresh); btnRefresh_ItemClick(new object(), new ItemClickEventArgs(btnRefresh, link)); }
private void frmPermission_Load(object sender, EventArgs e) { Bar bar1 = new Bar(); BarItemLink link = bar1.AddItem(btnRefresh); btnRefresh_ItemClick(sender, new DevExpress.XtraBars.ItemClickEventArgs(btnRefresh, link)); }
private void frmRent_Load(object sender, EventArgs e) { statusRent = new StatusRent[3]; statusRent[0] = new StatusRent(0, "Đang mượn"); statusRent[1] = new StatusRent(1, "Đã trả"); statusRent[2] = new StatusRent(2, "Quá hạn"); cmbTrangthai.Properties.Items.AddRange(statusRent); Bar bar1 = new Bar(); BarItemLink link = bar1.AddItem(btnRefresh); btnRefresh_ItemClick(sender, new DevExpress.XtraBars.ItemClickEventArgs(btnRefresh, link)); }
private void frmMain_Shown(object sender, EventArgs e) { Bar bar1 = new Bar(); BarItemLink link1 = bar1.AddItem(btnDangnhap); btnDangnhap_ItemClick(sender, new ItemClickEventArgs(btnDangnhap, link1)); btnDangxuat.Enabled = false; btnKhosach.Enabled = false; btnUsers.Enabled = false; btnLoaisach.Enabled = false; btnPermission.Enabled = false; btnRent.Enabled = false; }
private void CreateBarButtons(IMenuItem menuItem, Bar toolBar) { foreach (IMenuItem m in menuItem.SubMenus) { BarItem item = CreateButtonItem(m); if (item != null) { toolBar.AddItem(item); if (m.HasSubMenu) { throw new PluginHostException( "ToolBar does not support sub menu levels greater than 1. Please check your menu config file."); } } } }
/// <summary> /// Insert BarItem into bar. /// </summary> /// <typeparam name="T">Type of BarItem.</typeparam> /// <param name="bar">Bar</param> /// <param name="index">Index of BarItem.</param> /// <param name="caption">Caption of BarItem.</param> /// <param name="glyph">Glyph of BarItem.</param> /// <param name="key">Key of BarItem (ItemShortcut).</param> /// <param name="itemClick">ItemClick of BarItem.</param> /// <returns>Returns inserted BarItem</returns> public static T InsertBarItem <T>(this Bar bar, int index, string caption, Image glyph = null, Keys key = Keys.None, ItemClickEventHandler itemClick = null) where T : BarItem, new() { var item = new T { Caption = caption, Glyph = glyph }; if (key != Keys.None) { item.ItemShortcut = new BarShortcut(key); } if (bar.LinksPersistInfo.Count > 0 && bar.ItemLinks.Count == 0) { if (index > bar.LinksPersistInfo.Count) { index = bar.LinksPersistInfo.Count; } bar.LinksPersistInfo.Insert(index, new LinkPersistInfo(item)); } else if (bar.ItemLinks.Count > 0) { if (index > bar.ItemLinks.Count) { index = bar.ItemLinks.Count; } bar.InsertItem(bar.ItemLinks[index], item); } else { bar.AddItem(item); } //bar.ItemLinks.Insert(index, item); if (itemClick != null) { item.ItemClick += itemClick; } return(item); }
private void frmLoaisach_Load(object sender, EventArgs e) { Bar bar1 = new Bar(); BarItemLink link = bar1.AddItem(btnRefresh); btnRefresh_ItemClick(sender, new DevExpress.XtraBars.ItemClickEventArgs(btnRefresh, link)); tlLoaisach.PopulateColumns();//hien col bi an khi tro thanh parent tlLoaisach.Columns["id"].OptionsColumn.ReadOnly = true; tlLoaisach.Columns["id"].OptionsColumn.AllowEdit = false; tlLoaisach.Columns["name"].OptionsColumn.ReadOnly = true; tlLoaisach.Columns["name"].OptionsColumn.AllowEdit = false; tlLoaisach.Columns["parent_id"].OptionsColumn.ReadOnly = true; tlLoaisach.Columns["parent_id"].OptionsColumn.AllowEdit = false; tlLoaisach.Columns["description"].OptionsColumn.ReadOnly = true; tlLoaisach.Columns["description"].OptionsColumn.AllowEdit = false; gcChitiet.Enabled = false; btnGhi.Enabled = false; }
/// <summary> /// Add BarItem into bar. /// </summary> /// <typeparam name="T">Type of BarItem</typeparam> /// <param name="bar">Bar</param> /// <param name="caption">Caption of BarItem</param> /// <param name="glyph">Glyph of BarItem</param> /// <param name="key">key of BarItem (ItemShortcut).</param> /// <param name="itemClick">ItemClick of BarItem</param> /// <returns>Returns BarItem</returns> public static T AddBarItem <T>(this Bar bar, string caption, Image glyph = null, Keys key = Keys.None, ItemClickEventHandler itemClick = null) where T : BarItem, new() { var item = new T { Caption = caption, Glyph = glyph }; if (key != Keys.None) { item.ItemShortcut = new BarShortcut(key); } bar.AddItem(item); if (itemClick != null) { item.ItemClick += itemClick; } return(item); }
private void AddBarButton(dynamic toolBarButton, BarSubItem barSubItem, bool beginGroup) { BarItemLink itemLink = null; if (barSubItem != null) { itemLink = barSubItem.ItemLinks.Add(new BarButtonItem { Caption = toolBarButton.Text }); } else { itemLink = Bar.AddItem(new BarButtonItem { Caption = toolBarButton.Text }); } if (itemLink != null) { itemLink.BeginGroup = beginGroup; } }
public void InitBufZonesToolBar() { barManager.Form = this; //create map projects bar barManager.BeginUpdate(); var mapsBar = new Bar(barManager, "BufferZones"); mapsBar.OptionsBar.AllowDelete = false; mapsBar.OptionsBar.AllowQuickCustomization = false; mapsBar.OptionsBar.DisableClose = true; mapsBar.OptionsBar.DisableCustomization = true; mapsBar.DockStyle = BarDockStyle.Top; mapsBar.CanDockStyle = BarCanDockStyle.Top; mapsBar.OptionsBar.BarState = BarState.Expanded; mapsBar.Visible = true; mapsBar.DockRow = 0; mapsBar.DockCol = 4; mapsBar.ApplyDockRowCol(); //create AddBufZonesLayer tool var mbb = new MapBarButton(); CommandMapTool mCommandTool = new MtAddBufZonesLayer { MapImage = m_mapImage }; mbb.MapTool = mCommandTool; mapsBar.AddItem(mbb); //create MapSelectorTool var cmb = new RepositoryItemComboBox(); var bei = new BarEditItem(barManager, cmb) { SmallWithoutTextWidth = 90, SmallWithTextWidth = 90, Width = 90 }; if (m_ZlyrSelector != null) { m_ZlyrSelector.Dispose(); } m_ZlyrSelector = new MtZoneLayerSelector { ControlForVisualize = bei, MapControl = m_mapImage, AddBufZoneLayer = (MtAddBufZonesLayer)mCommandTool }; mapsBar.AddItem(bei); //create CircleWithCenterBufZone tool mbb = new MapBarButton(); ControllerMapTool mControllerTool = new MtCircleWithCenterBufZone { MapImage = m_mapImage, ConnectionString = ConnectionManager.DefaultInstance.ConnectionString, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //create IndependentCircleBufferZone tool mbb = new MapBarButton(); mControllerTool = new MtIndependentCircleBufferZone { MapImage = m_mapImage, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //create PolygonBufferZone tool mbb = new MapBarButton(); mControllerTool = new MtPolygonBufferZone { MapImage = m_mapImage, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent, ConnectionString = ConnectionManager.DefaultInstance.ConnectionString }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //create IndependentPolygonBufferZone tool mbb = new MapBarButton(); mControllerTool = new MtIndependentPolygonBufferZone { MapImage = m_mapImage, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //create RemoveBufZones tool mbb = new MapBarButton(); mControllerTool = new MtSelectBufZones { MapImage = m_mapImage, ZoneLayerSelector = m_ZlyrSelector, Content = m_MapContent }; mbb.MapTool = mControllerTool; mapsBar.AddItem(mbb); //var mapSelector = new MapSelector { MapControl = m_mapImage, ControlForVisualize = bei }; barManager.EndUpdate(); }
public void InitLightMapProjectToolBar() { barManager.Form = this; barManager.BeginUpdate(); #region Create GeoSearch bar var geoSearchBar = new Bar(barManager, "GeoSearch"); geoSearchBar.OptionsBar.AllowDelete = false; geoSearchBar.OptionsBar.AllowQuickCustomization = false; geoSearchBar.OptionsBar.DisableClose = true; geoSearchBar.OptionsBar.DisableCustomization = true; geoSearchBar.DockStyle = BarDockStyle.Top; geoSearchBar.CanDockStyle = BarCanDockStyle.Top; geoSearchBar.OptionsBar.BarState = BarState.Expanded; geoSearchBar.Visible = true; geoSearchBar.DockRow = 0; geoSearchBar.DockCol = 3; geoSearchBar.ApplyDockRowCol(); //create MapSelectorTool var beGeoSearch = new RepositoryItemButtonEdit(); //beGeoSearch.Buttons[0].ToolTip = "Search for administrative unit"; beGeoSearch.Buttons[0].Kind = ButtonPredefines.Glyph; beGeoSearch.Buttons[0].Caption = "Search"; var toolTipTitle = new ToolTipTitleItem(); toolTipTitle.Text = EidssMessages.GetForCurrentLang("gis_Geosearch_Tooltip", "Search for administrative unit"); //"Search for administrative unit"; var superToolTip = new SuperToolTip(); superToolTip.Items.Add(toolTipTitle); var beiGeoSearch = new BarEditItem(barManager, beGeoSearch) { SmallWithoutTextWidth = 130, SmallWithTextWidth = 130, Width = 130, SuperTip = superToolTip }; m_GeoSearch = new GeoSearch { MapControl = m_mapImage, ControlForVisualize = beiGeoSearch }; geoSearchBar.AddItem(beiGeoSearch); beiGeoSearch.Visibility = BarItemVisibility.Always; beGeoSearch.ButtonClick += beGeoSearch_ButtonClick; #endregion //create map projects bar var mapsBar = new Bar(barManager, "MapProjects"); mapsBar.OptionsBar.AllowDelete = false; mapsBar.OptionsBar.AllowQuickCustomization = false; mapsBar.OptionsBar.DisableClose = true; mapsBar.OptionsBar.DisableCustomization = true; mapsBar.DockStyle = BarDockStyle.Top; mapsBar.CanDockStyle = BarCanDockStyle.Top; mapsBar.OptionsBar.BarState = BarState.Expanded; mapsBar.Visible = true; mapsBar.DockRow = 0; mapsBar.DockCol = 0; mapsBar.ApplyDockRowCol(); //create ExportImage Tool var mbb = new MapBarButton(); var mTool = new MtExportAsImage { MapImage = m_mapImage }; mbb.MapTool = mTool; mapsBar.AddItem(mbb); //create Admin filter Tool mbb = new MapBarButton(); var mTool1 = new MtAdminMask() { MapImage = m_mapImage }; mbb.MapTool = mTool1; mapsBar.AddItem(mbb); //create MapSelectorTool var cmb = new RepositoryItemComboBox(); var bei = new BarEditItem(barManager, cmb); bei.SmallWithoutTextWidth = 118; bei.SmallWithTextWidth = 118; bei.Width = 118; if (m_MapSelector != null) { m_MapSelector.Dispose(); } m_MapSelector = new MapSelector { MapControl = m_mapImage, ControlForVisualize = bei, Content = m_MapContent }; m_MapSelector.MapChanging += m_MapSelector_MapChanging; mapsBar.AddItem(bei); barManager.EndUpdate(); }
private void method_5(Bar bar_0, ICommand icommand_0, bool bool_1, int int_0) { if (icommand_0 is ICommandSubType) { (icommand_0 as ICommandSubType).SetSubType(int_0); } icommand_0.OnCreate(this.iframework_0.Application); if (icommand_0 is IToolContextMenu) { (icommand_0 as IToolContextMenu).PopuMenu = this.ipopuMenuWrap_0; } string name = icommand_0.Name; if ((icommand_0 is ICommandLine) && ((icommand_0 as ICommandLine).CommandName != null)) { name = (icommand_0 as ICommandLine).CommandName; } BarItem item = null; item = this.barManager_0.Items[name]; if (item == null) { if (icommand_0 is IBarEditItem) { if ((icommand_0 as IBarEditItem).Style == BarEditStyle.ComboBoxEdit) { item = new BarEditItem(); RepositoryItemComboBox box = new RepositoryItemComboBox(); (item as BarEditItem).Edit = box; box.AutoHeight = false; box.Name = icommand_0.Name + "_ItemComboBox"; (icommand_0 as IBarEditItem).BarEditItem = new YTComboxBarItem(item); item.Width = (icommand_0 as IBarEditItem).Width; } else { if ((icommand_0 as IBarEditItem).Style != BarEditStyle.ButtonEdit) { return; } item = new BarButtonItem(); (icommand_0 as IBarEditItem).BarEditItem = new JLKButtonBarItem(item); item.Width = (icommand_0 as IBarEditItem).Width; } } else if (icommand_0 is IToolControl) { item = new BarButtonItem(); } else { item = new BarButtonItem(); } this.barManager_0.Items.Add(item); item.Id = this.barManager_0.GetNewItemId(); item.Name = name; item.Tag = icommand_0; item.Caption = icommand_0.Caption; if (icommand_0 != null) { BarManagerCategory category; if (icommand_0.Tooltip != null) { item.Hint = icommand_0.Tooltip; } else if (icommand_0.Caption != null) { item.Hint = icommand_0.Caption; } if (icommand_0 is IShortcut) { item.ItemShortcut = new BarShortcut((icommand_0 as IShortcut).Keys); } if (icommand_0.Bitmap != 0) { try { IntPtr hbitmap = new IntPtr(icommand_0.Bitmap); Bitmap bitmap = Image.FromHbitmap(hbitmap); bitmap.MakeTransparent(); item.Glyph = bitmap; } catch { } } if (icommand_0.Category != null) { if (icommand_0.Category.Length > 0) { category = this.barManager_0.Categories[icommand_0.Category]; if (category == null) { category = new BarManagerCategory(icommand_0.Category, Guid.NewGuid()); this.barManager_0.Categories.Add(category); } item.Category = category; } else { category = this.barManager_0.Categories["其他"]; if (category == null) { category = new BarManagerCategory("其他", Guid.NewGuid()); this.barManager_0.Categories.Add(category); } item.Category = category; } } else { category = this.barManager_0.Categories["其他"]; if (category == null) { category = new BarManagerCategory("其他", Guid.NewGuid()); this.barManager_0.Categories.Add(category); } item.Category = category; } } } BarItemLink link = bar_0.AddItem(item); if (link != null) { link.BeginGroup = bool_1; } }