Using ToArgb() followed by FromArgb() does not result in the original color

前端 未结 4 1280
清酒与你
清酒与你 2021-01-13 04:35

This does not work

        int blueInt = Color.Blue.ToArgb();
        Color fred = Color.FromArgb(blueInt);
        Assert.AreEqual(Color.Blue,fred);
         


        
4条回答
  •  灰色年华
    2021-01-13 05:04

    They won't equal the same, as Color.Blue doesn't equal your colour object, it equals something stored internally, a "new Color(KnownColor.Blue);" to be exact.

提交回复
热议问题