Esempio n. 1
0
        public ImageGridCell CreateCell(int x, int y)
        {
            Point key = new Point(x, y);

            ImageGridCell cell = new ImageGridCell(x, y);

            cells.Add(key, cell);

            return(cell);
        }
Esempio n. 2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            // compute cell coord of event location
            int gridX = e.Location.X - AutoScrollPosition.X;
            int gridY = e.Location.Y - AutoScrollPosition.Y;

            Point CellCoord = new Point(gridX / cellIncr, gridY / cellIncr);

            if (dragging && (CellCoord != lastMouseCell))
            {
                // Might want to optimize
                Invalidate();
            }

            // save mouse location
            lastMouseLoc  = e.Location;
            lastMouseCell = CellCoord;

            // get the cell
            ImageGridCell cell;

            cells.TryGetValue(CellCoord, out cell);

            // hide or show the tooltip
            if ((cell != null) && (cell.ToolTipText != null))
            {
                if (cell != lastToolTipCell)
                {
                    Point pt = e.Location;
                    pt.Y += cellSize / 2;

                    toolTip.Show(cell.ToolTipText, this, pt);
                    lastToolTipCell = cell;
                }
            }
            else
            {
                toolTip.Hide(base.FindForm());
            }

            base.OnMouseMove(e);
        }
Esempio n. 3
0
 public void FreeCell(ImageGridCell cell)
 {
     cells.Remove(new Point(cell.X, cell.Y));
 }