There are many images in my resource directory and access them like this ...
public function ReturnToolBarImage (ByVal as ImageName string) image as a new image with dim UpdateImage dim UpdateBitmap UpdateBitmap UpdateImage and (as with new BitmapImage with .BeginInit) .UriSource = new Uri ( "the Pack : // application: ,,,,, HOA_Manager_Client_04; component / resource / "& amp; ImageName, UriKind.Absolute) .EndInit () .DecodePixelHeight = 32 UpdateImage.Source = UpdateBitmap Return With UpdateImage End Function Finish I have control that the emphasis on using an image path is not an image - I can use it in this way
. ImageSource = "//application:,,,,HOA_Manager_Client_04;component/Resources/Customers.png" But the image, or at all, is too large .. Soooooo I added a size image To save a temporary folder (which is working) and send the path back - but for some reason that just do not work (no error, just no image) Any thoughts?
public function ReturnToolBarImageAsString (ByVal ImageName as string) string as a new image with UpdateImage and (as with new BitmapImage with dim UpdateBitmap UpdateBitmap .BeginInit as dim UpdateImage ) .UriSource = New Uri ("Pack: // Application: ,,,,, / HOA_Manager_Client_04; Component / Resource /" & Image Name, UriKind.Assolute). Andvit () with the use of FS as .DecodePixelHeight = 32 end IO.FileStream ( ".. .. .. / pages / temp /" & amp; ImageName, IO.FileMode.Create) dim vEncoder New PngBitmapEncoder vEncoder. In the form of Frames.Add ('BitmapFrame.Create (UpdateBitmap))' the return using vEncoder.Save (FS) end "../Temp/" & Amp; Return image name "// application:", / HOA_Manager_Client_04; component / page / temporary / "& amp; The image appears by creating a directory at run time in the bin directory
fix the problem the
public function ReturnToolBarImageAsString (image new bitmap with UpdateBitmap with Dim UpdateBitmap as ByVal ImageName) as string as the new image with UpdateImage with string Dim UpdateImage In. BeginInit () .DecodePixelHeight = 32 .UriSource = New Uri ("Pack: // Application: ,,,,, / HOA_Manager_Client_04; Component / Resource /" & Image Name, Uricand.Assolute). (End) end = My.Application.Info.DirectoryPath as string as dim vPath if not IO.Directory.Exists (vPath & amp; "\ Temp_Images") then IO.Directory.CreateDirectory (vPath & amp; " \ Temp_Images ") new IO.FileStream (vPath & amp as using FS, then finally," \ Temp_Images \ "& amp; the ImageName, IO.FileMode.Create) dim vEncoder new PngBitmapEncoder vEncoder.Frames.Add (BitmapFrame.Create (UpdateBitmap)) vEncoder.Save (FS) using the vapath & amp; refund return; "\ Temp_Images \" & amp; Image Name End Function
No comments:
Post a Comment