1

Which one would you use to draw stuff on a winform? Format32bppRgb or Format24bppRgb or something else?

in any .net version

Format24bppRgb
Specifies that the format is 24 bits per pixel; 8 bits each are used for the red, green, and blue components.

Format32bppRgb
Specifies that the format is 32 bits per pixel; 8 bits each are used for the red, green, and blue components. The remaining 8 bits are not used.
4

2 回答 2

0

据我所知,由于文档的原因,如果您要在这两者之间进行选择,那么选择 32 是没有意义的。但是,我的直觉告诉我,如果您只为桌面应用程序构建,并且您想要为具有 32 位颜色的人获得最佳颜色范围,我将使用Format32bppArgbFormat32bppPArgb,根据MSDN 文档,这些将为颜色存储提供更多位。

于 2008-11-27T14:14:41.370 回答
0

正如您从文档中引用的那样, Format32bppRgb 将使用相同的每像素 24 位,并且不使用其他 8 位,那么如果 Format32bppRgb 只浪费位,为什么还要使用它。它可能仅出于兼容性原因而存在。Format32bpp然而,RGB确实额外的 8 位用于 Alpha 通道。因此,在这些选择之间,如果您需要 Alpha 通道,则应使用 Format32bppArgb,否则应使用 Format24bppRgb。

您是否使用位图在 WinForm 中绘制一些东西?如果您使用 Graphics 在 Bitmap 上绘制只是为了显示 Bitmap,您还不如使用 Graphics 直接绘制到控件中。您可以使用Graphics.From(control.Handle).

于 2009-04-28T17:27:27.047 回答