Loading...

Author Archives: JohnStewien

Bing Maps 3D – A Dashed Line With Constant Spacing

I was only going to write 3 Bing Maps 3D posts (they start Here), but today I added something that I thought was rather cool.
You can download the source code for this post here 3DViewerBingMaps.zip
In OpenGL you can draw something called a Stippled Line which is basically a dashed line with some extra control over [...]

Rendering an un-parented WPF Visual to a bitmap

The source code for this post can be found here ParentlessButton.zip
A co-worker had a problem today and asked for my help. He was using the Chart control from the WPF Toolkit and wanted to render it to a bitmap and save it to a file without actually adding the Chart to the visual tree. There [...]

Bing Maps 3D – Clipping shapes with an imposter Earth

The final source code for these Bing Maps 3D posts can be found here 3DViewerBingMaps.zip. You will also need to install Bing Maps 3D from Microsoft.
This is the 3rd part of my posts on Bing Maps 3D. The 3 parts are:
- Adding Arbitrary Shapes. Creating a Cube mesh and a Sphere mesh.
- Rendering shapes [...]

Bing Maps 3D – Rendering shapes past the Far Clip

The final source code for these Bing Maps 3D posts can be found here 3DViewerBingMaps.zip
This is the 2nd part of my posts on Bing Maps 3D. The 3 parts are:
- Adding Arbitrary Shapes. Creating a Cube mesh and a Sphere mesh.
- Rendering shapes past the Far Clip. How to render shapes whose coordinates are [...]

Bing Maps 3D – Adding Arbitrary Shapes

The final source code for these Bing Maps 3D posts can be found here 3DViewerBingMaps.zip
Recently I have been implementing a 3D Viewer application based on Bing Maps 3D which you can download from Here. From this work I have generated enough material for a few posts, they will be as follows:
- Adding Arbitrary Shapes. Creating [...]

Reading the Portable Executable (PE) header in C#

My job consists of writing fully custom applications for groups of people. The time pressure of these projects is quite high, so generally people start using the application while I’m still writing it, which means I write it modularly and add features as I go along. I also fix bugs as they are discovered. My [...]

C++ pointers to non-static functions

Something that you don’t see very often in C++ are pointers to non-static class functions. Here’s a simple non functional demonstration of using a pointer to a non-static function:
class A
{
public:
      void Test(int& in)
      {
      }
};
 
int _tmain(int argc, _TCHAR* argv[])
{
void (A::*f)(int&); // Declare f
      f = &A::Test;       // Assign f
      A* obj1 = new A();  // [...]

Handling all mouse movements at the top Main Form level in C#

In a C# WinForms application, mouse movement events always go to the child control that the mouse moves over. Sometimes you might want to track mouse movements at the Form level instead of handling them at the child control level. To do this you need to handle the raw windows messages at the application level. [...]

How to show a Child Window from a Console window in C#

An amusing little example I came up with of how to open a window that is a child window of a console window. Just in case I need it in the future. Also useful for spawning a window from an OpenGL app, or hanging a child window off a separate thread.
// This is an example [...]

C# WPF Anonymous Delegate

I had a WPF application with some background tasks that intermittently updated their status properties. These properties were bound to some WPF controls, so the updates had to be dispatched on the main window thread. This is simple enough, you just call Dispatcher.Invoke on a delegate.
 
You can do it like this:
private delegate void SetDelegate(DependencyProperty prop, [...]