大概思路如下:
public void Addimg(RasterImage img)
{
//从外部添加图像,第2次自动浮图
if (_img == null)
{
_img= img.Clone();
imgeview.Image = CreateA0Image(_img).Clone();
imgeview.Floater = _img.Clone();
imgeview.CombineFloater(true);
}
else
{
imgeview.Floater = img.Clone();
}
}
public RasterImage CreaimgeA0(RasterImage img)
{
//创建拼接图像的约4倍
RasterImage result;
try
{
float num = (float)(400 * img.XResolution) / 25.4f;
float num2 = (float)(850 * img.YResolution) / 25.4f;
RasterImage rimage = new RasterImage(RasterMemoryFlags.Conventional, (int)num, (int)num2, img.BitsPerPixel, img.Order, img.ViewPerspective,
img.GetPalette(), IntPtr.Zero, 0);
FillCommand cmdfill = new FillCommand(RasterColor.White);
cmdfill.Run(rimage);
rimage.XResolution = img.XResolution;
rimage.YResolution = img.YResolution;
result = rimage;
}
catch
{
result = null;
}
return result;
}
public static Frmpj CreateFrom()
{
//一个窗体
if (instance == null || instance.IsDisposed)
{
instance = new Frmpj();
}
return instance;
}
private void button5_Click(object sender, EventArgs e)
{
//移动浮图
imgeview.InteractiveModes.BeginUpdate();
imgeview.InteractiveModes.Add(new ImageViewerFloaterInteractiveMode
{
ZoomKeyModifier = Keys.None,
IsEnabled = true,
FloaterOpacity = 0.5
});
imgeview.InteractiveModes.EndUpdate();
}
|