private void CheckMouseMove(int mouseX, int mouseY) { lastMouseX = mouseX; lastMouseY = mouseY; foreach (SubVirtualRegion subRegion in subRegions.Values) { if (mouseX > subRegion.X && mouseX < subRegion.X + subRegion.Width && mouseY > subRegion.Y && mouseY < subRegion.Y + subRegion.Height) { if (selectRegion == null || subRegion.Id != selectRegion.Id) { if (selectRegion != null) { selectRegion.Left(); } selectRegion = subRegion; selectRegion.Enter(); if (RegionEntered != null) { RegionEntered(selectRegion.Id, selectRegion.X + selectRegion.Width + 1, selectRegion.Y, selectRegion.GetKeyValue()); } } return; } } if (selectRegion != null) { selectRegion.Left(); selectRegion = null; if (RegionLeft != null) { RegionLeft(); } } }
public void AddRegion(SubVirtualRegion region) { region.Parent = parent; subRegions.Add(region.Id, region); }