January 2007 Archives

CrystalImageGridView Demo
The latest Crystal Toolkit version 0.70 has an early alpha version of classes to help you build image viewers using thumbnails. You may have seen the Microsoft Office Picture Viewer, which has a nice filmstrip view of thumbnails in a splitter like view. I wanted to build an image grid view control that has that nice look and feel, but I also wanted to build it in a classic model-view-controller pattern. And I also wanted to have my control use other tools to automatically thumbnail image folders that I need to browse.

Image Grid Vertical
CrystalImageGridView does all of this, working with CrystalImageGridModel, CrystalFileCollector, and the CrystalThumbnailer to provide all of these features. You can see from the screenshots (this demo is included in the zip file on the Downloads page) that you can view the thumbnails docked in the split container on the bottom. Click on the left hand button on the upper toolbar and the split container expands the thumbnail view to fill the client area.

I'll have more bug fixes, little features, and documentation to write later. If you want to play around with this control, do the following:

1. Build Crystal Toolkit and add a reference to your Form project.
2. Drag CrystalImageGridView from the toolbox to your Form, preferrably to a split container.
3. Hook up the Load event to your Form and add this code to the method:

CrystalFileCollector _collector = 

    new CrystalFileCollector();

_collector = new CrystalFileCollector();

_collector.AddView(crystalImageGridView1);

_collector.CollectImages();


It's that easy. Run this simple form you just made, and the image grid starts previewing images from your MyPictures folder. The CrystalFileCollector spins off a background thread and pops the images into the grid as they are thumbnailed. If you don't like that location, you can modify the ImageLocation property.

More later, much more, I hope. If you have any comments, bug fixes, or whatever, contact me at richard {at} attilan [dot] com.

Crystal Toolkit is a Windows Forms (.NET Framework 2.0) control library written in C#. This is the fourth release and contains the following classes:

New in 0.70: Features.

CrystalImageGridView, CrystalFileCollector, CrystalThumbnailer:

- The Image Grid View class is a C# control that allows you to preview thumbnails in a scrollable grid view. You can dock this view in a split container in Windows Forms. There is a background thread that thumbnails the images from whatever folder you point it at. Don't like the way I thumbnail images or the way I store them? Implement my ICrystalThumbnailer interface and insert your own thumbnail class.

From previous version:

  • CrystalGradientControl: a control that can either have a gradient background or a transparent background.
  • CrystalLabel: a homegrown label control that can have a gradient or transparent background.
  • CrystalTrackBar: a homegrown trackbar that can have a gradient or transparent background.
  • CrystalToolStripTrackBar: a host for CrystalTrackBar that allows it to work in a ToolStrip.

Bonus: if you don't like CrystalTrackBar on a ToolStrip, this library also contains ToolStripTrackBar, which hosts System.Windows.Forms.TrackBar on the ToolStrip.

This release comes in a ZIP file. Simply unzip the contents to your hard drive, navigate to the root Attilan folder, and double click on CrystalDemo.sln. This solution file contains the Crystal Toolkit plus demo programs. Just build the solution (which compiles the CrystalToolkit library first) and run the demo programs to see how they work.

I've tested the demos under Windows XP SP2 and Windows Vista. Needless to say, buyers beware, this is alpha software and it's free open-source code: you get what you pay for! I'd welcome any feedback, bugs (or bug fixes), and thumb-bitmap replacements. Send email to richard [at] attilan {dot} com.

Download: Crystal Toolkit 070 (zip file, 880 kb)

Crystal Toolkit is a Windows Forms (.NET Framework 2.0) control library written in C#. This is the fourth release and contains the following classes:

New in 0.69: Bug fix.

The following bugs were fixed for CrystalTrackBar and CrystalToolStripTrackBar:

- TrackBar, Ticks, and Thumb not visible when TrackBarRenderer.IsSupported returns false. When this occurs, we draw these objects manually using DrawLine. Looks almost the same as the renderer.

From previous version:

  • CrystalGradientControl: a control that can either have a gradient background or a transparent background.
  • CrystalLabel: a homegrown label control that can have a gradient or transparent background.
  • CrystalTrackBar: a homegrown trackbar that can have a gradient or transparent background.
  • CrystalToolStripTrackBar: a host for CrystalTrackBar that allows it to work in a ToolStrip.

Bonus: if you don't like CrystalTrackBar on a ToolStrip, this library also contains ToolStripTrackBar, which hosts System.Windows.Forms.TrackBar on the ToolStrip.

This release comes in a ZIP file. Simply unzip the contents to your hard drive, navigate to the root Attilan folder, and double click on CrystalDemo.sln. This solution file contains the Crystal Toolkit plus demo programs. Just build the solution (which compiles the CrystalToolkit library first) and run the demo programs to see how they work.

I've tested the demos under Windows XP SP2 and Windows Vista. Needless to say, buyers beware, this is alpha software and it's free open-source code: you get what you pay for! I'd welcome any feedback, bugs (or bug fixes), and thumb-bitmap replacements. Send email to richard [at] attilan {dot} com.

Download: Crystal Toolkit 069 (zip file, 820 kb)

BUG: Invisible CrystalTrackBars
A little over a week ago, a user named MG reported a problem that I couldn't duplicate until now. When he ran the demo program CrystalTrackBarDemo.exe, all the CrystalTrackBar objects were invisible. No trackbar, no ticks, no thumb, only the gradient background remained on the non-transparent objects. After a second user reported this bug on the CodeProject article, I suddenly remembered about my usage of TrackBarRenderer.IsSupported in CrystalTrackBar OnPaint:

protected override void OnPaint(PaintEventArgs e)
{
    if (!TrackBarRenderer.IsSupported)
    {
        this.Parent.Text = 
            "CrystalTrackBar Disabled";
        return;
    }

    DrawTrackBar(e.Graphics);
    DrawTicks(e.Graphics);
    DrawThumb(e.Graphics);
}



On the MSDN Forum, Mick Doherty pointed out that TrackBarRenderer.IsSupported == VisualStylesRenderer.IsSupported. According to the documentation, one of the things that can make the VisualStylesRenderer is the VisualStyleInformation.IsEnabledByUser property. Users can enable visual styles in the Appearance tab of the Display option in Control Panel.

Windows Classic Style
I was able to reenact the bug by setting my Appearance setting for Windows and Buttons to Windows Classic Style (on XP: Control Panel->Display->Appearance tab). As some people are addicted to the old Windows NT look and feel, it makes sense this how they ran into the bug. When I ran my application again, TrackBarRenderer.IsSupported returned false and all I got was the rectangles, no trackbar or ticks.

I'll need to draw the TrackBar and Ticks myself if TrackBarRenderer isn't supported. I'm already drawing the Thumb, so this should be an easy bug to fix. I hope to have it posted in a few days.

Crystal Toolkit is a Windows Forms (.NET Framework 2.0) control library written in C#. This is the third release and contains the following classes:

New in 0.68: Bug fixes.

The following bugs were fixed for CrystalTrackBar and CrystalToolStripTrackBar:

- ProcessCmdKey failing to return true in CrystalTrackBar.
- ProcessKeystroke added for Forms using CrystalToolStripTrackBar.
- Various painting issues with both versions of the TrackBar.

From previous version:

  • CrystalGradientControl: a control that can either have a gradient background or a transparent background.
  • CrystalLabel: a homegrown label control that can have a gradient or transparent background.
  • CrystalTrackBar: a homegrown trackbar that can have a gradient or transparent background.
  • CrystalToolStripTrackBar: a host for CrystalTrackBar that allows it to work in a ToolStrip.

Bonus: if you don't like CrystalTrackBar on a ToolStrip, this library also contains ToolStripTrackBar, which hosts System.Windows.Forms.TrackBar on the ToolStrip.

This release comes in a ZIP file. Simply unzip the contents to your hard drive, navigate to the root Attilan folder, and double click on CrystalDemo.sln. This solution file contains the Crystal Toolkit plus demo programs. Just build the solution (which compiles the CrystalToolkit library first) and run the demo programs to see how they work.

I've tested the demos under Windows XP SP2 and Windows Vista. Needless to say, buyers beware, this is alpha software and it's free open-source code: you get what you pay for! I'd welcome any feedback, bugs (or bug fixes), and thumb-bitmap replacements. Send email to richard [at] attilan {dot} com.

Download: Crystal Toolkit 068 (zip file, 820 kb)

Install IIS 7.0 on Vista with Control Panel
If you're using Vista and wondering how to install IIS 7.0, the answer is in the screenshot above. While XP allowed you to install IIS from an Add/Remove programs dialog box, Vista has these features hidden in Control Panel > Programs > Turn Windows features on and off. Clicking on this item pops up a dialog box which contains Internet Information Services.

You have to do a few more things if you're expecting IIS 7.0 to work with the current Visual Studio 2005. VS 2005 needs to be run as an administrator and it communicates with IIS in the 6.0 compatibility mode. I've found a few links here that help get IIS 7.0 working with Visual Studio.

Scott Guthrie: Tip/Trick: Using IIS7 on Vista with VS 2005
Fix problems with Visual Studio F5 debugging of ASP.NET applications on IIS7 Vista
Enabling ASP.NET 2.0 Debugging on Visual Studio 2005, IIS 7.0 and Vista