This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First attempt | |
public static Bitmap GetBitmapFromHBitmap_1(IntPtr nativeHBitmap) | |
{ | |
var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap( | |
nativeHBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); | |
// There were missing parentheses here (they are important because this is integer arithmetic. | |
// Also worth noting, the code below only supports 32bpp images. In this case, stride | |
// is always equal to width, so a micro-optim would be to not compute the stride. | |
var stride = 4 * ((bitmapSource.PixelWidth * bitmapSource.Format.BitsPerPixel + 31) / 32); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if !IMAGESHARP_V2 | |
using System; | |
using System.Collections.Generic; | |
using System.Numerics; | |
#endif | |
using SixLabors.ImageSharp; | |
using SixLabors.ImageSharp.Drawing; | |
namespace RoundedRectangleTest | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
// https://stackoverflow.com/questions/66002667/pinvoking-user32-dll-setwindowcompositionattribute-via-powershell | |
public static class NativeMethods | |
{ | |
[DllImport("user32.dll")] | |
public static extern bool SetForegroundWindow(IntPtr hWnd); | |
[DllImport("user32.dll")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace Rextester | |
{ | |
// See https://csharp.2000things.com/tag/captured-variable/ | |
internal static class Program | |
{ | |
public static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NB: "Time Synchronization" is "Synchronisation date/heure" in French | |
$principal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) | |
if (-Not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { | |
Write-Host "Elevated privileges are required." | |
Start-Process -FilePath "powershell" -ArgumentList "$('-File ""')$(Get-Location)$('\')$($MyInvocation.MyCommand.Name)$('""')" -Verb runAs | |
exit | |
} | |
Write-Host "--- Synchronizing your docker time ---" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text.RegularExpressions; | |
using System.Xml; | |
using System.Xml.Linq; | |
namespace GithubWikiDoc | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace ConsoleApplication1 | |
{ | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var s1 = "Immutable String"; | |
var s2 = "Immutable String"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Gets or sets a value indicating whether top-level menu items should be rendered upper case or not. | |
/// </summary> | |
/// <remarks> | |
/// Setting this property to <c>true</c> helps in simulating a VS2012/2013 style. | |
/// </remarks> | |
public bool EnableUpperTopLevelCaseMenuItems { get; set; } | |
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<MMC_ConsoleFile ConsoleVersion="3.0" ProgramMode="Author"> | |
<ConsoleFileID>{549E388B-04AD-48CA-B7AC-4A781F265215}</ConsoleFileID> | |
<FrameState ShowStatusBar="true"> | |
<WindowPlacement ShowCommand="SW_SHOWNORMAL"> | |
<Point Name="MinPosition" X="-1" Y="-1"/> | |
<Point Name="MaxPosition" X="-1" Y="-1"/> | |
<Rectangle Name="NormalPosition" Top="145" Bottom="761" Left="110" Right="1129"/> | |
</WindowPlacement> | |
</FrameState> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<MMC_ConsoleFile ConsoleVersion="3.0" ProgramMode="Author"> | |
<ConsoleFileID>{01801879-32DE-4F21-9E1C-497141CCAD41}</ConsoleFileID> | |
<FrameState ShowStatusBar="true"> | |
<WindowPlacement ShowCommand="SW_SHOWNORMAL"> | |
<Point Name="MinPosition" X="-1" Y="-1"/> | |
<Point Name="MaxPosition" X="-1" Y="-1"/> | |
<Rectangle Name="NormalPosition" Top="203" Bottom="945" Left="154" Right="1414"/> | |
</WindowPlacement> | |
</FrameState> |
NewerOlder