System.Drawing.Color的SQL数据类型

时间:2022-04-10 16:29:33

I want to save a setting in MS SQL for .net Color. What data type in MS SQL should I use?

我想在MS SQL中为.net Color保存一个设置。我应该使用MS SQL中的哪种数据类型?

4 个解决方案

#1


15  

Use Int32, then use Color.FromArgb(Int32) and Color.ToArgb() to read and write, respectively. See: http://msdn.microsoft.com/en-us/library/ed705s37.aspx

使用Int32,然后分别使用Color.FromArgb(Int32)和Color.ToArgb()进行读写。请参阅:http://msdn.microsoft.com/en-us/library/ed705s37.aspx

#2


4  

The easy way would be to use color.ToArgb() to convert it to a 32-bit integer and store it as that. You can convert it back to a color using the static method Color.FromArgb(int).

简单的方法是使用color.ToArgb()将其转换为32位整数并将其存储。您可以使用静态方法Color.FromArgb(int)将其转换回颜色。

#3


3  

You should use int. I would have stopped there but I need to have at least 30 characters.

你应该使用int。我会停在那里,但我需要至少30个字符。

#4


2  

I'd store it as an INT because technically that is what it is.

我将它存储为INT,因为从技术上讲它就是这样。

#1


15  

Use Int32, then use Color.FromArgb(Int32) and Color.ToArgb() to read and write, respectively. See: http://msdn.microsoft.com/en-us/library/ed705s37.aspx

使用Int32,然后分别使用Color.FromArgb(Int32)和Color.ToArgb()进行读写。请参阅:http://msdn.microsoft.com/en-us/library/ed705s37.aspx

#2


4  

The easy way would be to use color.ToArgb() to convert it to a 32-bit integer and store it as that. You can convert it back to a color using the static method Color.FromArgb(int).

简单的方法是使用color.ToArgb()将其转换为32位整数并将其存储。您可以使用静态方法Color.FromArgb(int)将其转换回颜色。

#3


3  

You should use int. I would have stopped there but I need to have at least 30 characters.

你应该使用int。我会停在那里,但我需要至少30个字符。

#4


2  

I'd store it as an INT because technically that is what it is.

我将它存储为INT,因为从技术上讲它就是这样。