For those that use VS2005, you can still use the code posted
as extension methods, by just converting them to plain old
static methods (non-extension methods), and passing the
DBText or MText objects to them as the first parameter. Just
remove the 'this' from first parameter declaration.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm
"Tony Tanzillo" wrote in message
news:6108262@discussion.autodesk.com...
The only option would be to use reflection.
The class below defines two extension methods for
DBText and MText that can be used in either release:
You use them just like they were methods of the
DBText and MText objects:
ObjectId GetTextStyleId();
void SetTextStyleId( ObjectId value );
[code]
{code}
public static class VersionCompatibleExtensionMethods
{
public static ObjectId GetTextStyleId( this DBText instance )
{
if( textStyleProperty != null )
return (ObjectId) textStyleProperty.GetValue( instance, null );
else
throw new MissingMemberException();
}
public static ObjectId GetTextStyleId( this MText instance )
{
if( mtextStyleProperty != null )
return (ObjectId) mtextStyleProperty.GetValue( instance, null );
else
throw new MissingMemberException();
}
public static void SetTextStyleId( this DBText instance, ObjectId value )
{
if( textStyleProperty != null )
textStyleProperty.SetValue( instance, value, null );
else
throw new MissingMemberException();
}
public static void SetTextStyleId( this MText instance, ObjectId value )
{
if( mtextStyleProperty != null )
mtextStyleProperty.SetValue( instance, value, null );
else
throw new MissingMemberException();
}
static VersionCompatibleExtensionMethods()
{
textStyleProperty = typeof( DBText ).GetProperty( "TextStyle" );
if( textStyleProperty == null )
textStyleProperty = typeof( DBText ).GetProperty( "TextStyleId" );
mtextStyleProperty = typeof( DBText ).GetProperty( "TextStyle" );
if( mtextStyleProperty == null )
mtextStyleProperty = typeof( DBText ).GetProperty( "TextStyleId" );
}
private static PropertyInfo textStyleProperty = null;
private static PropertyInfo mtextStyleProperty = null;
}
{code}
[/code]
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm
"C Witt" wrote in message
news:6108204@discussion.autodesk.com...
yes
Work: VISTA Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB
Home: VISTA Ultimate x64 - AMD 64 Quad Core 2.2GHz, 8 Gigs Ram, GeForce
8600GT 512MB
Laptop (17" HP): VISTA Premium x32 - AMD Turion X2 Dual Core TL-50 1.6GHz, 2
Gigs Ram, Nvidia GeForce 6150
Tony Tanzillo wrote:
Are you using Visual Studio 2008 ?