Exemple #1
0
        void CellarPanel_MouseMove(object sender, MouseEventArgs e)
        {
            //this.Segment.MakePointB(new Point(e.X, e.Y));

            if(bButtonPressed)
            {
                decimal nearGridX = _iDotDistance * Math.Round(e.X / (decimal)_iDotDistance);
                decimal nearGridY = _iDotDistance * Math.Round(e.Y / (decimal)_iDotDistance);

                if(CheckAllSegments(nearGridX, nearGridY))
                this.FinishPoint = new Point((int)nearGridX, (int)nearGridY);

                this.Refresh();

            }
            else
            {
                Segments hoverSegment = CheckAllSegmentForHover(e);
                if (hoverSegment != null)
                {
                    Color tmp = hoverSegment.ColorProp;
                    if(!hoverSegment.IsSelected)
                        hoverSegment.ColorProp = Color.FromArgb(150, tmp.R, tmp.G, tmp.B);
                    lastHoverSegment = hoverSegment;
                    Refresh();
                }
                else
                {
                    if (lastHoverSegment != null)
                    {
                        Color tmp = lastHoverSegment.ColorProp;
                        if(!lastHoverSegment.IsSelected)
                            lastHoverSegment.ColorProp = Color.FromArgb(100, tmp.R, tmp.G, tmp.B);
                        Refresh();
                    }
                }

            }
        }
Exemple #2
0
        void CellarPanel_MouseUp(object sender, MouseEventArgs e)
        {
            this.bButtonPressed = false;
            this.DrawToBitmap(this.ClearImage, this.ClientRectangle);
            decimal nearGridX = _iDotDistance * Math.Round(e.X / (decimal)_iDotDistance);
            decimal nearGridY = _iDotDistance * Math.Round(e.Y / (decimal)_iDotDistance);
            if (StartPoint.X != nearGridX && StartPoint.Y != nearGridY && CheckAllSegments(nearGridX, nearGridY))
            {

                Segments NewSegment = new Segments(StartPoint, FinishPoint, names[nameIndex]);
                ListSegments.Add(NewSegment);
                View.SegmentsList = ListSegments;
                View.Name = NewSegment.Name;
                nameIndex++;
            }

            this.Refresh();
        }
Exemple #3
0
        void CellarPanel_MouseClick(object sender, MouseEventArgs e)
        {
            newSegmentClick = CheckAllSegmentForHover(e);

            if (newSegmentClick != null)
            {
                if (lastSegmentClick != null)
                {
                    Color tmp2 = lastSegmentClick.ColorProp;
                    lastSegmentClick.ColorProp = Color.FromArgb(100, tmp2.R, tmp2.G, tmp2.B);
                    lastSegmentClick.IsSelected = false;

                }

                Color tmp = newSegmentClick.ColorProp;
                newSegmentClick.ColorProp = Color.FromArgb(254, tmp.R, tmp.G, tmp.B);
                newSegmentClick.IsSelected = true;
                lastSegmentClick = newSegmentClick;
                View.Name = lastSegmentClick.Name;
                View.ItemsList = newSegmentClick.ItemInSegment;
                View.ActualSelectedSegment = lastSegmentClick.Name;
                Refresh();

            }
        }