protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; // Draw rooms. if (room != null) { if (scale == 1) { scale = designPanelController.CalculateScale(); } if (roomX == 0 && roomY == 0) { designPanelController.CalculateCenterOfScreen(); } Pen p = new Pen(Color.Black, 2); // Draw the floor. if (gPath == null) { gPath = designPanelController.MakeGraphicsPath(); } if (floorBitmap == null) { floorBitmap = designPanelController.MakeBitmapForRoom(gPath); } // Load made image. g.DrawImage(floorBitmap, 0, menuHeightOffset); // Draw strings to show size of room. g.DrawString(String.Format("{0} m", (float)room.width / 100), new Font("Arial", 10), p.Brush, roomX + (room.newWidth / 2), roomY + room.newHeight + 10 + menuHeightOffset); g.DrawString(String.Format("{0} m", (float)room.height / 100), new Font("Arial", 10), p.Brush, roomX - 30, roomY + (room.newHeight / 2) + menuHeightOffset); // Draws products. for (int i = 0; i < room.productList.Count; i++) { Product product = room.productList[i]; Bitmap tempImage = new Bitmap(product.image, new Size((int)(product.image.Width / scale), (int)(product.image.Height / scale))); Point point = new Point(product.location.X, product.location.Y); g.DrawImage(tempImage, point); } if (nightModeBool) { // Draw nightMode. if (tempPath == null) { tempPath = (GraphicsPath)gPath.Clone(); Matrix matrix = new Matrix(); matrix.Translate(0, menuHeightOffset); tempPath.Transform(matrix); } Brush b = new SolidBrush(Color.FromArgb(100, 0, 0, 0)); g.FillPath(b, tempPath); // Draw lightCircles. for (int i = 0; i < room.productList.Count; i++) { if (room.productList[i].GetType().Name == "Lamp") { Lamp tempLamp = (Lamp)room.productList[i]; g.FillEllipse(new SolidBrush(Color.FromArgb(80, 200, 239, 67)), new Rectangle( tempLamp.location.X - tempLamp.lightRadius, tempLamp.location.Y - tempLamp.lightRadius, (int)(tempLamp.image.Width / scale) + (tempLamp.lightRadius * 2), (int)(tempLamp.image.Width / scale) + (tempLamp.lightRadius * 2))); } } } } }