コード例 #1
0
 private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
 {
     e.DrawBackground();
     if (e.Index >= 0)
     {
         if ((e.State & DrawItemState.Selected) != 0)
         {
             e.DrawFocusRectangle();
         }
         WebClientValue t = listBox1.Items[e.Index] as WebClientValue;
         Image          img;
         if (!imgs.TryGetValue(t.ValueType, out img))
         {
             img = VPLUtil.GetTypeIcon(t.ValueType);
             imgs.Add(t.ValueType, img);
         }
         System.Drawing.Rectangle rc = new System.Drawing.Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
         e.Graphics.DrawImage(img, rc.X, rc.Y);
         rc.X += 16;
         if (rc.Width > 16)
         {
             rc.Width -= 16;
         }
         e.Graphics.DrawString(t.ToString(), this.Font, Brushes.Black, rc);
     }
 }
コード例 #2
0
        private void buttonNewMap_Click(object sender, EventArgs e)
        {
            DlgWebClientVariable dlg = new DlgWebClientVariable();
            StringCollection     wcs = new StringCollection();

            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                WebClientValue t = listBox1.Items[i] as WebClientValue;
                if (t != null)
                {
                    wcs.Add(t.Name);
                }
            }
            dlg.LoadData(wcs, null);
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                listBox1.Items.Add(new WebClientValue(dlg.ReturnName, dlg.ReturnType));
            }
        }
コード例 #3
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     if (Return == null)
     {
         Return = new WebClientValueCollection(null);
     }
     for (int i = 0; i < listBox1.Items.Count; i++)
     {
         WebClientValue t = listBox1.Items[i] as WebClientValue;
         if (t != null)
         {
             if (!Return.ContainsKey(t.Name))
             {
                 Return.Add(t.Name, t.Value);
             }
         }
     }
     this.DialogResult = DialogResult.OK;
 }