Beispiel #1
0
        private void ListBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();

            Graphics g = e.Graphics;

            if (e.Index == 0)
            {
                g.FillRectangle(new SolidBrush(Color.SteelBlue), e.Bounds);
                textBox3.Visible  = true;
                textBox3.Location = new Point(listBox1.Location.X + listBox1.Width, listBox1.Location.Y + e.Bounds.Y);

                string methodName = listBox1.Items[0].ToString();
                methodName = methodName.Split('(')[0];

                foreach (MethodInfo m in metody)
                {
                    if (m.Name == methodName)
                    {
                        try
                        {
                            Popis p = (Popis)m.GetCustomAttributes(typeof(Popis), true)[0];
                            textBox3.Text = p.GetName();
                        }
                        catch (Exception ex)
                        {
                            textBox3.Text = "Žádná nápověda není k dispozici";
                        }
                    }
                }
                Size size = TextRenderer.MeasureText(textBox3.Text, textBox3.Font);
                textBox3.Width  = size.Width;
                textBox3.Height = size.Height;

                if (textBox3.Location.X + textBox3.Width > ClientSize.Width)
                {
                    textBox3.Location = new Point(listBox1.Location.X - (textBox3.Width - listBox1.Width), listBox1.Location.Y + listBox1.Height);
                }
                if (textBox3.Location.X < 0)
                {
                    textBox3.Location = new Point(0, listBox1.Location.Y + listBox1.Height);
                }
                // get method description
            }
            else
            {
                g.FillRectangle(new SolidBrush(Color.White), e.Bounds);
            }
            ListBox lb = (ListBox)sender;

            g.DrawString(lb.Items[e.Index].ToString(), e.Font, new SolidBrush(Color.Black), new PointF(e.Bounds.X, e.Bounds.Y));

            e.DrawFocusRectangle();
        }
Beispiel #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var result = Id?.GetHashCode() ?? 0;
         result = (result * 397) ^ SpisovaZnacka.GetHashCode();
         result = (result * 397) ^ DatumVlozeni.GetHashCode();
         result = (result * 397) ^ (Popis?.GetHashCode() ?? 0);
         result = (result * 397) ^ (Url?.GetHashCode() ?? 0);
         result = (result * 397) ^ (Oddil?.GetHashCode() ?? 0);
         return(result);
     }
 }