Example #1
0
File: Panel.cs Project: slawer/skc
        protected SizeF timeSizeF; // размер области в которую выводится метка времени

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Инициализирует новый экземпляр класса
        /// </summary>
        /// <param name="_sheet"></param>
        public Panel(GraphicsSheet _sheet)
        {
            try
            {
                bufRect = RectangleF.Empty;

                drawMutex = new Mutex();
                locker = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);

                graphics = new List<Graphic>();
                g_locker = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);

                if (_sheet != null)
                {
                    sheet = _sheet;

                    sheet.Resize += new EventHandler(sheet_Resize);
                    sheet.Paint += new PaintEventHandler(sheet_Paint);

                    interval = new TimeSpan(0, 0, 10);          // интервал времени в одной клетке
                    drawter = new GraphicDrawter(sheet.CreateGraphics(), sheet.ClientRectangle);

                    panels = new List<IElement>();

                    panels.Add(CreateTimePanel());
                    panels.Add(CreateScalePanel());

                    panels.Add(CreateGraphicsPanel());
                    orientation = Orientation.Vertical;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// Инициализирует новый экземпляр класса
        /// </summary>
        /// <param name="_sheet"></param>
        public Panel(GraphicsSheet _sheet)
        {
            try
            {
                bufRect = RectangleF.Empty;

                drawMutex = new Mutex();
                locker    = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);

                graphics = new List <Graphic>();
                g_locker = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);

                if (_sheet != null)
                {
                    sheet = _sheet;

                    sheet.Resize += new EventHandler(sheet_Resize);
                    sheet.Paint  += new PaintEventHandler(sheet_Paint);

                    interval = new TimeSpan(0, 3, 0);          // интервал времени в одной клетке
                    drawter  = new GraphicDrawter(sheet.CreateGraphics(), sheet.ClientRectangle);

                    panels = new List <IElement>();

                    panels.Add(CreateTimePanel());
                    panels.Add(CreateScalePanel());

                    panels.Add(CreateGraphicsPanel());
                    orientation = Orientation.Vertical;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }