Class ImageActiveXControl

ImageActiveXControl class

Represents the image control.

public class ImageActiveXControl : ActiveXControl

Properties

NameDescription
virtual BackOleColor { get; set; }Gets and sets the ole color of the background.(Inherited from ActiveXControlBase.)
BorderOleColor { get; set; }Gets and sets the ole color of the background.
BorderStyle { get; set; }Gets and set the type of border used by the control.
override Data { get; }Gets and sets the binary data of the control.(Inherited from ActiveXControl.)
Font { get; }Represents the font of the control.(Inherited from ActiveXControl.)
virtual ForeOleColor { get; set; }Gets and sets the ole color of the foreground.(Inherited from ActiveXControlBase.)
virtual Height { get; set; }Gets and sets the height of the control in unit of points.(Inherited from ActiveXControlBase.)
IMEMode { get; set; }Gets and sets the default run-time mode of the Input Method Editor for the control as it receives focus.(Inherited from ActiveXControl.)
override IsAutoSize { get; set; }Indicates whether the control will automatically resize to display its entire contents.
IsEnabled { get; set; }Indicates whether the control can receive the focus and respond to user-generated events.(Inherited from ActiveXControl.)
IsLocked { get; set; }Indicates whether data in the control is locked for editing.(Inherited from ActiveXControl.)
IsTiled { get; set; }Indicates whether the picture is tiled across the background.
IsTransparent { get; set; }Indicates whether the control is transparent.(Inherited from ActiveXControl.)
virtual IsVisible { get; set; }Indicates whether this control is visible.(Inherited from ActiveXControlBase.)
LinkedCell { get; set; }Gets and sets the linked cell.(Inherited from ActiveXControlBase.)
ListFillRange { get; set; }Gets and sets the list fill range.(Inherited from ActiveXControlBase.)
MouseIcon { get; set; }Gets and sets a custom icon to display as the mouse pointer for the control.(Inherited from ActiveXControlBase.)
MousePointer { get; set; }Gets and sets the type of icon displayed as the mouse pointer for the control.(Inherited from ActiveXControlBase.)
Picture { get; set; }Gets and sets the data of the picture.
PictureAlignment { get; set; }Gets and sets the alignment of the picture inside the Form or Image.
PictureSizeMode { get; set; }Gets and sets how to display the picture.
virtual Shadow { get; set; }Indicates whether to show a shadow.(Inherited from ActiveXControlBase.)
SpecialEffect { get; set; }Gets and sets the special effect of the control.
TextAlign { get; set; }Represents how to align the text used by the control.(Inherited from ActiveXControl.)
override Type { get; }Gets the type of the ActiveX control.
virtual Width { get; set; }Gets and sets the width of the control in unit of points.(Inherited from ActiveXControlBase.)
Workbook { get; }Gets the Workbook object.(Inherited from ActiveXControlBase.)

Examples

[C#]

using Aspose.Cells;
using Aspose.Cells.Drawing;
using Aspose.Cells.Drawing.ActiveXControls;
using System;
using System.IO;

namespace Demos
{
    public class ImageActiveXControlDemo
    {
        public static void RunDemo()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();

            // Add a new worksheet to the workbook
            Worksheet worksheet = workbook.Worksheets[0];

            // Add an Image ActiveX control to the worksheet
            var shape = worksheet.Shapes.AddActiveXControl(ControlType.Image, 5, 0, 1, 1, 100, 100);
            ImageActiveXControl imageControl = (ImageActiveXControl)shape.ActiveXControl;

            // Set properties for the Image ActiveX control
            imageControl.IsAutoSize = true;
            imageControl.BorderOleColor = 0x000000; // Black border
            imageControl.BorderStyle = ControlBorderType.Single;
            imageControl.PictureSizeMode = ControlPictureSizeMode.Stretch;
            imageControl.SpecialEffect = ControlSpecialEffectType.Flat;
            imageControl.PictureAlignment = ControlPictureAlignmentType.Center;
            imageControl.IsTiled = false;

            // Load an image from file and set it to the control
            byte[] imageData = File.ReadAllBytes("ImageActiveXControlDemo.jpg");
            imageControl.Picture = imageData;

            // Save the workbook
            workbook.Save("ImageActiveXControlDemo.xlsx");
            workbook.Save("ImageActiveXControlDemo.pdf");

            // Output the results
            Console.WriteLine("Image ActiveX Control added with the following properties:");
            Console.WriteLine($"IsAutoSize: {imageControl.IsAutoSize}");
            Console.WriteLine($"BorderOleColor: {imageControl.BorderOleColor}");
            Console.WriteLine($"BorderStyle: {imageControl.BorderStyle}");
            Console.WriteLine($"PictureSizeMode: {imageControl.PictureSizeMode}");
            Console.WriteLine($"SpecialEffect: {imageControl.SpecialEffect}");
            Console.WriteLine($"PictureAlignment: {imageControl.PictureAlignment}");
            Console.WriteLine($"IsTiled: {imageControl.IsTiled}");
        }
    }
}

See Also