This repo contains the foundational libraries that make up the .NET Core development stack.
carlossanlop on 2.1
carlossanlop on 2.1
carlossanlop on 2.2
carlossanlop on 2.2
carlossanlop on 3.0
carlossanlop on 3.0
carlossanlop on 3.1
carlossanlop on 3.1
carlossanlop on 3.1
carlossanlop on 3.1
Merged PR 26805: Build Microsof… Backport SqlClient 659 to relea… Merged PR 26813: Remove Debian.… and 11 more (compare)
carlossanlop on 3.1
private void SimulateTransparency(PaintEventArgs pevent)
{
//simular transparencia
var graphicsContainer = pevent.Graphics.BeginContainer();
pevent.Graphics.TranslateTransform(-Left, -Top);
var paintEvents = new PaintEventArgs(pevent.Graphics, Bounds);
base.InvokePaintBackground(Parent, paintEvents);
base.InvokePaint(Parent, paintEvents);
pevent.Graphics.ResetTransform();
pevent.Graphics.EndContainer(graphicsContainer);
}
protected override void OnPaint(PaintEventArgs pevent)
{
int radius = 5;
SimulateTransparency(pevent);
pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
Color fillColor, textColor;
if (AccessibilityObject.State == AccessibleStates.HotTracked)
{
fillColor = ControlPaint.Light(BackColor);
textColor = ForeColor;
}
else if (AccessibilityObject.State == AccessibleStates.Pressed)
{
fillColor = ControlPaint.Dark(BackColor);
textColor = ForeColor;
}
else if (!Enabled)
{
fillColor = ControlPaint.LightLight(BackColor);
textColor = ControlPaint.Light(ForeColor);
}
else
{
fillColor = BackColor;
textColor = ForeColor;
}
using (var path = RoundedRect(ClientRectangle, radius))
using (var backBrush = new SolidBrush(fillColor))
using (var frontBrush = new SolidBrush(textColor))
{
pevent.Graphics.FillPath(backBrush, path);
pevent.Graphics.DrawString(Text, Font, frontBrush, ClientRectangle, stringFormat);
if (Focused && ShowFocusCues)
{
var rect = ClientRectangle;
rect.Inflate(-radius, -radius);
ControlPaint.DrawFocusRectangle(pevent.Graphics, rect, ForeColor, BackColor);
}
}
}
isHot
variable should do the trick.
DebugType=embedded
Hello,
I have a System.Text.Json problem. I recently upgraded my API code to .NET 5, and I'm looking into converting the serialization provider from JSON.NET to System.Text.Json. Standard serialization/deserialization works fine, but I'm having trouble converting a particular pattern.
In my API I have a few places where I distinguish between null inputs and undefined in the input JSON. Specifically, null means "remove this value" and undefined means "keep this value as it is".
The way I've implemented this is with the approach described here: https://github.com/alberto-chiesa/SettableJsonProperties. I have a type Optional<T>
which distinguishes between null and undefined, an OptionalJsonConverter
which converts literal null properties to null and omitted properties to undefined, and a custom contract resolver that relies on the ShouldSerialize-metod, as described here: https://github.com/alberto-chiesa/SettableJsonProperties/blob/master/SettableContractResolver.cs.
STJ doesn't have custom contract resolvers (dotnet/runtime#31257, dotnet/runtime#36785 ), nor any sort of equivalent of the "ShouldSerialize" pattern, as far as I can tell. I can't figure out a decent workaround, so I'm basically stuck here. Has anyone else done anything similar?