Exemplo n.º 1
0
        /// <summary>
        /// 创建默认实例
        /// </summary>
        private void CreateDefaultInstance()
        {
            if (string.IsNullOrEmpty(imagePath))
            {
                ShowListInfo("图片路径为空!");
                return;
            }
            if (File.Exists(imagePath) == false)
            {
                ShowListInfo("图片路径不存在!");
                return;
            }
            myImageObj               = new CImageInfo();
            myImageObj.CreateTime    = DateTime.Now.ToString("hh:MM:ss.fff");
            myImageObj.ImageID       = 0;
            myImageObj.ImageName     = "TestImage";
            myImageObj.SerializeType = SerializeTypeEnum.BIT;
            Rectangle rect          = hWindowControl1.ImagePart;
            HTuple    imagefilepath = imagePath;

            HOperatorSet.ReadImage(out myImageObj.ho_Image, imagefilepath);

            HTuple width, height;

            HOperatorSet.GetImageSize(myImageObj.ho_Image, out width, out height);
            rect.X      = 0;
            rect.Y      = 0;
            rect.Width  = width.I;
            rect.Height = height.I;
            hWindowControl1.ImagePart = rect;
        }