コード例 #1
0
        public Bitmap(string filename, bool useIcm)
        {
            // GDI+ will read this file multiple times. Get the fully qualified path
            // so if the app's default directory changes we won't get an error.
            filename = Path.GetFullPath(filename);

            IntPtr bitmap = IntPtr.Zero;
            int    status;

            if (useIcm)
            {
                status = Gdip.GdipCreateBitmapFromFileICM(filename, out bitmap);
            }
            else
            {
                status = Gdip.GdipCreateBitmapFromFile(filename, out bitmap);
            }
            Gdip.CheckStatus(status);

            ValidateImage(bitmap);

            SetNativeImage(bitmap);
            EnsureSave(this, filename, null);
        }