Copyright © 1998-2010 MultiMedia Soft

Texture object

Previous pageReturn to chapter overviewNext page

The Texture object is internally implemented as a COM interface called ITexture and contains information about the management of textures that are applied on the button surface.

It can be used at Run-time in order to change the settings of the TextureSurface property, based upon this object (in order to perform changes to texture settings at Design-time see the How to apply a texture to the button surface section).

The Texture object is implemented through the following properties:

Filepath

Mode

LightIntensity

ColorToMix

PercentageColorMix

 

 

The following code snippets show how to modify the texture object in your code. These examples assume that you have placed a control named MyButton on a form or dialog. The object is to change the texture at run-time.

Microsoft Visual C++ (4.0, 5.0 and 6.0)

Microsoft Visual C++.NET (2003)

Microsoft Visual Basic (5.0 and 6.0)

Microsoft Visual Basic.NET (2003)

Microsoft Visual C#.NET (2003)

Microsoft Visual J#.NET (2003)

 

Microsoft Visual C++ (4.0, 5.0 and 6.0)

Properties and methods of the control are accessible through the control wrapper class CBtnEnh contained inside the BtnEnh.cpp and BtnEnh.h files: these wrapper files are automatically generated when you insert the control inside your project so, in order to access the wrapper functions, you will have to insert the following line of code somewhere in your code.

 

#include "BtnEnh.h"

 

The Texture object is defined by the control wrapper class CTexture contained inside the Texture.cpp and Texture.h files: also these wrapper files are automatically generated when you insert the control inside your project so, in order to access this object, you will have to insert the following line of code somewhere in your code.

 

#include "Texture.h"

 

Here follows the code needed to perform the requested operation of changing the texture picture file.

// change the texture picture file

texture = MyButton.GetTextureSurface ().SetFilepath ("c:\\MyTexture.jpg");

 

As you can see the access to the TextureSurface property is wrapped by the GetTextureSurface function declared inside the wrapper class CBtnEnh, while the access to the Texture property Filepath is wrapped by the SetFilepath function declared inside the wrapper class CTexture.

 

Microsoft Visual C++.NET (2003)

With this new development environment, the creation of wrapper classes for ActiveX control is not an easy operation and, while this documentation is being written, it seems to suffer some annoying bug. For this reason 3D Active Button Magic comes with the needed wrapper classes inside the directory "wrappers\cpp.net", created by the product installation package. What you have to do is to add the wrapper classes to your project and use them as described inside the How to use the control in your projects.

As for the previous versions of Visual C++, properties and methods of the control are accessible through the control wrapper class CBtnEnh contained inside the BtnEnh.cpp and BtnEnh.h files: in order to access the wrapper functions, you will have to insert the following line of code somewhere in your code.

 

#include "BtnEnh.h"

 

The Texture object is defined by the control wrapper class CTexture contained inside the Texture.cpp and Texture.h files: in order to access this object, you will have to insert the following line of code somewhere in your code.

 

#include "Texture.h"

 

Here follows the code needed to perform the requested operation of changing the texture picture file.

// change the texture picture file

texture = MyButton.GetTextureSurface ().SetFilepath ("c:\\MyTexture.jpg");

 

As you can see the access to the TextureSurface property is wrapped by the GetTextureSurface function declared inside the wrapper class CBtnEnh, while the access to the Texture property Filepath is wrapped by the SetFilepath function declared inside the wrapper class CTexture.

 

Microsoft Visual Basic (5.0 and 6.0)

Here follows the code needed to perform the requested operation of changing the texture picture file.

' change the texture picture file

MyButton.TextureSurface.Filepath = "c:\MyTexture.jpg"

 

Microsoft Visual Basic.NET (2003)

Here follows the code needed to perform the requested operation of changing the texture picture file.

' change the texture picture file

MyButton.TextureSurface.Filepath = "c:\MyTexture.jpg"

 

Microsoft Visual C#.NET (2003)

Here follows the code needed to perform the requested operation of changing the texture picture file.

// change the texture picture file

MyButton.TextureSurface.Filepath = "c:\MyTexture.jpg";

 

Microsoft Visual J#.NET (2003)

Here follows the code needed to perform the requested operation of changing the texture picture file.

// change the texture picture file

MyButton.get_TextureSurface ().set_Filepath ("c:\\MyTexture.jpg");

 

As you can see in J#.NET the access to the button properties is made through the use of wrapper functions (automatically generated when you insert the control inside your project) with the "get_" and "set_" prefixes. Intellisense will help you finding the right wrapper function.