Exemple #1
0
        private void timeSpreadCalc_CalcDone()
        {
            Logger.logDebug("timeSpreadCalc_CalcDone()");
            lock (this.monitor)
            {
                this.Invalidate();
                Rectangle rect = this.ClientRectangle;
                rect.Size = new Size(rect.Width, rect.Height - EDGE_OFFSET * 3);
                if (rect.Height < 1)
                {
                    return;
                }
                this.bmp = new Bitmap(rect.Width, rect.Height);
                Graphics gfx     = Graphics.FromImage(bmp);
                Brush    bgBrush = new SolidBrush(this.BackColor);
                gfx.FillRectangle(bgBrush, rect);
                bgBrush.Dispose();

                List <SpreadEntry> list = TimeSpreadCalc.DiffList;
                int step;
                if (list.Count >= this.displayHeight)
                {
                    step            = (int)Math.Round((double)list.Count / (double)this.displayHeight);
                    this.rectHeight = 1;
                }
                else
                {
                    step            = 1;
                    this.rectHeight = (int)Math.Round((double)this.displayHeight / (double)list.Count);
                }
                Rectangle fillRect = new Rectangle(0, 0, rect.Width, this.rectHeight);

                lock (list)
                {
                    for (int i = 0; i < list.Count; i += step)
                    {
                        SpreadEntry entry = list[i];
                        int         color = ReverseAlpha ? entry.Value : 255 - entry.Value;
                        if (color > 255)
                        {
                            color = 255;
                        }
                        if (color < 0)
                        {
                            color = 0;
                        }
                        Brush brush = new SolidBrush(Color.FromArgb(color, this.ForeColor));
                        //Brush brush = new SolidBrush(Color.FromArgb(color, color, color, color));
                        gfx.FillRectangle(brush, fillRect);
                        brush.Dispose();
                        fillRect.Offset(0, this.rectHeight);
                    }
                }
            }
            this.BeginInvoke(new MethodInvoker(Refresh));
        }
Exemple #2
0
 private void TimeSpreadingControl_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         SpreadEntry entry = GetEntryForMouse(e);
         if (entry == null)
         {
             return;
         }
         OnLineSelected(new SelectLineEventArgs(entry.LineNum));
     }
 }
Exemple #3
0
        private void TimeSpreadingControl_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Y == this.lastMouseY)
            {
                return;
            }

            if (e.Button == MouseButtons.Right)
            {
                DragContrast(e);
                return;
            }

            SpreadEntry entry = GetEntryForMouse(e);

            if (entry == null)
            {
                return;
            }
            this.lastMouseY = e.Y;
            string dts = entry.Timestamp.ToString("dd.MM.yyyy HH:mm:ss");

            this.toolTip.SetToolTip(this, "Line " + (entry.LineNum + 1) + "\n" + dts);
        }