Jan Schreuder on .Net

.Net code samples, experiences, observations

View my professional profile on LinkedIn

Recent Posts

Tags

News

  • Inappropriate comments will be deleted at my discretion.

    The information and code samples in this weblog is provided "AS IS" without warranty of any kind, either expressed or implied, including but not limited to the merchantability and/or fitness for a particular purpose.

Community

Email Notifications

Tool suppliers

Tools

General

Microsoft

Favorite blogs

Archives

August 2005 - Posts

Design Guidelines for Class Library Developers

In the article I wrote recently about my views towards software development, I already mentioned that I keep my own set of libraries with me at all times. That library is also available to my colleagues and I regularly place updates on our companies Intranet. I was planning to write an article on developing class libraries when I found the Design Guidelines for Class Library Developers on MSDN. So no need to write that article anymore as a lot of what I would have wanted to say is mentioned in these guidelines.

Windows Media Center Promotional video

Jelle Kooi, a very good friend of mine, sent me a link to a video made by Tony Krijnen, who is an IT Pro Technology Advisorwith Microsoft. The video shows you why you need a Windows Media Center PC. I obviously agree, but I still can't seem to convince my wife.

Why Tony made the video can be read on his website. If you wanna see the video, you can click here to download it.

ASP.Net Security practices

A new MSDN document presents a set of consolidated practices designed to address ASP.NET version 2.0 security issues.

"The answers and recommendations presented in this module are tight distillations designed to supplement the companion modules and additional guidance. The practices are organized by various categories that represent those areas where mistakes are most often made."

The document contains a long list of How to stuff concerning security in ASP.Net. A number of them can also be applied to ASP.Net 1.1. I think it is a great list for all sorts of security related ASP.Net issues.  Some example links:

XP Powertoys

Just found this list of Powertoys for XP at the Microsoft website. Among tools are some really cool ones, especially if you're into digital photography:

And there's more. So definitely worth taking a look at!

XP Tweaks

I was looking for a registry patch to help Dennis van der Stelt. He was working on a machine where the Search option was missing. I found it here, at Kelly's korner. This page contains a large list of registry patches and tweaks to solve problems on XP machines.

Posted: Aug 11 2005, 10:26 AM by Jan Schreuder | with 2 comment(s)
Filed under:
.Net versus Java

You gotta read this. There's a really good discussion going on which of the two is better. I found the link on MSDN. Valid comments are made to support either one. You all know my preference.

Posted: Aug 04 2005, 02:31 PM by Jan Schreuder
Filed under:
How to: Tweak the Crystal Reports Viewer control

Novita Wegbrands, a colleague of mine, needed to hide the tabs that are usually shown in the Crystal reports viewer. Either that, or change the default "MainReport" description. She found some code here on forums.belution.com/en/crystal that suited her needs. She sent the code to me (thanks Novita!) and I changed them a little so they would fit my library of Crystal Helper classes. So here's what we have now.

Show / Hide the status bar

By default, the Crystal Reports viewer shows a status bar at the bottom to indicate the current page, the total number of pages and the current zoom factor. But maybe you'd like to hide it. No problem, the following code will do just that:

public void ViewerStatusBar(CrystalReportViewer viewer, bool visible)
{
    foreach (Control control in viewer.Controls)
    {
        if (control.GetType().Name.ToString() == "StatusBar")
        {
            control.Visible = visible;
        }
    }
}
 

Show / Hide the tabs

The Crystal Reports viewer will also display tabs for the report. By default there is always one. But when it not possible to perform a drill-down in a report then this tab is virtually useless. Using the following code, you can hide those tabs:

public void ViewerTabs(CrystalReportViewer viewer, bool visible)
{
    foreach (Control control in viewer.Controls)
    {
        if (control is PageView)
        {
            TabControl tab = (TabControl)((PageView)control).Controls[0];
            if (!visible)
            {
                tab.ItemSize = new Size(0, 1);
                tab.SizeMode = TabSizeMode.Fixed;
                tab.Appearance = TabAppearance.Buttons;
            }
            else
            {
                tab.ItemSize = new Size(67, 18);
                tab.SizeMode = TabSizeMode.Normal;
                tab.Appearance = TabAppearance.Normal;
            }
        }
    }
}
 
The ItemSize that is created on the tab control is a default size. Because the SizeMode property is set to Normal, Crystal Reports will automatically scale the tab to fit the name.

Change the name of the tab

As stated before, the default name for the first tab is usually MainReport. It is possible to change this by using the following code:

How to: Create the perfect bugreport

As a developer, I always get to see bugreports entered by testers. These bugreports are not always as helpful as you want them to be. If you're a developer you probably know what I mean: "App X does not work correct"...

The Visual Studio Team Systems team have written an really good and concise article on what they think a good bugreport should look like. Of course, the article is directed at the testing communitiy. But I think it contains a lot of information that developers can use too. Now these are of course the Microsoft rules, but the remarks made by the VSTS team are applicable to all types of software development.

I think it is a must read for testers. And to us software developers, here's something to throw at those pesky testers that make our lives miserable at times.

Click here for the document on MSDN

How to: Add an image to XP style buttons

Last week, I needed to add an image to a button. Not a problem of course, unless you need to switch to XP style buttons. When you do, your image simply disappears. I was at the point of accepting this, since the Microsoft documentation for the Button.FlatStyle property reads as follows:

If the System style is used, the appearance of the control is determined by the user's operating system and the following property values will be ignored: Control.BackgroundImage, ImageAlign, Image, ImageIndex, ImageList, and TextAlign. In addition, the Control.BackColor property will be ignored for button controls. If supported, users can change the appearance of controls by adjusting the appearance settings of their operating system.

Too bad I thought. My customer doesn't want to buy expensive controls, just to support an image on one button. So we can't do it. But I searched some more on the internet and bumped into Andrew Ma's blog on MSDN. He solved the problem by inheriting from the System.Windows.Forms.Button class and then handle the WM_PAINT message and draw the image himself. You can find the code here. I'm adding it to my libraries.

A really cool solution to my problem, as you can see here: