本文整理汇总了C#中ColorValue.ToArgb方法的典型用法代码示例。如果您正苦于以下问题:C# ColorValue.ToArgb方法的具体用法?C# ColorValue.ToArgb怎么用?C# ColorValue.ToArgb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColorValue
的用法示例。
在下文中一共展示了ColorValue.ToArgb方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawRectangle
/// <summary>Draw a rectangle</summary>
public void DrawRectangle(System.Drawing.Rectangle rect, ColorValue color)
{
// Offset the rectangle
rect.Offset(dialogX, dialogY);
// If caption is enabled, offset the Y position by its height
if (hasCaption)
rect.Offset(0, captionHeight);
// Get the integer value of the color
int realColor = color.ToArgb();
// Create some vertices
CustomVertex.TransformedColoredTextured[] verts = {
new CustomVertex.TransformedColoredTextured((float)rect.Left - 0.5f, (float)rect.Top -0.5f, 0.5f, 1.0f, realColor, 0, 0),
new CustomVertex.TransformedColoredTextured((float)rect.Right - 0.5f, (float)rect.Top -0.5f, 0.5f, 1.0f, realColor, 0, 0),
new CustomVertex.TransformedColoredTextured((float)rect.Right - 0.5f, (float)rect.Bottom -0.5f, 0.5f, 1.0f, realColor, 0, 0),
new CustomVertex.TransformedColoredTextured((float)rect.Left - 0.5f, (float)rect.Bottom -0.5f, 0.5f, 1.0f, realColor, 0, 0),
};
// Get the device
Device device = SampleFramework.Device;
// Since we're doing our own drawing here, we need to flush the sprites
DialogResourceManager.GetGlobalInstance().Sprite.Flush();
// Preserve the devices current vertex declaration
using (VertexDeclaration decl = device.VertexDeclaration)
{
// Set the vertex format
device.VertexFormat = CustomVertex.TransformedColoredTextured.Format;
// Set some texture states
device.TextureState[0].ColorOperation = TextureOperation.SelectArg2;
device.TextureState[0].AlphaOperation = TextureOperation.SelectArg2;
// Draw the rectangle
device.DrawUserPrimitives(PrimitiveType.TriangleFan, 2, verts);
// Reset some texture states
device.TextureState[0].ColorOperation = TextureOperation.Modulate;
device.TextureState[0].AlphaOperation = TextureOperation.Modulate;
// Restore the vertex declaration
device.VertexDeclaration = decl;
}
}