ForeColor property
Returns or sets the color of the line, border, or fill of the Shape object to which the formatting applies. Colors are matched to the closest color on the MapPoint palette. Read/write GeoRGBType.
Applies to
Objects: FillFormat, LineFormat
Syntax
object.ForeColor
Parameters
Part | Description |
---|---|
object | Required. An expression that returns a FillFormat or LineFormat object. |
Remarks
GeoRGBType is identical to the Visual Basic MsoRGBType.
Example
[Microsoft Visual Basic 6.0]
Sub ChangeFillColor()
Dim objApp As New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objLoc As MapPoint.Location
'Set up application and get a location object
Set objMap = objApp.ActiveMap
objApp.Visible = True
objApp.UserControl = True
Set objLoc = objApp.ActiveMap.GetLocation(0, 0)
'Create a shape at this location, then zoom to this location
Set objMap.Location = objLoc
objMap.Shapes.AddShape geoShapeOval, objLoc, 50, 30
'Fill the shape (make fill visible), then change the fill color
objMap.Shapes.Item(1).Fill.Visible = True
objMap.Shapes.Item(1).Fill.ForeColor = vbRed
End Sub
[C#]
void ChangeFillColor()
{
MapPoint.Application objApp = new MapPoint.Application();
MapPoint.Map objMap;
MapPoint.Location objLoc;
//Set up application and get a location object
objMap = objApp.ActiveMap;
objApp.Visible = true;
objApp.UserControl = true;
objLoc = objApp.ActiveMap.GetLocation(0.0, 0.0,0.0);
//Create a shape at this location, then zoom to this location
objMap.Location = objLoc;
objMap.Shapes.AddShape(MapPoint.GeoAutoShapeType.geoShapeOval, objLoc, 50, 30);
// declare index as object
object index = 1;
//Fill the shape (make fill visible), then change the fill color
objMap.Shapes.get_Item(ref index).Fill.Visible = true;
//Create an instance of a Color structure and assign Red - assume System.Drawing.dll is referenced
System.Drawing.Color myColor = System.Drawing.Color.Red;
//Convert to int
int iRed = System.Drawing.ColorTranslator.ToOle(myColor);
objMap.Shapes.get_Item(ref index).Fill.ForeColor = iRed;
}