Esempio n. 1
0
        public void Draw(CoordinateTransformer coordinateSystem, BrushProvider brushProvider, Graphics graphicsObj)
        {
            var bounds = new Rectangle();
            bounds.X = (int)coordinateSystem.ValidTimeToX(validFrom);
            bounds.Y = (int)coordinateSystem.RecordTimeToY(recordTo);
            bounds.Width = (int)coordinateSystem.ValidTimeToX(validTo) - bounds.X;
            bounds.Height = (int)coordinateSystem.RecordTimeToY(recordFrom) - bounds.Y;

            if (bounds.Width == 0 || bounds.Height == 0)
                return;

            var brush = brushProvider.GetBrush(transactionId, transactionId, recordFrom, recordTo, validFrom, validTo, new Rectangle(bounds.Y, bounds.X, bounds.Height, bounds.Width));
            var pen = new Pen(Color.Black, 1);
            graphicsObj.FillRectangle(brush, bounds);
            graphicsObj.DrawRectangle(pen, bounds);
            var text = String.Format("T:{0} / R:{1}", transactionId, String.Join(", ", revIds));
            var font = new Font("Lucida Console", 10f);
            var textBrush = new SolidBrush(Color.Black);
            var height = graphicsObj.MeasureString(text, font).Height;
            if (validFrom == DateTime.MinValue)
            {
                bounds.X += 10;
            }

            if(coordinateSystem.fontVisible)
                graphicsObj.DrawString(text, font, textBrush, bounds.X, bounds.Bottom - height);
            brush.Dispose();
        }
 public void Draw(CoordinateTransformer coordinateSystem, BrushProvider brushProvider, Graphics graphicsObj)
 {
     foreach (var version in transactions.Values)
     {
         version.Draw(coordinateSystem, brushProvider, graphicsObj);
     }
 }