Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. unable to erase the rectangle drawn

unable to erase the rectangle drawn

Scheduled Pinned Locked Moved Graphics
graphicsgame-dev
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gtag
    wrote on last edited by
    #1

    I am developing a card game. To show the card selected, i am drawing one rectangle to highlight the card.Following is the code i am using to draw rectangle on different card positions: Pen Blue = new Pen(Color.Blue, 2); e.Graphics.DrawRectangle(Blue, 199, 300, 73, 97); While selecting the card, it is getting drawn but at the same time if "deselected" then it(rectangle) should be erased. I tried in many ways to erase the drawn rectangle but while erasing cards which are drawn are also get erased. Please assist me.

    B 1 Reply Last reply
    0
    • G gtag

      I am developing a card game. To show the card selected, i am drawing one rectangle to highlight the card.Following is the code i am using to draw rectangle on different card positions: Pen Blue = new Pen(Color.Blue, 2); e.Graphics.DrawRectangle(Blue, 199, 300, 73, 97); While selecting the card, it is getting drawn but at the same time if "deselected" then it(rectangle) should be erased. I tried in many ways to erase the drawn rectangle but while erasing cards which are drawn are also get erased. Please assist me.

      B Offline
      B Offline
      Baltoro
      wrote on last edited by
      #2

      I would think the simplest method would be to redraw the display without the blue highlighting rectangle. This would be the same code method that got you this point (before you selected the card). If that doesn't seem feasible, you could draw the highlighting rectangle in whatever color the background is (assuming the background isn't an image). You don't tell us what mechanism you are using to maintain the state of your game's display (so, I'm assuming that there isn't one). But, if you expect the game to get more complex, you might consider such a concept.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups