コード例 #1
0
ファイル: setlist.cs プロジェクト: jameschnbass/Git_DataBase
        public static void set_list (HTuple hv_RowEdge, HTuple hv_ColumnEdge, HTuple hv_Amplitude, HTuple hv_Distance, System.Windows.Forms.ListView listView) {

            listView.BeginUpdate();   //数据更新,UI暂时挂起,直到EndUpdate绘制控件,可以有效避免闪烁并大大提高加载速度  
            listView.Items.Clear();
            for (int i = 0; i < hv_RowEdge.Length; i++) {

                string i_string = Convert.ToString(i);

                HTuple hv_RowEdge_string;
                HTuple hv_ColumnEdge_string;
                HTuple hv_Amplitude_string;
                HTuple hv_Distance_string;

                HOperatorSet.TupleString(hv_RowEdge, ".7f", out hv_RowEdge_string);
                HOperatorSet.TupleString(hv_ColumnEdge, ".7f", out hv_ColumnEdge_string);
                HOperatorSet.TupleString(hv_Amplitude, ".7f", out hv_Amplitude_string);
                HOperatorSet.TupleString(hv_Distance, ".7f", out hv_Distance_string);

                listView.Items.Add(i_string, i_string, 0);
                listView.Items[i_string].SubItems.Add(hv_RowEdge_string[i]);
                listView.Items[i_string].SubItems.Add(hv_ColumnEdge_string[i]);
                listView.Items[i_string].SubItems.Add(hv_Amplitude_string[i]);

                if(i != hv_RowEdge.Length-1)
                    listView.Items[i_string].SubItems.Add(hv_Distance_string[i]);

            }
            listView.EndUpdate();  //结束数据处理,UI界面一次性绘制。  
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: joshball/astrogrep
        /// <summary>
        /// Loads the given System.Windows.Forms.ComboBox with the values.
        /// </summary>
        /// <param name="combo">System.Windows.Forms.ComboBoxy</param>
        /// <param name="values">string of the values to load</param>
        /// <history>
        /// [Curtis_Beard]	   10/11/2006	Created
        /// [Curtis_Beard]	   11/22/2006	CHG: Remove use of browse in combobox
        /// </history>
        private void LoadComboBoxEntry(System.Windows.Forms.ComboBox combo, string values)
        {
            if (!values.Equals(string.Empty))
             {
            string[] items = Convertors.GetComboBoxEntriesFromString(values);

            if (items.Length > 0)
            {
               int start = items.Length;
               if (start > Core.GeneralSettings.MaximumMRUPaths)
               {
                  start = Core.GeneralSettings.MaximumMRUPaths;
               }

               combo.BeginUpdate();
               for (int i = start - 1; i > -1; i--)
               {
                  AddComboSelection(combo, items[i]);
               }
               combo.EndUpdate();
            }
             }
        }
コード例 #3
0
 public static void InitComboBox(System.Windows.Forms.ComboBox box,SelectableListNodeList names)
 {
   box.BeginUpdate();
   box.Items.Clear();
   foreach (SelectableListNode node in names)
   {
     box.Items.Add(node);
   }
   foreach (SelectableListNode node in names)
   {
     if (node.Selected)
     {
       box.SelectedItem = node;
       break;
     }
   }
   box.EndUpdate();
 }
コード例 #4
0
ファイル: PermissionsTool.cs プロジェクト: CarverLab/Oyster
 public System.Windows.Forms.TreeView FillTree(string SectionName, System.Windows.Forms.TreeView TreeView)
 {
     TreeView.BeginUpdate();
     TreeView.Nodes.Clear();
     foreach (Permissions.PermissionsTableRow row in GetSection(SectionName))
     {
         System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode(row.Caption);
         node.Tag = row;
         TreeView.Nodes.Add(node);
     }
     TreeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(PermissionsTool.PermissionsTreeView_AfterCheck);
     TreeView.EndUpdate();
     return TreeView;
 }
コード例 #5
0
ファイル: ShowEditorForm.cs プロジェクト: Jchuchla/vixen
        // Based upon http://www.knowdotnet.com/articles/listviewmoveitem.html
        public static void MoveSelectedItem(System.Windows.Forms.ListView lv, int idx, bool moveUp)
        {
            // Gotta have >1 item in order to move
            if (lv.Items.Count > 1)
            {
                int offset = 0;
                if (idx >= 0)
                {
                    if (moveUp)
                    {
                        // ignore moveup of row(0)
                        offset = -1;
                    }
                    else
                    {
                        // ignore movedown of last item
                        if (idx < (lv.Items.Count - 1))
                            offset = 1;
                    }
                }

                if (offset != 0)
                {
                    lv.BeginUpdate();

                    int selitem = idx + offset;
                    if (selitem >= 0)
                    {
                        for (int i = 0; i < lv.Items[idx].SubItems.Count; i++)
                        {
                            string cache = lv.Items[selitem].SubItems[i].Text;
                            lv.Items[selitem].SubItems[i].Text = lv.Items[idx].SubItems[i].Text;
                            lv.Items[idx].SubItems[i].Text = cache;
                        }

                        var tagIdx = lv.Items[selitem].Tag;
                        var tagSel = lv.Items[idx].Tag;
                        lv.Items[selitem].Tag = tagSel;
                        lv.Items[idx].Tag = tagIdx;

                        lv.Focus();
                        lv.Items[selitem].Selected = true;
                        lv.EnsureVisible(selitem);
                    }
                    lv.EndUpdate();
                }
            }
        }
コード例 #6
0
        public static void SetListViewItems(System.Windows.Forms.ListView listview, string[][] items, IEnumerable<ApiShip> queried)
        {
            if (listview.InvokeRequired)
            {
                SetListViewItemsCallBack d = new SetListViewItemsCallBack(SetListViewItems);
                listview.Invoke(d, new object[] { listview, items, queried });
            }
            else
            {
                listview.BeginUpdate();
                listview.Items.Clear();
                int cnt = 0;
                int n = queried.Count();
                System.Windows.Forms.ListViewItem[] item_array = new System.Windows.Forms.ListViewItem[n];
                //入渠ドックの船のID
                int[] ndock_id = (from d in APIPort.Ndocks
                                  select d.api_ship_id).ToArray();
                foreach (var s in queried)
                {
                    System.Windows.Forms.ListViewItem item = new System.Windows.Forms.ListViewItem(items[cnt]);
                    item.Tag = s;
                    //リストビューの色
                    var hpcond = s.GetHPCondition(Array.IndexOf(ndock_id, s.api_id) != -1, false, Config.BucketHPRatio, APIGetMember.SlotItemsDictionary);
                    System.Drawing.Color bcol = System.Drawing.SystemColors.Window;
                    if (s.api_cond >= 50) bcol = System.Drawing.Color.FromArgb(255, 255, 160);

                    if (hpcond.HasFlag(HPCondition.IsBathing)) bcol = System.Drawing.Color.FromArgb(160, 160, 255);
                    else if (hpcond.HasFlag(HPCondition.MiddleDamage)) bcol = System.Drawing.Color.FromArgb(255, 221, 160);
                    else if (hpcond.HasFlag(HPCondition.HeavyDamage)) bcol = System.Drawing.Color.FromArgb(255, 160, 160);

                    item.BackColor = bcol;
                    //追加
                    item_array[cnt] = item;
                    cnt++;
                }
                listview.Items.AddRange(item_array);
                listview.EndUpdate();
            }
        }
コード例 #7
0
        public bool SearchCollection(string query, System.Collections.SortedList list, 
            System.Windows.Forms.ListBox resultBox, bool text, bool matchCase, bool whole, bool trans)
        {
            DirectoryInfo indexDir = new DirectoryInfo(INDEXDIR);
            IndexSearcher searcher = new IndexSearcher(indexDir.FullName);
            QueryParser parser = new QueryParser(text ? "text" : "title", new StandardAnalyzer());

            string lQuery = this.toLuceneQuery(query, whole);
            if(lQuery != "")
            {
                Query luceneQuery = parser.Parse(lQuery);
                Hits hits = searcher.Search(luceneQuery);

                ArrayList docs = new ArrayList();
                for (int i = 0; i < hits.Length(); i++)
                {
                    Document doc = hits.Doc(i);
                    docs.Add(doc);
                }
                ArrayList songs = new ArrayList();
                foreach(Document doc in docs)
                {
                    int nr = Int32.Parse(doc.GetField("nr").StringValue());
                    Song s = (Song)this.nrIndex[nr];
                    if(s != null)
                    {
                        songs.Add(s);
                    }
                    // Console.Out.WriteLine(s.Number + " " + s.Title + " [boost:" + doc.GetBoost() + "]");
                }
                songs.Sort();

                //docs.Sort(new BoostSorter());
                lock(resultBox)
                {
                    resultBox.BeginUpdate();
                    resultBox.Items.Clear();
                    foreach(Song song in songs)
                    {
                        resultBox.Items.Add(song);
                    }
                    resultBox.EndUpdate();
                }
            }
            searcher.Close();
            return true;
        }