Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. int width = 40, height = 40;
  2. int count_i = 10, count_j = 10;
  3. Bitmap bmp = new Bitmap(Convert.ToInt32((count_i * width) + (count_i * count_i - count_i)), Convert.ToInt32((count_j * height) + (count_j * count_j - count_j)),PixelFormat.Format32bppArgb);
  4. Graphics g = Graphics.FromImage(bmp);
  5. int input = (int)(DateTime.Parse("2017/07/06 8:00 AM") - DateTime.Now).TotalDays;
  6. int h = 0;
  7. for (int i = 0; i < count_i; i++)
  8. {
  9. for (int j = 0; j < count_j; j++)
  10. {
  11. h++;
  12. SolidBrush b;
  13. if (h <= input)
  14. {
  15. b = new SolidBrush(Color.Green);
  16. }
  17. else
  18. {
  19. b = new SolidBrush(Color.LightGray);
  20. }
  21. g.FillRectangle(b, new Rectangle(i * (width + count_i), j * (height + count_j), width, height));
  22. }
  23. }
  24. bitmap.Save(@"C:\Users\admin\Desktop\test.png", ImageFormat.Png);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement