This article is about exploring the ability to create custom controls in the .NET platform, that make use of Windows XP's visual styles and themes. To that end, I have included a couple of fairly simple controls that mimic some of the behaviors that Windows Explorer implements in XP.
|
#include "StdAfx.h"
#include ".\themeitemenumerator.h"
#using <mscorlib.dll>
using namespace System;
using namespace System::Windows::Forms::Themes;
ThemeItemEnumerator::ThemeItemEnumerator( IThemeItemCollection* collection )
{
m_Collection = collection;
m_CountCache = m_Collection->Count;
Reset();
}
ThemeItemEnumerator::~ThemeItemEnumerator(void)
{
}
System::Object* ThemeItemEnumerator::get_Current()
{
try
{
return m_Collection->GetEnumeratorItem( m_CurrentIndex );
}
catch ( System::IndexOutOfRangeException* )
{
throw new System::InvalidOperationException();
}
}
bool ThemeItemEnumerator::MoveNext()
{
m_CurrentIndex++;
return m_CurrentIndex < m_CountCache;
}
void ThemeItemEnumerator::Reset()
{
m_CurrentIndex = -1;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
The first computer program I ever wrote was in BASIC on a TRS-80 Model I and it looked something like:
10 PRINT "Don is cool"
20 GOTO 10
It only went downhill from there.
Hey look, I've got a blog