Example #1
0
        private CSImgT LoadImage()
        {
            // This is just a demo
            MessageBox.Show("这里仅以代码形式演示如何加载 ICON(dat|xml) 类型的图像数据。");
            CSImgT img = new CSImgT();

            string         strConfigPath = string.Empty;
            OpenFileDialog ofd           = new OpenFileDialog();

            ofd.Title            = "Please select the path / 请选择加载路径";
            ofd.InitialDirectory = Application.StartupPath;
            ofd.Filter           = "xml|*.xml";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                strConfigPath = ofd.FileName;
            }
            else
            {
                return(img);
            }

            if (false == img.loadFromIconFile(strConfigPath))
            {
                MessageBox.Show("加载失败!! \n\n\nLoad Image failed!!");
            }

            return(img);
        }