InsertPage
DicomImage.InsertPage method
在指定索引的页面列表中插入一个新页面。
public DicomPage InsertPage(int pageIndex)
| 范围 | 类型 | 描述 | 
|---|---|---|
| pageIndex | Int32 | 页面的索引。 | 
返回值
新创建的DicomPage.
例外
| 例外 | (健康)状况 | 
|---|---|
| ArgumentOutOfRangeException | pageIndex - 页面索引小于 0. 或 pageIndex - 页面索引大于PageCount. | 
例子
创建多页 Dicom 图像。
[C#]
using (DicomImage image = (DicomImage)Image.Create(
        new DicomOptions() { Source = new StreamSource(new MemoryStream()) },
        100,
        100))
{
    // 使用矢量图形绘制一些东西
    Graphics graphics = new Graphics(image);
    graphics.FillRectangle(new SolidBrush(Color.BlueViolet), image.Bounds);
    graphics.FillRectangle(new SolidBrush(Color.Aqua), 10, 20, 50, 20);
    graphics.FillEllipse(new SolidBrush(Color.Orange), 30, 50, 70, 30);
    // 保存绘制图像的像素。它们现在位于 Dicom 图像的第一页。
    int[] pixels = image.LoadArgb32Pixels(image.Bounds);
    // 之后添加几页,使它们变暗
    for (int i = 1; i < 5; i++)
    {
        DicomPage page = image.AddPage();
        page.SaveArgb32Pixels(page.Bounds, pixels);
        page.AdjustBrightness(i * 30);
    }
    // 在主页面前面添加几页,使它们更亮
    for (int i = 1; i < 5; i++)
    {
        DicomPage page = image.InsertPage(0);
        page.SaveArgb32Pixels(page.Bounds, pixels);
        page.AdjustBrightness(-i * 30);
    }
    // 将创建的多页图片保存到输出文件
    image.Save("MultiPage.dcm");
}
也可以看看
- class DicomPage
- class DicomImage
- 命名空间 Aspose.Imaging.FileFormats.Dicom
- 部件 Aspose.Imaging