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#
  4. Error in .NET (regions) ??!!

Error in .NET (regions) ??!!

Scheduled Pinned Locked Moved C#
questioncsharphelp
3 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.
  • W Offline
    W Offline
    Wizard_01
    wrote on last edited by
    #1

    It is strange, anyone say : "it must be true", but .NET "no, rectangle isn't visible" !!! RectangleF clippingRectangle = new RectangleF(0.0160072f,0f,0.002000898f,0.3201439f); Region region = new Region(clippingRectangle); bool success = region.IsVisible(new RectangleF(0,0,150,150)); // return false !!! :mad: Have you idea how can I correct it ? :(( Please :-)
    Wizard_01

    C 1 Reply Last reply
    0
    • W Wizard_01

      It is strange, anyone say : "it must be true", but .NET "no, rectangle isn't visible" !!! RectangleF clippingRectangle = new RectangleF(0.0160072f,0f,0.002000898f,0.3201439f); Region region = new Region(clippingRectangle); bool success = region.IsVisible(new RectangleF(0,0,150,150)); // return false !!! :mad: Have you idea how can I correct it ? :(( Please :-)
      Wizard_01

      C Offline
      C Offline
      Chris Jobson
      wrote on last edited by
      #2

      I've found by experiment that the problem is with the width (0.002...). If either the width or the height of the rectangle used to create the region is less than 0.03125 then the problem occurs. I've also found that region.IsEmpty(myform.CreateGraphics()) returns true if either the width or height is less than this value. I'm afraid I've no idea why a width/height of less than 0.03125 makes a region empty, or what you can do about it (except check for a size less than this and make it bigger). 0.03125 = 1/32, so maybe this is some "magic number" used within GDI+?:confused: Chris Jobson

      W 1 Reply Last reply
      0
      • C Chris Jobson

        I've found by experiment that the problem is with the width (0.002...). If either the width or the height of the rectangle used to create the region is less than 0.03125 then the problem occurs. I've also found that region.IsEmpty(myform.CreateGraphics()) returns true if either the width or height is less than this value. I'm afraid I've no idea why a width/height of less than 0.03125 makes a region empty, or what you can do about it (except check for a size less than this and make it bigger). 0.03125 = 1/32, so maybe this is some "magic number" used within GDI+?:confused: Chris Jobson

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

        Ohhh :~ I use this for zoom in/out in my new control. (I was so lazy to recalculate everytime when zoom has changed cell-region and rectangle to new values) Maybe it necessery :(( but slower Do you know how can I region flow by 1 pixel ? (I can be enoght in this case for me :) ) Thank you ... ;) Wizard_01

        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