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. Poor Points

Poor Points

Scheduled Pinned Locked Moved C#
helpgraphicsquestion
4 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.
  • T Offline
    T Offline
    TyronX
    wrote on last edited by
    #1

    The System.Drawing.Point Class has really a lot of missing Features. It has no TypeConverter and no support for operators like + and -. This is really weak. Is there any possibility to fix that issue? Sure... I could write an own Point class but that one won't be compatible with all the (drawing-)functions like DrawPoly and I don't want to write some ugly conversion code.

    L 2 Replies Last reply
    0
    • T TyronX

      The System.Drawing.Point Class has really a lot of missing Features. It has no TypeConverter and no support for operators like + and -. This is really weak. Is there any possibility to fix that issue? Sure... I could write an own Point class but that one won't be compatible with all the (drawing-)functions like DrawPoly and I don't want to write some ugly conversion code.

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      TyronX wrote: It has no TypeConverter Funny mine has a type convertor... [Serializable, StructLayout(LayoutKind.Sequential), TypeConverter(typeof(PointConverter)), ComVisible(true)] public struct Point {...} top secret
      Download xacc-ide 0.0.3 now!
      See some screenshots

      1 Reply Last reply
      0
      • T TyronX

        The System.Drawing.Point Class has really a lot of missing Features. It has no TypeConverter and no support for operators like + and -. This is really weak. Is there any possibility to fix that issue? Sure... I could write an own Point class but that one won't be compatible with all the (drawing-)functions like DrawPoly and I don't want to write some ugly conversion code.

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        Actually you seem to be clueless... :^):omg:

        [Serializable, StructLayout(LayoutKind.Sequential), TypeConverter(typeof(PointConverter)), ComVisible(true)]
        public struct Point
        {
        public static readonly Point Empty;
        public Point(int x, int y);
        public Point(Size sz);
        public Point(int dw);
        public bool IsEmpty { get; }
        public int X { get; set; }
        public int Y { get; set; }
        public static implicit operator PointF(Point p);
        public static explicit operator Size(Point p);
        public static Point operator +(Point pt, Size sz);
        public static Point operator -(Point pt, Size sz);
        public static bool operator ==(Point left, Point right);
        public static bool operator !=(Point left, Point right);
        public static Point Ceiling(PointF value);
        public static Point Truncate(PointF value);
        public static Point Round(PointF value);
        public override bool Equals(object obj);
        public override int GetHashCode();
        public void Offset(int dx, int dy);
        public override string ToString();
        }

        top secret
        Download xacc-ide 0.0.3 now!
        See some screenshots

        T 1 Reply Last reply
        0
        • L leppie

          Actually you seem to be clueless... :^):omg:

          [Serializable, StructLayout(LayoutKind.Sequential), TypeConverter(typeof(PointConverter)), ComVisible(true)]
          public struct Point
          {
          public static readonly Point Empty;
          public Point(int x, int y);
          public Point(Size sz);
          public Point(int dw);
          public bool IsEmpty { get; }
          public int X { get; set; }
          public int Y { get; set; }
          public static implicit operator PointF(Point p);
          public static explicit operator Size(Point p);
          public static Point operator +(Point pt, Size sz);
          public static Point operator -(Point pt, Size sz);
          public static bool operator ==(Point left, Point right);
          public static bool operator !=(Point left, Point right);
          public static Point Ceiling(PointF value);
          public static Point Truncate(PointF value);
          public static Point Round(PointF value);
          public override bool Equals(object obj);
          public override int GetHashCode();
          public void Offset(int dx, int dy);
          public override string ToString();
          }

          top secret
          Download xacc-ide 0.0.3 now!
          See some screenshots

          T Offline
          T Offline
          TyronX
          wrote on last edited by
          #4

          Yes indeed, and everything is explained on MSDN. All my fault :( Actually I tried to convert a string into a point and also tried to sumarize two Points. Well, at least now I know how it works :)

          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