Copyright © 1998-2010 MultiMedia Soft

CellsManager object

Previous pageReturn to chapter overviewNext page

The CellsManager object is internally implemented as a COM interface called ICellsManager and contains information needed to manage cells that will be displayed over the control surface.

It can be used at Run-time to add, remove and change the cells settings, through the CellsManager property (in order to perform changes to cells settings at Design-time, take a look to the How to manage cells section).

The CellsManager object is implemented through the following:

Properties

ScaleUnit

Visible

Text

TextDescriptor

PictureNormal

TextHorzAlign

TextVertAlign

PictureHorzAlign

PictureVertAlign

BackColor

BorderColor

BorderWidth

PictureDisabled

PictureTranspFactor

BackTranspFactor

 

Methods

CellAdd

CellDelete

CellGetCount

CellFind

CellGetLogFont

CellSetLogFont

CellGetUniqueID

CellGetPos

CellSetPos

CellGetSize

CellSetSize

CellSetPictureFromHandle

 

The following code snippets show how to modify this object in your code. These examples assume that you have placed a control named MyButton on a form or dialog. The object is to add at run-time two cells, set their border to be 1 pixel wide and change their text color to green and blue..

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

Microsoft Visual C++.NET

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 CellsManager object is defined by the control wrapper class CCellsManager contained inside the CellsManager.cpp and CellsManager.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 "CellsManager.h"

 

Here follows the code needed to perform the requested operation of creating two cells

// declare a CellsManager object

CCellsManager cellsMan;

 

// init the object with the control's CellsManager

cellsMan = MyButton.GetCellsManager ();

 

// add cell with Unique ID 1000 and set a border of 1 pixel

cellsMan.CellAdd (1000, 0, 0, 50, 50, "Cell 0");

cellsMan.SetBorderWidth (1000, 1);

 

// add cell with Unique ID 1001

cellsMan.CellAdd (1001, 50, 50, 50, 50, "Cell 1");

cellsMan.SetBorderWidth (1001, 1);

 

Now we want to change the text's colors for both cells; text's settings are implemented exactly in the same way as other texts available on the button, so they are accessible through a TextDescriptor object, implemented through the TextDescriptor property: this means that we will have to add the declaration of this object adding the following line of code somewhere in your code.

 

#include "TextDescriptor.h"

 

At this point we can add the following lines of code to our cells initialization function:

 

// set text of cell 0 to green

cellsMan.GetTextDescriptor (1000).SetColorNormal (RGB (0, 255, 0));

 

// set text of cell 1 to blue

cellsMan.GetTextDescriptor (1001).SetColorNormal (RGB (0, 0, 255));

 

Note that cells can be accessed through their UniqueID used as an index.

 

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 CellsManager object is defined by the control wrapper class CCellsManager contained inside the CellsManager.cpp and CellsManager.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 "CellsManager.h"

 

Here follows the code needed to perform the requested operation of creating two cells

// declare a CellsManager object

CCellsManager cellsMan;

 

// init the object with the control's CellsManager

cellsMan = MyButton.GetCellsManager ();

 

// add cell with Unique ID 1000 and set a border of 1 pixel

cellsMan.CellAdd (1000, 0, 0, 50, 50, "Cell 0");

cellsMan.SetBorderWidth (1000, 1);

 

// add cell with Unique ID 1001

cellsMan.CellAdd (1001, 50, 50, 50, 50, "Cell 1");

cellsMan.SetBorderWidth (1001, 1);

 

Now we want to change the text's colors for both cells; text's settings are implemented exactly in the same way as other texts available on the button, so they are accessible through a TextDescriptor object, implemented through the TextDescriptor property: this means that we will have to add the declaration of this object adding the following line of code somewhere in your code.

 

#include "TextDescriptor.h"

 

At this point we can add the following lines of code to our cells initialization function:

// set text of cell 0 to green

cellsMan.GetTextDescriptor (1000).SetColorNormal (RGB (0, 255, 0));

 

// set text of cell 1 to blue

cellsMan.GetTextDescriptor (1001).SetColorNormal (RGB (0, 0, 255));

 

Note that cells can be accessed through their UniqueID used as an index.

 

 

Microsoft Visual Basic (5.0 and 6.0)

Here follows the code needed to perform the requested operation:

' add cell with Unique ID 1000 and set a border of 1 pixel

MyButton.CellsManager.CellAdd 1000, 0, 0, 50, 50, "Cell 0"

MyButton.CellsManager.BorderWidth(1000) = 1

 

' add cell with Unique ID 1001 and set a border of 1 pixel

MyButton.CellsManager.CellAdd 1001, 50, 50, 50, 50, "Cell 1"

MyButton.CellsManager.BorderWidth(1001) = 1

 

'set text of cell 0 to green  

MyButton.CellsManager.TextDescriptor(1000).ColorNormal = RGB(0, 255, 0)

 

' set text of cell 1 to blue

MyButton.CellsManager.TextDescriptor(1001).ColorNormal = RGB(0, 0, 255)

 

 

Microsoft Visual Basic.NET (2003)

Here follows the code needed to perform the requested operation:

' add cell with Unique ID 1000 and set a border of 1 pixel

MyButton.CellsManager.CellAdd(1000, 0, 0, 50, 50, "Cell 0")

MyButton.CellsManager.BorderWidth(1000) = 1

 

' add cell with Unique ID 1001 and set a border of 1 pixel

MyButton.CellsManager.CellAdd(1001, 50, 50, 50, 50, "Cell 1")

MyButton.CellsManager.BorderWidth(1001) = 1

 

' set text of cell 0 to green

MyButton.CellsManager.TextDescriptor(1000).ColorNormal = Convert.ToUInt32(RGB(0, 255, 0))

 

' set text of cell 1 to blue

MyButton.CellsManager.TextDescriptor(1001).ColorNormal = Convert.ToUInt32(RGB(0, 0, 255))

 

 

Microsoft Visual C#.NET (2003)

Here follows the code needed to perform the requested operation of changing the surface color and its 3D gradient factor.

// add cell with Unique ID 1000 and set a border of 1 pixel

MyButton.CellsManager.CellAdd (1000, 0, 0, 50, 50, "Cell 0");

MyButton.CellsManager.set_BorderWidth (1000, 1);

 

// add cell with Unique ID 1001 and set a border of 1 pixel

MyButton.CellsManager.CellAdd (1001, 50, 50, 50, 50, "Cell 1");

MyButton.CellsManager.set_BorderWidth (1001, 1);

 

// set text of cell 0 to green

MyButton.CellsManager.get_TextDescriptor (1000).ColorNormal = Convert.ToUInt32 (ColorTranslator.ToWin32 (Color.Green));

 

// set text of cell 1 to blue

MyButton.CellsManager.get_TextDescriptor (1001).ColorNormal = Convert.ToUInt32 (ColorTranslator.ToWin32 (Color.Blue));

 

 

Microsoft Visual J#.NET (2003)

Here follows the code needed to perform the requested operation of changing the surface color and its 3D gradient factor.

 

// add cell with Unique ID 1000 and set a border of 1 pixel

MyButton.get_CellsManager().CellAdd ((short) 1000, (short) 0, (short) 0, (short) 50, (short) 50, "Cell 0");

MyButton.get_CellsManager().set_BorderWidth ((short) 1000, (short) 1);

 

// add cell with Unique ID 1001 and set a border of 1 pixel

MyButton.get_CellsManager().CellAdd ((short) 1001, (short) 50, (short) 50, (short) 50, (short) 50, "Cell 1");

MyButton.get_CellsManager().set_BorderWidth ((short) 1001, (short) 1);

 

// set text of cell 0 to green

System.UInt32 green = (System.UInt32) ColorTranslator.ToWin32 (Color.get_Green ());

MyButton.get_CellsManager().get_TextDescriptor ((short) 1000).set_ColorNormal (green);

 

// set text of cell 1 to blue

System.UInt32 blue = (System.UInt32) ColorTranslator.ToWin32 (Color.get_Blue ());

MyButton.get_CellsManager().get_TextDescriptor ((short) 1001).set_ColorNormal (blue);