Beispiel #1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            LCDIndicatorSymbol s = this.GetSymbolByPoint(new Point(e.X, e.Y));

            if (s == null)
            {
                goto end;
            }
            if (((LCDIndicator.ModifierKeys & Keys.Shift) == Keys.Shift) && s.PositionInIndicator.Y == this.CursorPos.Y)
            {
                int x = this.selection.Start.X + this.selection.Length - this.selection.Direction;
                int l = (Math.Abs(s.PositionInIndicator.X - x) + 1) * (s.PositionInIndicator.X > x ? -1 : 1);
                if (l < 0 && this[this.CurrentRow].ContainsObjectInPosition(s.PositionInIndicator.X + l + 1))
                {
                    l++;
                }
                this.SetSelection(s.PositionInIndicator, l);
            }
            else
            {
                this.SetSelection(s.PositionInIndicator, 1);
            }
end:
            base.OnMouseDown(e);
            this.Focus();
        }
Beispiel #2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                goto end;
            }
            LCDIndicatorSymbol s = this.GetSymbolByPoint(new Point(e.X, e.Y));

            if (s == null || s.PositionInIndicator == this.selection.Start)
            {
                goto end;
            }
            if (s.PositionInIndicator.Y != this.CursorPos.Y)
            {
                this.SetSelection(s.PositionInIndicator, 1);
            }
            else
            {
                int l = -1 * ((s.PositionInIndicator.X - this.selection.End.X) + Math.Sign(s.PositionInIndicator.X - this.selection.End.X));
                if (l < 0 && this[this.CurrentRow].ContainsObjectInPosition(s.PositionInIndicator.X + l + 1))
                {
                    l++;
                }
                this.SetSelection(s.PositionInIndicator, l);
            }
end:
            this.Invalidate();
            base.OnMouseMove(e);
        }
Beispiel #3
0
 public LCDIndicatorSymbol()
 {
     this.Size = this.MaximumSize;
     if (LCDIndicatorSymbol.nonStandartSymbolCodes == null)
     {
         LCDIndicatorSymbol.CreateCodesHashtable();
     }
     if (LCDIndicatorSymbol.masks == null)
     {
         LCDIndicatorSymbol.CreateSymbolMasksHashtable();
     }
     this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
     this.Symbol = ' ';
 }
Beispiel #4
0
 /// <summary>
 /// Создает и инициализирует массив символов индикатора
 /// </summary>
 private void CreateSymbols()
 {
     this.symbols = new LCDIndicatorSymbol[this.rowCount, this.symbolsInRow];
     for (int i = 0; i < this.rowCount; i++)
     {
         for (int j = 0; j < this.symbolsInRow; j++)
         {
             LCDIndicatorSymbol symbol = new LCDIndicatorSymbol();
             symbol.PositionInIndicator = new Point(j, i);
             symbol.Location            = new Point(this.horizontalMargin + j * (symbol.Width + this.sizeBetweenSymbols),
                                                    this.verticalMargin + i * (symbol.Height + this.sizeBetweenSymbols));
             this.Controls.Add(symbol);
             this.symbols[i, j] = symbol;
         }
     }
 }
Beispiel #5
0
 /// <summary>
 /// Отрисовывает рамку выделения вокруг символа
 /// </summary>
 private void DwawSymbolSelection(LCDIndicatorSymbol symbol, Graphics graphics)
 {
     graphics.DrawRectangle(new Pen(this.SelectionColor), new Rectangle(symbol.Left - 1, symbol.Top - 1, symbol.Width + 1, symbol.Height + 1));
 }