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.MouseUp(); } 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.MouseUp(); selectRegion = null; if (RegionLeft != null) { RegionLeft(); } } }
public void AddRegion(SubVirtualRegion region) { region.SetParent(this); subRegions.Add(region.Id, region); }