how i save bitmap file by use VC++ .net
-
I create dialog to load bitmap file and I change file a little.I create dialog to save file but I don't know code that can save bitmap image. Could u tell me ?:omg:
-
I create dialog to load bitmap file and I change file a little.I create dialog to save file but I don't know code that can save bitmap image. Could u tell me ?:omg:
I think you are talking about this: Class CBitmap has the method Save. It's overloaded in five constructors.For instance one of them get the parameters --- pBitmap::Save( System::String__gc , System::Drawing::Imaging::ImageFormat__gc) where in the string you put a name for saving the file ( actually you put whole path ), and in the second one you specify the requiered format that you want for this saved image. Yes it's so simple to save your new bitmap as Gif, Tiff, JPeg, Icon and so on. For instance you can use this function in this way: {.... System::String * mark = S"\\"; //We open an openFileDialog in our form, we suppose that are //filtered for only show BMP files. System::Windows::Forms::OpenFileDialog * openFileDialog1 = new System::Windows::Forms::OpenFileDialog(); openFileDialog1->ShowDialog(); //We get the selected file path String* strResult = openFileDialog1->FileName; System::Drawing::Bitmap * pBitmap; //and open it in our Bitmap pBitmap = new System::Drawing::Bitmap( strResult); //We search the last '\' in the path for change the name of the file and // the extension int Index = strResult->LastIndexOf (mark); strResult = strResult->Substring(0,Index); strResult = strResult->Concat(strResult,S"\\ITS_OK.jpg" ); //finally you can save it with your new desired format (or the same one) pBitmap->Save(strResult, System::Drawing::Imaging::ImageFormat::Jpeg ); } if your question is in another way, please reply me. Best Regards!:-D