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. C / C++ / MFC
  4. how draw Region border with pen style?

how draw Region border with pen style?

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 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.
  • W Offline
    W Offline
    wangyiming
    wrote on last edited by
    #1

    how draw Region border with pen style?

    P 1 Reply Last reply
    0
    • W wangyiming

      how draw Region border with pen style?

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      I do not think that you will be able to do the border of a region with a pen. The reason is that windows does not actually calculate the border of your region for the FrameRgn function, it simply creates another region and fills that area. This gives the effect of a border. Of you wanted to you could calculate the border yourself from all of the rectnagles that create the region, but this may be time consuming depending on how complicated your region is. You would have to calculate the convex hull of all of the rectangles, even then, if you have holes in your region, they would be difficult to detect as well. How are you getting your region? What are you trying to accomplish with the pen. Because there are other tools you can use like paths, they are pretty powerful. If you post a few more details of what you would like, I will try to help you find a solution.

      W S 2 Replies Last reply
      0
      • P Paul M Watt

        I do not think that you will be able to do the border of a region with a pen. The reason is that windows does not actually calculate the border of your region for the FrameRgn function, it simply creates another region and fills that area. This gives the effect of a border. Of you wanted to you could calculate the border yourself from all of the rectnagles that create the region, but this may be time consuming depending on how complicated your region is. You would have to calculate the convex hull of all of the rectangles, even then, if you have holes in your region, they would be difficult to detect as well. How are you getting your region? What are you trying to accomplish with the pen. Because there are other tools you can use like paths, they are pretty powerful. If you post a few more details of what you would like, I will try to help you find a solution.

        W Offline
        W Offline
        wangyiming
        wrote on last edited by
        #3

        I get region by: CombineRgn or CreateRectRgn ... or Create a standard region, then rotate it Thanks

        1 Reply Last reply
        0
        • P Paul M Watt

          I do not think that you will be able to do the border of a region with a pen. The reason is that windows does not actually calculate the border of your region for the FrameRgn function, it simply creates another region and fills that area. This gives the effect of a border. Of you wanted to you could calculate the border yourself from all of the rectnagles that create the region, but this may be time consuming depending on how complicated your region is. You would have to calculate the convex hull of all of the rectangles, even then, if you have holes in your region, they would be difficult to detect as well. How are you getting your region? What are you trying to accomplish with the pen. Because there are other tools you can use like paths, they are pretty powerful. If you post a few more details of what you would like, I will try to help you find a solution.

          S Offline
          S Offline
          srikanthvarma
          wrote on last edited by
          #4

          sorry for replying so late and thanks for ur suggestion the problem here is not with rgns i could actually get the desired output on the screen with FrameRgn( , ,1,1); but when i take a print out i get an image with more width to what i see on the screen i am not able to under stand the problem as u suggested paths r powerful but they do not support arcs and ellipses in win 98 platform so i could not use paths for creating aregion o fill the path thanks for ur help

          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