コード例 #1
0
ファイル: LocList.cs プロジェクト: pdjdev/monZi
        private void ListBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            if (ListBox1.Items.Count > 0)
            {
                e.DrawBackground();

                if ((e.Index % 2) == 1)
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(255, 255, 255)), e.Bounds);
                }
                else
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(245, 245, 245)), e.Bounds);
                }

                if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                {
                    e.Graphics.FillRectangle(HighlightBrush, e.Bounds);
                }


                using (SolidBrush b = new SolidBrush(e.ForeColor))
                {
                    e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias;
                    e.Graphics.DrawString(ListBox1.GetItemText(ListBox1.Items(e.Index)), e.Font, b, e.Bounds.Left + dpicalc(this, 20), ((e.Bounds.Height - ListBox1.Font.Height) / 2) + e.Bounds.Top);
                }
                e.DrawFocusRectangle();
            }
        }
コード例 #2
0
        private void ListBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
//INSTANT C# TODO TASK: The 'On Error Resume Next' statement is not converted by Instant C#:
            On Error Resume Next
            e.DrawBackground();

            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                e.Graphics.FillRectangle(Brushes.ForestGreen, e.Bounds);
            }
            e.Graphics.DrawString(ListBox1.GetItemText(ListBox1.Items[e.Index]), e.Font, new SolidBrush(e.ForeColor), e.Bounds);
            e.DrawFocusRectangle();
        }
コード例 #3
0
 private void Button1_Click(System.Object sender, System.EventArgs e)
 {
     for (int x = 0; x <= ListBox1.Items.Count - 1; x++)
     {
         if (ListBox1.GetSelected(x))
         {
             int tempX = x;
             ((checkHideColumnHeaderCell)dgv.Columns[Array.FindIndex(dgv.Columns.Cast <DataGridViewColumn>().ToArray(), c => c.HeaderText.Trim().Equals(ListBox1.GetItemText(ListBox1.Items[tempX])))].HeaderCell).isChecked = true;
         }
     }
     cms.Close();
 }