VAGSuite.frmBinCompare.listBox1_DrawItem C# (CSharp) Метод

listBox1_DrawItem() приватный Метод

private listBox1_DrawItem ( object sender, DrawItemEventArgs e ) : void
sender object
e System.Windows.Forms.DrawItemEventArgs
Результат void
        private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            /* e.DrawBackground();
            e.DrawFocusRectangle();
            if(e.Index < 0) return;
            if (e.Index < listBox1.Items.Count)
            {
                if (!checkButton1.Checked)
                {
                    if (linediffs[e.Index]) e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), listBox1.Font, Brushes.Red, e.Bounds);
                    else e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), listBox1.Font, Brushes.Black, e.Bounds);
                }
                else
                {
                    e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), listBox1.Font, Brushes.Black, e.Bounds);
                }
            }*/

            try
            {
                if (e.Index >= 0)
                {
                    string symbolName = string.Empty;
                    try
                    {
                        int idx = currstrList[e.Index].IndexOf(':');
                        if (idx > 0)
                        {
                            int address = Convert.ToInt32(currstrList[e.Index].Substring(0, idx), 16);
                            if (address > 0)
                            {
                                symbolName = Tools.Instance.GetSymbolNameByAddressInRange(address, address + 0x0F);
                            }
                        }
                    }
                    catch (Exception)
                    {

                    }
                    string drawItem = currstrList[e.Index];
                    if(symbolName != string.Empty) drawItem += " << " + symbolName;
                    if (!checkButton1.Checked)
                    {
                        if (linediffs[e.Index]) listBox1.DefaultDrawItem(e, drawItem, Brushes.Red);
                        else listBox1.DefaultDrawItem(e, drawItem, Brushes.Black);
                    }
                    else
                    {
                        listBox1.DefaultDrawItem(e, drawItem, Brushes.Black);
                    }
                }
            }
            catch (Exception)
            {
            }
        }