System.Drawing Line Curve fun

One of my goals after Brent’s DNUG talk was to port my old QuickBasic Line Curve (not sure what other people call them) to C# code. So this evening that’s what I’ve been doing.

My first big thanks is to the Visual Studio team, because VS2005 can open and understand old QuickBasic .BAS files. I’m sure it actually basic of VB.Net, but it colour codes correctly and every thing. This made cut-n-pasting the code so much easier. Previously I’d opened QB and screen scraped it out 19 lines at a time.

An odd side effect of this was that when I had a .BAS file open, and did a Solution Build, the .BAS file would be compiled and it’s errors highlighted, even though it is not in any of my projects. So I keep closing and opening the file. Only with the power of hindsight do I even think of the remotely clever idea I opening it file in a second instance of VS.

So I got the code drawing the pretty graph. In the original I had it animated to appear to scroll, giving a pseudo 3D effect. Which I’d always wanted to use in a game. So I rigged up the MouseWheel event. For quite some time I couldn’t get it to work. I finally wired up MouseClick and then the mouse wheel event would fire after the first click. It appears to be a focus related issue, so I made my panel get Focus() when ever the MouseEnter event fires.

It is working pretty neat I think. The only current bug is the scrolling is done by drawing the four sub-polygon in each polygon, but you can see a tear between polygons as the outer points are not common. This will be my next task to fix.

After that I want to be able to drag the three control points of the graph around. I have some ideas that should be cool for focus of the drag points. So I’m looking forward to battling with those.

Updated 17 Dec 2005: You can download the code from here

Line curve
Line curve, showing gaps

A Sprint through System.Drawing

Just got back from the .Net user group meeting on the System.Drawing namespace. Brent Clark did a good presentation, with plenty of code, examples and a refresher amount of theory.

He showed how to do custom lists, and drawing on a panels, plus other bits. This is exactly what I have been wondering how to do, so I can now re-code my old Quick Basic, and line algorithms to C#. I’m looking forward to downloading his demo code and having a play.

Reading Visual Basic took a bit to workout how it mapped to C# syntax, but it was not undo-able.

The free pizza was great and Peter gave out some free Magazines at the beginning so I now have an International Developer to read.

SQL Server 2005 Overview

I have just returned from the Christchurch .Net User Group meeting on SQL Sever Overview. Darryl Burling was a good presenter. He had a large deck of slides to present, so it was really a fly by night, taste in the month of what’s coming. I think if this meeting had been before the SQL Reporting Services meeting, that one would have had a larger attendance, as Adam covered most of the tasty bits, but in more detail.

So while the guts of the presentation could have been learnt via other sources, it was nice to have it woven together by a live presenter.

It was a good turn out, and nice to put a few faces to names.

SQL Reporting Services 2005

I went to a .Net User Group meeting last night. It was hosted at SunGard and Adam Cogan was the presenter. He gave a good talk about the features of SQL Reporting Services 2005, with a few side stories while the designer was busy “designing”. The Design tools were very slow at times, but he was running a beta version under virtual PC, so there is room for forgiveness. That mixed with I not sure how much work was been done behind the scenes.

But really what impressed me was how simple it was to click and drop it all together. I really like the Client report building, that feature would come in handy here at work.

All’n’all I really useful piece of software. For new development Business Objects must be packing them selves.

One of the good titbits was Adam explaining how he deploys database applications, and how he thinks it’s the application responsibility to set-up the server correctly. He showed how they laid the files out, and how the application did the checking and loading of .sql and .rpt files.

But the highlight of the evening was wining a free MSDN Polo Shirt.