2 instantiations of COLORREF
System.Windows.Forms (2)
System\Windows\Forms\Controls\ListView\ListViewInsertionMark.cs (1)
71
_color = new
COLORREF
((uint)PInvokeCore.SendMessage(_listView, PInvoke.LVM_GETINSERTMARKCOLOR));
System\Windows\Forms\Help\Help.cs (1)
84
clrForeground = new
COLORREF
(unchecked((uint)-1)), // Ignore
117 references to COLORREF
System.Private.Windows.Core (13)
System\Private\Windows\Ole\DragDropHelper.cs (1)
278
crColorKey = (
COLORREF
)PInvokeCore.GetSysColor(SYS_COLOR_INDEX.COLOR_WINDOW)
Windows\Win32\Foundation\COLORREF.cs (4)
12
/// <see cref="
COLORREF
"/> is a DWORD- passing constants in native code would just pass the value as is.
22
public static implicit operator
COLORREF
(Color color) => new((uint)ColorTranslator.ToWin32(color));
23
public static implicit operator Color(
COLORREF
color) => ColorTranslator.FromWin32((int)color.Value);
24
public static implicit operator
COLORREF
(int color) => new((uint)color);
Windows\Win32\Graphics\Gdi\CreateBrushScope.cs (1)
27
/// Creates a solid brush based on the <paramref name="color"/> using <see cref="PInvokeCore.CreateSolidBrush(
COLORREF
)"/>.
Windows\Win32\Graphics\Gdi\CreatePenScope.cs (1)
27
/// <see cref="PInvokeCore.CreatePen(PEN_STYLE, int,
COLORREF
)" />.
Windows\Win32\Graphics\Gdi\SetBackgroundColorScope.cs (3)
18
private readonly
COLORREF
_previousColor;
23
/// <see cref="PInvokeCore.SetBkColor(HDC,
COLORREF
)"/>.
25
public SetBackgroundColorScope(HDC hdc,
COLORREF
color)
Windows\Win32\Graphics\Gdi\SetTextColorScope.cs (3)
22
private readonly
COLORREF
_previousColor;
27
/// <see cref="PInvokeCore.SetTextColor(HDC,
COLORREF
)"/>.
29
public SetTextColorScope(HDC hdc,
COLORREF
color)
System.Windows.Forms (53)
System\Windows\Forms\Control.cs (3)
778
backBrush = PInvokeCore.CreateSolidBrush((
COLORREF
)(uint)ColorTranslator.ToWin32(color));
5857
PInvokeCore.SetTextColor(dc, (
COLORREF
)(uint)ColorTranslator.ToWin32(ForeColor));
5858
PInvokeCore.SetBkColor(dc, (
COLORREF
)(uint)ColorTranslator.ToWin32(BackColor));
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (2)
2004
PInvokeCore.SetTextColor(dc, (
COLORREF
)(uint)ColorTranslator.ToWin32(ForeColor));
2005
PInvokeCore.SetBkColor(dc, (
COLORREF
)(uint)ColorTranslator.ToWin32(BackColor));
System\Windows\Forms\Controls\ImageList\ImageList.cs (5)
434
PInvoke.ImageList.SetBkColor(this, (
COLORREF
)PInvokeCore.CLR_NONE);
539
(
COLORREF
)PInvokeCore.CLR_NONE,
540
(
COLORREF
)PInvokeCore.CLR_NONE,
675
(
COLORREF
)PInvokeCore.CLR_NONE,
676
(
COLORREF
)PInvokeCore.CLR_NONE,
System\Windows\Forms\Controls\Labels\LinkLabel.cs (1)
1361
(int)PInvoke.GetNearestColor(hdc, (
COLORREF
)(uint)ColorTranslator.ToWin32(foreBrush.Color)).Value);
System\Windows\Forms\Controls\ListView\ListView.cs (5)
2855
? (
COLORREF
)ColorTranslator.ToWin32(_odCacheForeColor)
2856
: (
COLORREF
)ColorTranslator.ToWin32(riFore);
2882
nmcd->clrText = (
COLORREF
)((int)(nmcd->clrText & (~mask)) | color);
2898
? (
COLORREF
)ColorTranslator.ToWin32(_odCacheBackColor)
2899
: (
COLORREF
)ColorTranslator.ToWin32(riBack);
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDown.cs (1)
1797
if (!PInvoke.SetLayeredWindowAttributes(this, (
COLORREF
)0, OpacityAsByte, LAYERED_WINDOW_ATTRIBUTES_FLAGS.LWA_ALPHA))
System\Windows\Forms\Design\ComponentEditorForm.PageSelector.cs (11)
92
COLORREF
backColor,
93
COLORREF
textColor)
157
COLORREF
savedColor;
160
savedColor = PInvokeCore.SetBkColor(dc, (
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.ControlLightLight));
171
PInvokeCore.SetBkColor(dc, (
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.ControlDark));
232
(
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.Control),
233
(
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.ControlText));
266
COLORREF
oldTextColor = PInvokeCore.SetTextColor(dc, (
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.ControlLightLight));
267
COLORREF
oldBackColor = PInvokeCore.SetBkColor(dc, (
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.Control));
System\Windows\Forms\Dialogs\CommonDialogs\ColorDialog.cs (9)
19
private readonly
COLORREF
[] _customColors = new
COLORREF
[16];
77
MemoryMarshal.Cast<
COLORREF
, int>(_customColors).CopyTo(result);
82
Span<
COLORREF
> customColors = _customColors;
87
MemoryMarshal.Cast<int,
COLORREF
>(value)[..Math.Min(customColors.Length, value.Length)].CopyTo(customColors);
168
Span<
COLORREF
> customColors = stackalloc
COLORREF
[16];
176
rgbResult = (
COLORREF
)_color,
181
fixed (
COLORREF
* c = customColors)
System\Windows\Forms\Dialogs\CommonDialogs\FontDialog.cs (1)
318
UpdateColor((
COLORREF
)(int)PInvoke.SendDlgItemMessage(
System\Windows\Forms\Form.cs (7)
2521
COLORREF
colorRef;
2527
(uint)sizeof(
COLORREF
));
2534
COLORREF
colorRef = color;
2540
(uint)sizeof(
COLORREF
));
6139
result = PInvoke.SetLayeredWindowAttributes(this, (
COLORREF
)0, OpacityAsByte, LAYERED_WINDOW_ATTRIBUTES_FLAGS.LWA_ALPHA);
6144
result = PInvoke.SetLayeredWindowAttributes(this, (
COLORREF
)transparencyKey, 0, LAYERED_WINDOW_ATTRIBUTES_FLAGS.LWA_COLORKEY);
6148
result = PInvoke.SetLayeredWindowAttributes(this, (
COLORREF
)transparencyKey, OpacityAsByte, LAYERED_WINDOW_ATTRIBUTES_FLAGS.LWA_ALPHA | LAYERED_WINDOW_ATTRIBUTES_FLAGS.LWA_COLORKEY);
System\Windows\Forms\Rendering\ControlPaint.cs (7)
318
PInvokeCore.SetBkColor(targetDC, (
COLORREF
)0x00ffffff); // white
319
PInvokeCore.SetTextColor(targetDC, (
COLORREF
)0x00000000); // black
1804
FrameStyle.Dashed => (HGDIOBJ)PInvokeCore.CreatePen(PEN_STYLE.PS_DOT, cWidth: 1, (
COLORREF
)(uint)ColorTranslator.ToWin32(backColor)).Value,
1805
FrameStyle.Thick => (HGDIOBJ)PInvokeCore.CreatePen(PEN_STYLE.PS_SOLID, cWidth: 2, (
COLORREF
)(uint)ColorTranslator.ToWin32(backColor)).Value,
1813
PInvokeCore.SetBkColor(desktopDC, (
COLORREF
)(uint)ColorTranslator.ToWin32(graphicsColor));
1829
using ObjectScope pen = new(PInvokeCore.CreatePen(PEN_STYLE.PS_SOLID, cWidth: 1, (
COLORREF
)(uint)ColorTranslator.ToWin32(backColor)));
2044
using ObjectScope brush = new(PInvokeCore.CreateSolidBrush((
COLORREF
)(uint)ColorTranslator.ToWin32(backColor)));
System\Windows\Forms\VisualStyles\VisualStyleRenderer.cs (1)
493
_lastHResult = PInvoke.GetThemeColor(HTHEME, Part, State, (THEME_PROPERTY_SYMBOL_ID)prop, out
COLORREF
color);
System.Windows.Forms.Design (9)
System\Windows\Forms\Design\DesignerUtils.cs (8)
28
PInvokeCore.CreateSolidBrush((
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.Window));
30
PInvokeCore.CreateSolidBrush((
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.ControlText));
32
PInvokeCore.CreatePen(PEN_STYLE.PS_SOLID, cWidth: 1, (
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.ControlText));
34
PInvokeCore.CreatePen(PEN_STYLE.PS_SOLID, cWidth: 1, (
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.Window));
173
s_grabHandleFillBrushPrimary = PInvokeCore.CreateSolidBrush((
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.Window));
176
s_grabHandleFillBrush = PInvokeCore.CreateSolidBrush((
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.ControlText));
179
s_grabHandlePenPrimary = PInvokeCore.CreatePen(PEN_STYLE.PS_SOLID, cWidth: 1, (
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.ControlText));
182
s_grabHandlePen = PInvokeCore.CreatePen(PEN_STYLE.PS_SOLID, cWidth: 1, (
COLORREF
)(uint)ColorTranslator.ToWin32(SystemColors.Window));
System\Windows\Forms\Design\OleDragDropHandler.cs (1)
444
PInvokeCore.SetBkColor(dc, (
COLORREF
)(uint)ColorTranslator.ToWin32(graphicsColor));
System.Windows.Forms.Primitives (15)
System\Windows\Forms\DeviceContextExtensions.cs (2)
101
/// Calls <see cref="PInvoke.GetNearestColor(HDC,
COLORREF
)"/> to get the nearest color for the given
119
Color newColor = ColorTranslator.FromWin32((int)PInvoke.GetNearestColor(hdc, (
COLORREF
)(uint)ColorTranslator.ToWin32(color)).Value);
Windows\Win32\PInvoke.ImageList.cs (8)
37
/// <inheritdoc cref="ImageList_DrawEx(HIMAGELIST, int, HDC, int, int, int, int,
COLORREF
,
COLORREF
, IMAGE_LIST_DRAW_STYLE)"/>
46
COLORREF
rgbBk,
47
COLORREF
rgbFg,
112
/// <inheritdoc cref="ImageList_SetBkColor(HIMAGELIST,
COLORREF
)"/>
113
public static
COLORREF
SetBkColor<T>(T himl,
COLORREF
clrBk) where T : IHandle<HIMAGELIST>
115
COLORREF
result = ImageList_SetBkColor(himl.Handle, clrBk);
Windows\Win32\PInvoke.SetLayeredWindowAttributes.cs (2)
8
/// <inheritdoc cref="SetLayeredWindowAttributes(HWND,
COLORREF
, byte, LAYERED_WINDOW_ATTRIBUTES_FLAGS)"/>
9
public static BOOL SetLayeredWindowAttributes<T>(T hwnd,
COLORREF
crKey, byte bAlpha, LAYERED_WINDOW_ATTRIBUTES_FLAGS dwFlags)
Windows\Win32\UI\Controls\Dialogs\CHOOSECOLORW.cs (2)
80
public
COLORREF
rgbResult;
99
public unsafe
COLORREF
* lpCustColors;
Windows\Win32\UI\Controls\Dialogs\CHOOSEFONTW.cs (1)
109
public
COLORREF
rgbColors;
System.Windows.Forms.Primitives.Tests (6)
System\Windows\Forms\Automation\TestAccessors.UiaTextRangeTestAccessor.cs (2)
49
public
COLORREF
GetBackgroundColor() => s_static.GetBackgroundColor();
57
public
COLORREF
GetForegroundColor() => s_static.GetForegroundColor();
System\Windows\Forms\Automation\UiaTextRangeTests.cs (4)
479
yield return new object[] { UIA_TEXTATTRIBUTE_ID.UIA_BackgroundColorAttributeId, (int)(uint)(
COLORREF
)PInvokeCore.GetSysColor(SYS_COLOR_INDEX.COLOR_WINDOW) };
484
yield return new object[] { UIA_TEXTATTRIBUTE_ID.UIA_ForegroundColorAttributeId, (int)(uint)default(
COLORREF
) };
1166
COLORREF
actual = StaticNullTextRange.TestAccessor().GetBackgroundColor();
1231
COLORREF
actual = StaticNullTextRange.TestAccessor().GetForegroundColor();
System.Windows.Forms.Primitives.TestUtilities (21)
DeviceContextState.cs (4)
58
public
COLORREF
BackColor { get => _currentState.BackColor; set => _currentState.BackColor = value; }
59
public
COLORREF
TextColor { get => _currentState.TextColor; set => _currentState.TextColor = value; }
75
public
COLORREF
BackColor { get; set; }
76
public
COLORREF
TextColor { get; set; }
Extensions\GdiExtensions.cs (1)
11
public static string ToSystemColorString(this
COLORREF
colorRef)
Metafiles\RecordTypes\EMRBITBLT.cs (1)
25
public
COLORREF
crBkColorSrc; // Source DC BkColor in RGB
Metafiles\RecordTypes\EMRCREATEBRUSHINDIRECT.cs (1)
25
public
COLORREF
lbColor;
Metafiles\RecordTypes\EMREXTCREATEPEN.cs (1)
33
public
COLORREF
elpColor;
Metafiles\RecordTypes\EMRSETCOLOR.cs (1)
23
public
COLORREF
crColor;
Metafiles\Validators\BrushColorValidator.cs (1)
14
public void Validate(DeviceContextState state) => Assert.Equal((
COLORREF
)_brushColor, state.SelectedBrush.lbColor);
Metafiles\Validators\BrushValidator.cs (1)
23
Assert.Equal((
COLORREF
)_brushColor, state.SelectedBrush.lbColor);
Metafiles\Validators\PenColorValidator.cs (1)
14
public void Validate(DeviceContextState state) => Assert.Equal((
COLORREF
)_penColor, state.SelectedPen.elpColor);
Metafiles\Validators\PenValidator.cs (1)
26
Assert.Equal((
COLORREF
)_penColor, state.SelectedPen.elpColor);
Metafiles\Validators\TextColorValidator.cs (1)
14
public void Validate(DeviceContextState state) => Assert.Equal((
COLORREF
)_textColor, state.TextColor);
SystemCOLORs.cs (7)
8
private static readonly Dictionary<
COLORREF
, List<SYS_COLOR_INDEX>> s_systemColors = CreateColorDictionary();
44
public static bool TryGetSystemColor(
COLORREF
colorRef, out List<SYS_COLOR_INDEX> colors)
47
public static string ToSystemColorString(
COLORREF
colorRef)
60
private static Dictionary<
COLORREF
, List<SYS_COLOR_INDEX>> CreateColorDictionary()
62
Dictionary<
COLORREF
, List<SYS_COLOR_INDEX>> dictionary = [];
72
COLORREF
colorRef = (
COLORREF
)PInvokeCore.GetSysColor((SYS_COLOR_INDEX)i);