/// <summary> /// 功能按钮的双机事件处理 /// </summary> /// <param name="sender"></param>` /// <param name="e"></param> void imageListBoxControl1_DoubleClick(object sender, EventArgs e) { ImageListBoxControl ilist = (sender as ImageListBoxControl); DataRowView view = ilist.SelectedItem as DataRowView; if (view != null) { string action = view["CmdName"].ToString(); using (CActionFunction af = new CActionFunction(this.CurrentBusiness, this.Activitie)) { // af.Listguidelines(af, this); Type objectType = af.GetType(); MethodInfo o_Methods = objectType.GetMethod(action); if (o_Methods != null) { object[] args = new object[2]; args[0] = this.m_TopLevelForm; args[1] = this.m_Activitie; o_Methods.Invoke(af, args); //af.Measures_Del(af, args); //af.IncreaseCosts(MainForm, APP.General.CurrentProject); //执行指定的方法 } else { MsgBox.Alert("对不起,此功能不存在请联系系统维护人员!"); } } } }
/// <summary> /// Adds the table to ListBox. /// </summary> /// <param name="pWorkspace">The p workspace.</param> /// <param name="imageListBoxControl1">The image ListBox control1.</param> public static void AddTableToListBox(IWorkspace pWorkspace, ImageListBoxControl imageListBoxControl1) { if (pWorkspace != null) { IconType iconType = IconType.Table; IEnumDatasetName enumDatasetName = pWorkspace.get_DatasetNames(esriDatasetType.esriDTTable); try { enumDatasetName.Reset(); IDatasetName datasetName; while ((datasetName = enumDatasetName.Next()) != null) { ITableName tableName = datasetName as ITableName; if (tableName != null) { ControlAPI.AddItemToListBox(iconType, datasetName.Name, imageListBoxControl1); } } } finally { Marshal.ReleaseComObject(enumDatasetName); } } }
private void imageListBoxControlSymbol_MouseMove(object sender, MouseEventArgs e) { try { ImageListBoxControl list = (ImageListBoxControl)sender; if (e.Button == System.Windows.Forms.MouseButtons.Left && m_IsAllowDrop) { ListBoxItem lbi = list.SelectedItem as ListBoxItem; list.HotTrackItems = false; KeyValuePair<string, object> data = new KeyValuePair<string, object>(lbi.Value.ToString(), ElementType.Text); if (!string.IsNullOrEmpty(data.Key)) { list.DoDragDrop(data, DragDropEffects.All); } } else { list.HotTrackItems = true; } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// Opens the geodatabase. /// </summary> /// <param name="sPath">The s path.</param> /// <param name="imageListBoxControl1">The image ListBox control1.</param> /// <param name="type">The type.</param> /// <param name="pWorkspaceList">The p workspace list.</param> /// <param name="geometryType">Type of the geometry.</param> /// <param name="bAppend">if set to <c>true</c> [b append].</param> /// <param name="bAddTable">if set to <c>true</c> [b add table].</param> public static void OpenGeodatabase(string sPath, ImageListBoxControl imageListBoxControl1, DataType type, List <WorkspaceInfo> pWorkspaceList, esriGeometryType geometryType, bool bAppend = false, bool bAddTable = false) { IWorkspace workspace = ControlAPI.GetWorkspace(sPath, type, pWorkspaceList); if (workspace != null) { imageListBoxControl1.BeginUpdate(); try { if (!bAppend) { imageListBoxControl1.Items.Clear(); } if (workspace != null) { ControlAPI.AddFeatureDatasetToListBox(workspace, imageListBoxControl1, type); ControlAPI.AddFeatureClassToListBox(workspace, imageListBoxControl1, type, geometryType); if (bAddTable) { ControlAPI.AddTableToListBox(workspace, imageListBoxControl1); } } } finally { imageListBoxControl1.EndUpdate(); } } }
public static void OpenGeodatabase(string sPath, ImageListBoxControl imageListBoxControl1, DataType type, List <WorkspaceInfo> pWorkspaceList, esriGeometryType geometryType, bool bAppend = false, bool bAddTable = false) { IWorkspace workspace = ControlAPI.GetWorkspace(sPath, type, pWorkspaceList); imageListBoxControl1.BeginUpdate(); try { if (!bAppend) { imageListBoxControl1.Items.Clear(); } if (workspace != null) { ControlAPI.AddFeatureDatasetToListBox(workspace, imageListBoxControl1, type); ControlAPI.AddFeatureClassToListBox(workspace, imageListBoxControl1, type, geometryType); if (bAddTable) { ControlAPI.AddTableToListBox(workspace, imageListBoxControl1); } } } catch { XtraMessageBox.Show("无效的数据,加载数据失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } finally { imageListBoxControl1.EndUpdate(); } }
/// <summary> /// Adds the feature class to ListBox. /// </summary> /// <param name="pWorkspace">The p workspace.</param> /// <param name="imageListBoxControl1">The image ListBox control1.</param> /// <param name="dataType">Type of the data.</param> /// <param name="geometryType">Type of the geometry.</param> public static void AddFeatureClassToListBox(IWorkspace pWorkspace, ImageListBoxControl imageListBoxControl1, DataType dataType, esriGeometryType geometryType) { if (pWorkspace != null) { IEnumDatasetName pEnumDatasetName = pWorkspace.get_DatasetNames(esriDatasetType.esriDTFeatureClass); ControlAPI.AddFeatureClassToListBox(pEnumDatasetName, imageListBoxControl1, dataType, geometryType); } }
/// <summary> /// Adds the item to ListBox. /// </summary> /// <param name="iconType">Type of the icon.</param> /// <param name="sValue">The s value.</param> /// <param name="imageListBoxControl1">The image ListBox control1.</param> public static void AddItemToListBox(IconType iconType, string sValue, ImageListBoxControl imageListBoxControl1) { ImageListBoxItem imageListBoxItem = new ImageListBoxItem(); imageListBoxItem.ImageIndex = (int)iconType; imageListBoxItem.Value = sValue; imageListBoxControl1.Items.Add(imageListBoxItem); }
public override void Assign(RepositoryItem item) { base.Assign(item); if (item is RepositoryItemMyPopupContainerEdit) { imageListBox = ((RepositoryItemMyPopupContainerEdit)item).ListBox; } }
/// <summary> /// Lists the SHP files. /// </summary> /// <param name="sPath">The s path.</param> /// <param name="imageListBoxControl1">The image ListBox control1.</param> /// <param name="pWorkspaceList">The p workspace list.</param> /// <param name="geometryType">Type of the geometry.</param> public static void ListShpFiles(string sPath, ImageListBoxControl imageListBoxControl1, List <WorkspaceInfo> pWorkspaceList, esriGeometryType geometryType) { string[] files = Directory.GetFiles(sPath, "*.shp"); if (files != null && files.Length != 0) { IWorkspace workspace = ControlAPI.GetWorkspace(sPath, DataType.shp, pWorkspaceList); ControlAPI.AddFeatureClassToListBox(workspace, imageListBoxControl1, DataType.shp, geometryType); } }
public static void AddFeatureDatasetToListBox(IWorkspace pWorkspace, ImageListBoxControl imageListBoxControl1, DataType type) { if (pWorkspace != null) { List <string> list = new List <string>(); IEnumDatasetName enumDatasetName = pWorkspace.get_DatasetNames(esriDatasetType.esriDTFeatureDataset); try { enumDatasetName.Reset(); IDatasetName datasetName; while ((datasetName = enumDatasetName.Next()) != null) { list.Add(datasetName.Name); } } finally { if (enumDatasetName != null) { Marshal.ReleaseComObject(enumDatasetName); } } list.Sort(); IconType iconType = IconType.FGDBDataset; if (type <= DataType.sde) { if (type != DataType.mdb) { if (type == DataType.sde) { iconType = IconType.SDEDataset; } } else { iconType = IconType.PGDBDataset; } } else if (type != DataType.cad) { if (type == DataType.coverage) { iconType = IconType.Coverage; } } else { iconType = IconType.Cad; } foreach (string current in list) { ControlAPI.AddItemToListBox(iconType, current, imageListBoxControl1); } } }
public RepositoryItemMyPopupContainerEdit() { PopupContainerControl popupControl = new PopupContainerControl(); imageListBox = new ImageListBoxControl(); imageListBox.Dock = System.Windows.Forms.DockStyle.Fill; imageListBox.HotTrackItems = true; imageListBox.HotTrackSelectMode = HotTrackSelectMode.SelectItemOnClick; popupControl.Controls.Add(imageListBox); PopupControl = popupControl; TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; }
/// <summary> /// 初始化主程序类 /// </summary> /// <param name="barList">工具条列表</param> /// <param name="appMenu">开始菜单</param> /// <param name="frameMenu">图框菜单</param> /// <param name="lyrMenu">图层菜单</param> /// <param name="rgbMenu">波段组合菜单</param> /// <param name="layerItem">图层选择控件</param> /// <param name="sptItem">状态栏坐标系</param> /// <param name="xyItem">状态栏坐标</param> /// <param name="rasterItem">状态栏栅格信息</param> /// <param name="swipeItem">卷帘按钮</param> /// <param name="eagleItem">鹰眼按钮</param> /// <param name="dpEagle">鹰眼控件</param> /// <param name="lstRecentFiles">最近历史控件</param> /// <param name="tableContainer">属性表容器</param> public void Initialize(List <Bar> barList, ApplicationMenu appMenu, PopupMenu frameMenu, PopupMenu lyrMenu, PopupMenu rgbMenu, BarEditItem layerItem, BarItem sptItem, BarItem xyItem, BarItem rasterItem, BarItem swipeItem, BarButtonItem eagleItem, DockPanel dpEagle, ImageListBoxControl lstRecentFiles, ControlContainer tableContainer) { MapAPI.NewDocument(); this._barList = barList; this._appMenu = appMenu; this._popMenuFrame = frameMenu; this._popMenuLayer = lyrMenu; this._popMenuRGB = rgbMenu; this._barEditLyList = layerItem; this._barItemSwipe = swipeItem; this._layerEffectProperties = new CommandsEnvironmentClass(); this._barItemSPt = sptItem; this._barItemXY = xyItem; this._barItemRaster = rasterItem; this._barEagle = eagleItem; this._dpEagle = dpEagle; this._lstRecently = lstRecentFiles; //EnviVars.instance.TablePanel = tablePanel; EnviVars.instance.TableContainer = tableContainer; EnviVars.instance.RecentFilesCtrl = lstRecentFiles; history = new TaskHistory(ConstDef.FILE_RENCENTFILES, 5); EnviVars.instance.history = history; history.LoadHistory(); _eagleEye = new MapControlEagle(this._mapControl as IMapControl4, this._mapControlEagle as IMapControl4); this._barEagle.ItemClick += new ItemClickEventHandler(this._barEagle_ItemClick); lstRecentFiles.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lstRecently_MouseClick); this._barEditLyList.EditValueChanged += new EventHandler(this.barEditLyList_EditValueChanged); //绑定工具条按钮事件 IEnumerator enumerator; foreach (Bar current in barList) { enumerator = current.ItemLinks.GetEnumerator(); this.GetContainerCommandList(enumerator); } //绑定开始菜单按钮事件 enumerator = appMenu.ItemLinks.GetEnumerator(); this.GetContainerCommandList(enumerator); //绑定图框菜单按钮事件 enumerator = frameMenu.ItemLinks.GetEnumerator(); this.GetContainerCommandList(enumerator); //绑定图层菜单按钮事件 enumerator = lyrMenu.ItemLinks.GetEnumerator(); this.GetContainerCommandList(enumerator); }
/// <summary> /// 加载自定义报表 /// </summary> /// <param name="menuReports">报表菜单</param> /// <param name="lbReports">报表项显示控件</param> protected void LoadReportList(ToolStripMenuItem menuReports, ImageListBoxControl lbReports) { lbReports.ImageList = this.ilReports; foreach (ToolStripItem item in menuReports.DropDownItems) { if (item is ToolStripSeparator) { continue; } lbReports.Items.Add(new ItemObject(item.Text, item), 0); } lbReports.Click += new EventHandler(OnReportsClick); }
private void imageListBoxControl1_SelectedIndexChanged(object sender, EventArgs e) { ImageListBoxControl ilist = (sender as ImageListBoxControl); if (ilist.SelectedItem != null) { DataRowView view = ilist.SelectedItem as DataRowView; this.textEdit1.Text = view["Remark"].ToString(); this.simpleButton1.Enabled = true; } else { this.textEdit1.Text = string.Empty; this.simpleButton1.Enabled = false; } }
public static void ListE00Files(string sPath, ImageListBoxControl imageListBoxControl1) { DirectoryInfo directoryInfo = new DirectoryInfo(sPath); FileInfo[] files = directoryInfo.GetFiles("*.e00"); if (files != null && files.Length != 0) { FileInfo[] array = files; for (int i = 0; i < array.Length; i++) { FileInfo fileInfo = array[i]; if (!fileInfo.FullName.Contains(' ')) { ControlAPI.AddItemToListBox(IconType.E00, fileInfo.Name, imageListBoxControl1); } } } }
private void imageListBoxControlSymbol_MouseDown(object sender, MouseEventArgs e) { try { ImageListBoxControl list = (ImageListBoxControl)sender; if (e.Button == MouseButtons.Left) { m_IsAllowDrop = true; } else { m_IsAllowDrop = false; } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 功能按钮的双机事件处理 /// </summary> /// <param name="sender"></param>` /// <param name="e"></param> void imageListBoxControl1_DoubleClick(object sender, EventArgs e) { ImageListBoxControl ilist = (sender as ImageListBoxControl); DataRowView view = ilist.SelectedItem as DataRowView; if (view != null) { string action = view["CmdName"].ToString(); using (CActionFunction af = new CActionFunction(this.CurrentBusiness, this.Activitie)) { switch (action) { case "ImportEXcel": af.ImportEXcel(this.BusContainer, p_Params); return; default: Type objectType = af.GetType(); MethodInfo o_Methods = objectType.GetMethod(action); if (o_Methods != null) { object[] args = new object[2]; args[0] = this.BusContainer; //主窗体 args[1] = p_Params; // o_Methods.Invoke(af, args); //af.MobToFB(this.BusContainer, args); //af.IncreaseCosts(MainForm, APP.General.CurrentProject); //执行指定的方法 } else { MessageBox.Show("对不起,此功能不存在请联系系统维护人员!"); } return; } // af.Listguidelines(af, this); } } }
private void ImageListBox_MouseDown(object sender, MouseEventArgs e) { switch (e.Button) { case MouseButtons.Left: { ImageListBoxControl listBox = sender as ImageListBoxControl; int index = listBox.IndexFromPoint(e.Location); if (index != -1) { string[] chars = { ">", "<", "=", "image", ".png" }; TextBoxMessage.Text += $":{ImageListBox.SelectedItem.ToString().ReplaceAll(chars, string.Empty)}:"; ImageListBox.Visible = false; } break; } } }
/// <summary> /// 双击备选项,添加到选择结果 /// 双击选择结果,移除双击项 /// </summary> private void imgList_DoubleClick(object sender, EventArgs e) { ImageListBoxControl imgListBox = sender as ImageListBoxControl; MouseEventArgs mea = e as MouseEventArgs; if (imgListBox == null || mea == null) { return; } ListBoxItem listBoxItem = imgListBox.SelectedItem as ListBoxItem; if (listBoxItem == null) { return; } if (object.ReferenceEquals(imgListBox, imgListAll)) { AddFromImgListAll(); } else if (object.ReferenceEquals(imgListBox, imgListSelectResult)) { RemoveCurSelect(); } }
private void imageListBoxControl1_SelectedIndexChanged(object sender, EventArgs e) { ImageListBoxControl ilist = (sender as ImageListBoxControl); if (ilist.SelectedItem != null) { DataRowView view = ilist.SelectedItem as DataRowView; this.textEdit1.Text = view["Remark"].ToString(); // if (view["CmdName"].ToString() == "5" || view["CmdName"].ToString() == "4") // { // this.textEdit2.Visible = false; // this.buttonEdit1.Visible = true; // } // else // { // this.textEdit2.Visible = true; // this.buttonEdit1.Visible = false; // } } else { this.textEdit1.Text = string.Empty; } }
//----------------------------------------------------------------------------------------------- /// <summary> /// Open the folder. /// </summary> /// <param name="sPath">The s path.</param> /// <param name="imageListBoxControl1">The image ListBox control1.</param> /// <param name="type">The type.</param> /// <param name="pWorkspaceList">The p workspace list.</param> /// <param name="geometryType">Type of the geometry.</param> public static void OpenFolder(string sPath, ImageListBoxControl imageListBoxControl1, DataType type, List <WorkspaceInfo> pWorkspaceList, esriGeometryType geometryType) { imageListBoxControl1.BeginUpdate(); imageListBoxControl1.Items.Clear(); DirectoryInfo directoryInfo = new DirectoryInfo(sPath); DirectoryInfo[] directories = directoryInfo.GetDirectories(); SortedDictionary <string, IconType> sortedDictionary = new SortedDictionary <string, IconType>(); List <string> list = null; if (type == DataType.all || (type & DataType.raster) == DataType.raster) { list = ControlAPI.GetRasterNames(sPath, pWorkspaceList); } DirectoryInfo[] array = directories; for (int i = 0; i < array.Length; i++) { DirectoryInfo directoryInfo2 = array[i]; if ((directoryInfo2.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden) { if (directoryInfo2.Name.EndsWith(".gdb", StringComparison.CurrentCultureIgnoreCase)) { if (type == DataType.all || (type & DataType.gdb) == DataType.gdb) { sortedDictionary.Add(directoryInfo2.Name, IconType.FGDB); } } else if (list == null || !list.Contains(directoryInfo2.Name)) { ControlAPI.AddItemToListBox(IconType.Folder, directoryInfo2.Name, imageListBoxControl1); } } } if (type == DataType.all || (type & DataType.mdb) == DataType.mdb) { FileInfo[] files = directoryInfo.GetFiles("*.mdb"); FileInfo[] array2 = files; for (int i = 0; i < array2.Length; i++) { FileInfo fileInfo = array2[i]; sortedDictionary.Add(fileInfo.Name, IconType.PGDB); } } foreach (KeyValuePair <string, IconType> current in sortedDictionary) { ControlAPI.AddItemToListBox(current.Value, current.Key, imageListBoxControl1); } if (list != null && list.Count > 0) { foreach (string current2 in list) { ControlAPI.AddItemToListBox(IconType.RasterDataset, current2, imageListBoxControl1); } } if (type == DataType.all || (type & DataType.shp) == DataType.shp) { ControlAPI.ListShpFiles(sPath, imageListBoxControl1, pWorkspaceList, geometryType); } if (type == DataType.all || (type & DataType.cad) == DataType.cad) { ControlAPI.OpenGeodatabase(sPath, imageListBoxControl1, DataType.cad, pWorkspaceList, geometryType, true, false); } imageListBoxControl1.EndUpdate(); }
/// <summary> /// Yıllık döküm raporu /// </summary> /// <param name="lstRaporElemanlari"></param> /// <param name="raporYili"></param> /// <returns></returns> public string YillikDokum(ImageListBoxControl lstRaporElemanlari, int raporYili) { var htmlTable = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>Yıllık Döküm</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->" + "<title>Yıllık Döküm</title>" + "<style>" + //"table,td,tr {border:1px solid #474747;}" + "th {text-align:center; font-weight:bold;}" + "</style>" + "</head>" + "<body>" + "<table>" + "<tr>" + string.Format("<th colspan='{0}'>", lstRaporElemanlari.ItemCount + 7) + string.Format("BOZDOĞAN İLÇE J.K.LIĞI {0} YILINDA MEYDANA GELEN OLAYLAR ÇİZELGESİ", raporYili) + "</th>" + "</tr>" + "<tr style='mso-height-source:userset;height:55pt'>"; // : Başlıklar htmlTable += "<th>"; htmlTable += string.Format("{0} YILI OLAY SAYISI", raporYili); htmlTable += "</th>"; for (var i = 0; i < lstRaporElemanlari.ItemCount; i++) { htmlTable += "<th>"; htmlTable += lstRaporElemanlari.Items[i].ToString(); htmlTable += "</th>"; } htmlTable += "<th>"; htmlTable += "TOPLAM"; htmlTable += "</th>"; // : Geçmiş Rapor Yılları var gecmisRaporYillari = raporYili; for (var i = 0; i < 5; i++) { gecmisRaporYillari = gecmisRaporYillari - 1; htmlTable += "<th style='background-color: #59b4cc; vertical-align:middle; text-align:center; width:48pt'>"; htmlTable += gecmisRaporYillari + " YILI AYLIK OLAY SAYISI"; htmlTable += "</th>"; } htmlTable += "</tr>"; using (var db = new ETSEntities()) { // : Aylar for (var i = 1; i < 13; i++) { htmlTable += "<tr>"; htmlTable += "<td style='background-color: #73FF9D;' width='30px' style='text-align:center;'>"; htmlTable += AyinAdiAl(i); htmlTable += "</td>"; gecmisRaporYillari = raporYili; // : Aylara ait veriler for (var j = 0; j < lstRaporElemanlari.ItemCount + 6; j++) { // : Rapor elemanları istatistikleri if (j < lstRaporElemanlari.ItemCount) { var raporElemani = lstRaporElemanlari.Items[j].ToString(); htmlTable += "<td width='30px' style='text-align:center;'>"; htmlTable += db.OlaylarBilgisi.Count(c => c.Tasnifler.Baslik.Equals(raporElemani) && c.OlayTarihi.Month == i && c.OlayTarihi.Year == raporYili); htmlTable += "</td>"; } // : Toplam satırı if (j == lstRaporElemanlari.ItemCount) { htmlTable += "<td width='30px' style='text-align:center;'>"; htmlTable += db.OlaylarBilgisi.Count(c => c.OlayTarihi.Month == i && c.OlayTarihi.Year == raporYili); htmlTable += "</td>"; } // : Geçmiş yıllar verileri if (j >= lstRaporElemanlari.ItemCount + 1) { gecmisRaporYillari = gecmisRaporYillari - 1; htmlTable += "<td width='30px' style='text-align:center;'>"; htmlTable += db.OlaylarBilgisi.Count(c => c.OlayTarihi.Year == gecmisRaporYillari && c.OlayTarihi.Month == i); htmlTable += "</td>"; } } htmlTable += "</tr>"; } // : Toplamlar satırı htmlTable += "<tr>"; htmlTable += "<td style='background-color: #e1e1e1;' width='30px' style='text-align:center;'>"; htmlTable += "TOPLAM"; htmlTable += "</td>"; gecmisRaporYillari = raporYili; for (var j = 0; j < lstRaporElemanlari.ItemCount + 6; j++) { // : Rapor elemanları toplamları if (j < lstRaporElemanlari.ItemCount) { var raporElemani = lstRaporElemanlari.Items[j].ToString(); htmlTable += "<td width='30px' style='text-align:center;'>"; htmlTable += db.OlaylarBilgisi.Count(c => c.Tasnifler.Baslik.Equals(raporElemani) && c.OlayTarihi.Year == raporYili); htmlTable += "</td>"; } // : Toplam satırı if (j == lstRaporElemanlari.ItemCount) { htmlTable += "<td width='30px' style='text-align:center;'>"; htmlTable += db.OlaylarBilgisi.Count(c => c.OlayTarihi.Year == raporYili); htmlTable += "</td>"; } // : Geçmiş yıllar toplamları if (j >= lstRaporElemanlari.ItemCount + 1) { gecmisRaporYillari = gecmisRaporYillari - 1; htmlTable += "<td style='background-color: #FFD966;' width='30px' style='text-align:center;'>"; htmlTable += db.OlaylarBilgisi.Count(c => c.OlayTarihi.Year == gecmisRaporYillari); htmlTable += "</td>"; } } htmlTable += "</tr>"; } htmlTable += "</table>"; htmlTable += "</body>"; htmlTable += "</html>"; return(htmlTable); }
protected override void Apply(object obj, string objectName) { if (objectName == "") { return; } string objectText = ""; System.Reflection.PropertyInfo pinfo = obj.GetType().GetProperty("HeaderTitle"); if (pinfo == null && obj is RepositoryItemButtonEdit) { pinfo = obj.GetType().GetProperty("NullText"); } if (pinfo == null) { pinfo = obj.GetType().GetProperty("Caption"); } if (pinfo == null) { pinfo = obj.GetType().GetProperty("Text"); } if (pinfo == null) { pinfo = obj.GetType().GetProperty("Description"); } if (pinfo == null && obj is ISeries) { pinfo = obj.GetType().GetProperty("Name"); } if (pinfo == null && obj is TreeList) { pinfo = obj.GetType().GetProperty("Name"); } if (pinfo == null) { return; } if (_localizer != null) { objectText = _localizer.GetLocalizedText(objectName); } if (objectText == "" && objectName.IndexOf("_") != -1) { objectText = _localizer.GetLocalizedText(objectName.Substring(0, objectName.IndexOf("_"))); } if (objectText != null && obj is TreeList) { string[] node = objectText.Split(','); if (node.Length == (obj as TreeList).Nodes.Count) { TreeList t = (obj as TreeList); for (int i = 0; i < t.Nodes.Count; i++) { t.SetRowCellValue(t.Nodes[i], t.Columns[0], node[i]); } } } if (objectText != null && obj is ImageListBoxControl) { string[] node = objectText.Split(','); if (node.Length == (obj as ImageListBoxControl).ItemCount) { ImageListBoxControl t = (obj as ImageListBoxControl); for (int i = 0; i < t.ItemCount; i++) { t.Items[i].Value = node[i]; //t.SetRowCellValue(t.Nodes[i], t.Columns[0], node[i]); } } } if (objectText != null && obj is ComboBoxEdit) { string[] itms = objectText.Split(','); if (itms.Length == (obj as ComboBoxEdit).Properties.Items.Count) { for (int i = 0; i < (obj as ComboBoxEdit).Properties.Items.Count; i++) { (obj as ComboBoxEdit).Properties.Items[i] = itms[i]; } } } if (objectText != "" && pinfo.CanWrite) { pinfo.SetValue(obj, objectText); } }
/// <summary> /// Adds the feature class to ListBox. /// </summary> /// <param name="pEnumDatasetName">Name of the p enum dataset.</param> /// <param name="imageListBoxControl1">The image ListBox control1.</param> /// <param name="dataType">Type of the data.</param> /// <param name="geometryType">Type of the geometry.</param> public static void AddFeatureClassToListBox(IEnumDatasetName pEnumDatasetName, ImageListBoxControl imageListBoxControl1, DataType dataType, esriGeometryType geometryType) { if (pEnumDatasetName != null) { IconType value = IconType.PGDBAnnotation; IconType value2 = IconType.PGDBPoint; IconType value3 = IconType.PGDBLine; IconType value4 = IconType.PGDBPolygon; if (dataType <= DataType.gdb) { if (dataType != DataType.shp) { if (dataType == DataType.gdb) { value = IconType.FGDBAnnotation; value2 = IconType.FGDBPoint; value3 = IconType.FGDBLine; value4 = IconType.FGDBPolygon; } } else { value2 = IconType.ShpPoint; value3 = IconType.ShpLine; value4 = IconType.ShpPolygon; } } else if (dataType != DataType.sde) { if (dataType != DataType.cad) { if (dataType == DataType.coverage) { value = IconType.CovAnnotation; value2 = IconType.CovPoint; value3 = IconType.CovArc; value4 = IconType.CovPolygon; } } else { value = IconType.CadAnnotation; value2 = IconType.CadPoint; value3 = IconType.CadLine; value4 = IconType.CadPolygon; } } else { value = IconType.SDEAnnotation; value2 = IconType.SDEPoint; value3 = IconType.SDELine; value4 = IconType.SDEPolygon; } SortedDictionary <string, IconType> sortedDictionary = new SortedDictionary <string, IconType>(); try { pEnumDatasetName.Reset(); IDatasetName datasetName; while ((datasetName = pEnumDatasetName.Next()) != null) { IFeatureClassName featureClassName = datasetName as IFeatureClassName; if (featureClassName != null) { if (geometryType == esriGeometryType.esriGeometryAny || geometryType == featureClassName.ShapeType) { if (featureClassName.FeatureType == esriFeatureType.esriFTAnnotation || featureClassName.FeatureType == esriFeatureType.esriFTCoverageAnnotation) { sortedDictionary.Add(datasetName.Name, value); } else if (featureClassName.FeatureType == esriFeatureType.esriFTSimple) { switch (featureClassName.ShapeType) { case esriGeometryType.esriGeometryPoint: case esriGeometryType.esriGeometryMultipoint: sortedDictionary.Add(datasetName.Name, value2); break; case esriGeometryType.esriGeometryPolyline: sortedDictionary.Add(datasetName.Name, value3); break; case esriGeometryType.esriGeometryPolygon: sortedDictionary.Add(datasetName.Name, value4); break; case esriGeometryType.esriGeometryMultiPatch: sortedDictionary.Add(datasetName.Name, IconType.CadMultiPatch); break; } } } } } } finally { Marshal.ReleaseComObject(pEnumDatasetName); } foreach (KeyValuePair <string, IconType> current in sortedDictionary) { ControlAPI.AddItemToListBox(current.Value, current.Key, imageListBoxControl1); } } }
/// <summary> /// 加载自定义报表 /// </summary> /// <param name="menuReports">报表菜单</param> /// <param name="lbReports">报表项显示控件</param> protected void LoadReportList(ToolStripMenuItem menuReports, ImageListBoxControl lbReports) { lbReports.ImageList = this.ilReports; foreach (ToolStripItem item in menuReports.DropDownItems) { if (item is ToolStripSeparator) continue; lbReports.Items.Add(new ItemObject(item.Text, item), 0); } lbReports.Click += new EventHandler(OnReportsClick); }