// 選択範囲を更新する private void UpdateArea(bool init) { var mouse = PointToClient(Cursor.Position); // 初回時 if (init) { startPoint = new Point(mouse.X, mouse.Y); select = new Rectangle(mouse.X, mouse.Y, 0, 0); } // 更新 var expanded = new Rectangle(select.X - 10, select.Y - 10, select.Width + 20, select.Height + 20); select = RenderUtil.GetFixedArea(startPoint.Value.X, startPoint.Value.Y, mouse.X, mouse.Y); // レンダリング Invalidate(expanded); }