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. Nullable Rectangle

Nullable Rectangle

Scheduled Pinned Locked Moved C#
tutorialquestion
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
    gwithey
    wrote on last edited by
    #1

    hi is there a way of changing one of the properties of a nullable rectangle. for example.

    private Rectangle? m_RectangleShape; // Nullable Rectangle
    m_RectangleShape.Value.X = value;

    The above is along the lines of what i am looking for, a way to change the x value Current attempt:

    public int X
    {
    get
    {
    return m_LocationX;
    }
    set
    {
    // Draw new rectangle changing the value of x
    ShapeRect = new Rectangle(value, m_LocationY, m_SizeX, m_SizeY);
    }
    }

    T 1 Reply Last reply
    0
    • G gwithey

      hi is there a way of changing one of the properties of a nullable rectangle. for example.

      private Rectangle? m_RectangleShape; // Nullable Rectangle
      m_RectangleShape.Value.X = value;

      The above is along the lines of what i am looking for, a way to change the x value Current attempt:

      public int X
      {
      get
      {
      return m_LocationX;
      }
      set
      {
      // Draw new rectangle changing the value of x
      ShapeRect = new Rectangle(value, m_LocationY, m_SizeX, m_SizeY);
      }
      }

      T Offline
      T Offline
      The Man from U N C L E
      wrote on last edited by
      #2

      Before you can set properties on a nullable rectangle you have to initialise it. It is also best practice to test the HasValue property before setting properties of the value, though not needed at this point.

      Rectangle? m_RectangleShape = new Rectangle?();
      m_RectangleShape.Value.X = ValueType;

      If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk

      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