.net

Get current console font info

给你一囗甜甜゛ 提交于 2021-02-08 04:45:53
问题 I am writing an Image Viewer in C# .NET for the console. My problem is that the console font characters are not squares. And I'm treating them as pixels, this stretches the images when drawn on screen. I want to somehow read the font information about the currently used font, with width , height etc properties... I found this answer, but it seems like it just lists all the currently available fonts. I played around with this code: [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct

Custom TreeNode bounds

a 夏天 提交于 2021-02-08 04:37:58
问题 How to extend the standard mouse behavior of a TreeView node (like selecting, hot tracking, expansion on double click etc.) over a wider node area? I've got a custom-drawn node that has a wider label than it would have if it was system-drawn and it only reacts to mouse actions when the cursor is within the ordinary node bounds. Any Ideas? BTW, intercepting TVM_GETITEMRECT and TVM_HITTEST won't do the trick. A few words about what I'm doing: I'm developing a WinForms tree control that normally

Custom TreeNode bounds

狂风中的少年 提交于 2021-02-08 04:37:25
问题 How to extend the standard mouse behavior of a TreeView node (like selecting, hot tracking, expansion on double click etc.) over a wider node area? I've got a custom-drawn node that has a wider label than it would have if it was system-drawn and it only reacts to mouse actions when the cursor is within the ordinary node bounds. Any Ideas? BTW, intercepting TVM_GETITEMRECT and TVM_HITTEST won't do the trick. A few words about what I'm doing: I'm developing a WinForms tree control that normally

How to run a Windows.Forms C# program from Terminal in OSX?

与世无争的帅哥 提交于 2021-02-08 04:00:43
问题 I have to use System.Windows.Forms for my C# course in school but I own a Macbook and Visual Studio says that it doesn't exist. I read that I could use WinForms if I installed Mono and then compile and run it from terminal using mcs hello.cs -pkg:dotnet . "hello.cs" is just a Hello World program using System.Windows.Forms... it compiles but when I do mono hello.exe it says: WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at

An item with the same key has already been added - Just in Release mode

南楼画角 提交于 2021-02-08 03:45:29
问题 Experts, I'm getting this System.ArgumentException ( An item with the same key has already been added ) at the very first use of an entity framework function at runtime. The strange thing: If I'm using debug mode, it works fine. After compiling the same code without any changes made in release mode , it crashes immediatly with exception mentioned at top of this post. Does anyone know more about such a strange behaviour? How can I fix it? I cannot roll out a debug version to my customer :(

How to correctly send json data via Net.WebRequest - PowerShell

两盒软妹~` 提交于 2021-02-08 03:43:20
问题 I am working on a powershell script to post json data to a REST interface and am getting (400) Bad Request on each time. I am new to this, and am unclear as to if/how I should be encoding the data. I know I need to set the contenttype to application/json, but is the encoding choice I am using what is causing my problem, and if so what should I be using? $cred = New-Object System.Net.NetworkCredential -ArgumentList $authUser,$authPass $url = 'http://localhost:8080/alfresco/service/api/people'

Failure using ilasm, but no reason given

时光总嘲笑我的痴心妄想 提交于 2021-02-08 03:34:52
问题 I am trying to use ILASM and the process seems to abort with the following message: ***** FAILURE ***** How can I find out why it has failed? Can I turn on verbose messages or is there a log file I can look at? 回答1: While I realise that this is probably too late to help the question author now, I will leave these details here in case it helps someone in the future. I had a similar problem recently where Ildasm would enable me to disassemble some DLLs to ILs, but Ilasm would not let me

Failure using ilasm, but no reason given

徘徊边缘 提交于 2021-02-08 03:34:46
问题 I am trying to use ILASM and the process seems to abort with the following message: ***** FAILURE ***** How can I find out why it has failed? Can I turn on verbose messages or is there a log file I can look at? 回答1: While I realise that this is probably too late to help the question author now, I will leave these details here in case it helps someone in the future. I had a similar problem recently where Ildasm would enable me to disassemble some DLLs to ILs, but Ilasm would not let me

Entity Framework always save DateTimeOffset as UTC

巧了我就是萌 提交于 2021-02-08 02:21:12
问题 Is there a way that I can instruct Entity Framework to always store DateTimeOffset as the UTC value. Technically there is no reason for this but I prefer it if all the data in my database is consistent. Currently it is storing the DateTimeOffset as received from the client which could be anything depending on the users locale. I was thinking of perhaps intercepting all the SaveChanges method, looping through the changes, looking for DateTimeOffset types and doing the conversion explicitly,

Entity Framework always save DateTimeOffset as UTC

元气小坏坏 提交于 2021-02-08 02:19:47
问题 Is there a way that I can instruct Entity Framework to always store DateTimeOffset as the UTC value. Technically there is no reason for this but I prefer it if all the data in my database is consistent. Currently it is storing the DateTimeOffset as received from the client which could be anything depending on the users locale. I was thinking of perhaps intercepting all the SaveChanges method, looping through the changes, looking for DateTimeOffset types and doing the conversion explicitly,