Tuesday, January 30, 2007

Touching .NET


again long time no post :-( Well, as always: friends, family and my studies are more important and time is limited...

But I finally managed to have a look at .NET and C#. As you perhaps know, I code Java and C/C++ (with Windows API) for some time. And I'm pretty impressed!
C# looks as I could like it - but as I'm used to Java I have still some problems to find the right commands. And a C language without real pointers? Unusual ;-)
But it seems that you can really fast develop windows applications. Compared to GUI Programming with Windows API, it's like heaven!

Interestingly it remembered me coding with Delphi and its VCL several years ago. So Microsoft needed more 5 years longer than Borland to provide us coders with a useful 'forms designer'. Better late than never...

Currently I'm working with Visual Studio 2003 and .NET FrameWork 1.1; I really like it although it's always difficult to dive into a new language. I thought as a first project (to get familiar with all those new things) of a simple Brainfuck Interpreter. I know, there are more than enough to find in the www, but I wanted to start easy :-)

Started some days ago, I found some strange things. Most annoying till now was the RichtextBox control. I derived a new class from it just to add some simple special functionality. Surprisingly that was not that easy!
* There is no function to get the line and column of the caret - you have to code it yourself (column is not that easy).
* You can specify automatic scrollbars if the content fits not into the visible area. But how to set/get the position of a scrollbar (as with GetScrollPos/SetScrollPos in WinAPI)? How to scroll by code?
In the end, I created my own scrollbar as a child window of the richtext control, but that meant some work and still contains errors... Not the best solution.
* Also using syntax highlighting/coloring (for which the richtextbox was designed) need pretty much programming effort.

Well, I thought these things would be easier than they actually are. Hopefully in Framework 2.0 or 3.0 there are some improvements concering these points.

So in the next days I want to continue coding... hope it progresses faster.

Till then, here is a image from the current status: (as you see, still a lot to do)