Open MaxFun opened 1 month ago
Tagging subscribers to this area: @dotnet/area-system-drawing
cc @JeremyKuhne
@MaxFun as there is no image path that is guaranteed to be available, we can't really make this work without the user modifying the sample. We can certainly clarify that you need to replace the file name with one that exists.
The "ambiguous" error you're getting is because you have two Image
classes in scope in your using
statements. You can:
Image
: System.Drawing.Image imageFile = System.Drawing.Image.FromFile("PathToSomeImageFileOnYourSystem.jpg");
System.Net.Mime.MediaTypeNames
isn't in a using in this file.using
alias for the System.Drawing Image
class in this file: using Image = System.Drawing.Image;
Even when I replace "SampImag.jpg" with a real image file "1_2024-01-20_07-27-18_large.jpg" located in the same folder as the Form1.cs I get the error
So, what should the example look like to work? Also, there are no using statements in the example code?
Type of issue
Code doesn't work
Description
[Enter feedback here] Code example when pasted into Windows Forms causes an error. The error
First the information on Graphics.FromImage(Image) Method is so vague anyone who does no already know how to use it gain nothing from the page.
Second the information on Graphics.FromImage(Image) Method is so vague it give no clue where the example code goes in the Windows Forms or how to call it
It seem that any article from microsoft that has a article author of @dotnet-bot has broken code and has cryptic information.
It seem that any example in microsoft's "Learn" documents should to should be detailed enough for someone to "Lean" from
Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.drawing.graphics.fromimage?view=net-8.0&redirectedfrom=MSDN#System_Drawing_Graphics_FromImage_System_Drawing_Image_
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Drawing/Graphics.xml
Document Version Independent Id
5c2e068b-9590-00ef-41c6-a0ad249716c7
Article author
@dotnet-bot