Can’t use System.Windows.Forms

A console application does not automatically add a reference to System.Windows.Forms.dll. Right-click your project in Solution Explorer and select Add reference… and then find System.Windows.Forms and add it.

MSHTML DLL on Windows 10

I just created a blog post on this issue. The problem is that the Microsoft.mshtml.dll assembly in the Global Assembly Cache becomes unregistered from ActiveX during the upgrade process. To fix this issue, it is necessary to run “regasm” on the assembly: Open an instance of “Developer Command Prompt for VS2013” (or whatever version of Visual Studio … Read more

MSHTML DLL on Windows 10

I just created a blog post on this issue. The problem is that the Microsoft.mshtml.dll assembly in the Global Assembly Cache becomes unregistered from ActiveX during the upgrade process. To fix this issue, it is necessary to run “regasm” on the assembly: Open an instance of “Developer Command Prompt for VS2013” (or whatever version of Visual Studio … Read more

C# compiler error: “not all code paths return a value”

You’re missing a return statement. When the compiler looks at your code, it’s sees a third path (the else you didn’t code for) that could occur but doesn’t return a value. Hence not all code paths return a value. For my suggested fix, I put a return after your loop ends. The other obvious spot – adding an else that had a return value to the if-else-if – … Read more

How to Use TextureBrush for painting an Image

how to locally refer to the image (it is set to always copy) You can add the image to a resource file and then reference that Image from there within the code. (See link http://msdn.microsoft.com/en-us/library/7k989cfy%28v=vs.90%29.aspx) How to get the image centered in the square, and how to keep the image stationary when the square moves? This … Read more

How to Use TextureBrush for painting an Image

how to locally refer to the image (it is set to always copy) You can add the image to a resource file and then reference that Image from there within the code. (See link http://msdn.microsoft.com/en-us/library/7k989cfy%28v=vs.90%29.aspx) How to get the image centered in the square, and how to keep the image stationary when the square moves? This … Read more

What is the best way to implement a “timer”?

Use the Timer class. The Elapsed event will be raised every X amount of milliseconds, specified by the Interval property on the Timer object. It will call the Event Handler method you specify. In the example above, it is OnTimedEvent.