コード例 #1
0
        private void DoListViewMouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            DevComponents.DotNetBar.Controls.ListViewEx listView = sender as DevComponents.DotNetBar.Controls.ListViewEx;
            System.Windows.Forms.ListViewItem           item     = null;
            if (item == null)
            {
                return;
            }
            switch (listView.Name)
            {
            case "listAddField":
            {
                item = listAddField.GetItemAt(e.X, e.Y);
                System.Drawing.Rectangle rec = item.GetBounds(System.Windows.Forms.ItemBoundsPortion.Entire);
                if (e.X <= listAddField.Columns[0].Width)
                {
                    m_EditObject = item;
                    Form.frmSymbolEdit frm = new GeoSymbology.Form.frmSymbolEdit(this, item.Tag as ISymbol, "");
                    frm.ShowDialog();
                }
                else if (e.X > listAddField.Columns[0].Width && e.X <=
                         listAddField.Columns[0].Width + listAddField.Columns[1].Width)
                {
                    listAddField.Items.Remove(item);
                    item.ImageKey = "";
                    listAllField.Items.Add(item);
                }
            }
            break;

            case "listAllField":
            {
                item = listAllField.GetItemAt(e.X, e.Y);
                listAllField.Items.Remove(item);
                listAddField.Items.Add(item);
                listAddField.SmallImageList.Images.Add(item.Name.Replace("Item", "Symbol"),
                                                       ModuleCommon.Symbol2Picture(item.Tag as ISymbol, ModuleCommon.ImageWidth, ModuleCommon.ImageHeight));
                item.ImageKey = item.Name.Replace("Item", "Symbol");
            }
            break;
            }
        }
コード例 #2
0
        private void DoListValueItemMouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            System.Windows.Forms.ListViewItem item = listValueItem.GetItemAt(e.X, e.Y);
            if (item == null)
            {
                return;
            }

            System.Drawing.Rectangle rec = item.GetBounds(System.Windows.Forms.ItemBoundsPortion.Entire);
            if (e.X <= listValueItem.Columns[0].Width)
            {
                //符号编辑
                m_EditObject = item;
                Form.frmSymbolEdit frm = new GeoSymbology.Form.frmSymbolEdit(this, item.Tag as ISymbol, "");
                frm.ShowDialog();
            }
            else if (e.X > listValueItem.Columns[0].Width &&
                     e.X <= (listValueItem.Columns[1].Width + listValueItem.Columns[0].Width))
            {
                m_EditObject = item.SubItems[1];
                //范围编辑
                System.Drawing.Point point = new System.Drawing.Point();
                point.X = listValueItem.Columns[0].Width;
                point.Y = rec.Top + (rec.Height - Form.frmDoubleEdit.FormWidth) / 2;
                point   = listValueItem.PointToScreen(point);
                Form.frmDoubleEdit doubleEdit = new GeoSymbology.Form.frmDoubleEdit(this,
                                                                                    (double)item.SubItems[1].Tag, point, listValueItem.Columns[1].Width, "");
                doubleEdit.Show();
            }
            else if (e.X > (listValueItem.Columns[1].Width + listValueItem.Columns[0].Width) &&
                     e.X <= (listValueItem.Columns[0].Width + listValueItem.Columns[1].Width + listValueItem.Columns[2].Width))
            {
                m_EditObject = item.SubItems[2];
                //标签编辑
                System.Drawing.Point point = new System.Drawing.Point();
                point.X = listValueItem.Columns[0].Width + listValueItem.Columns[1].Width;
                point.Y = rec.Top + (rec.Height - Form.frmStringEdit.FormWidth) / 2;
                point   = listValueItem.PointToScreen(point);
                Form.frmStringEdit stringEdit = new GeoSymbology.Form.frmStringEdit(this,
                                                                                    item.SubItems[2].Text, point, listValueItem.Columns[2].Width, "");
                stringEdit.Show();
            }
        }