Pls help
Loading
Pls help
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Abhishek YadavRank #217 · 11.3K reputationPosted Oct 19, 2022, 6:46 AM EDT
using System; public class AreaOfRectangle { public static void Main() { int Length = 15; int Breadth = 6; int Area = Length * Breadth; Console.WriteLine($"Area of Length {Length} and Breadth {Breadth} Rectangle is {Area}"); Console.ReadKey(); } }Amit MohantyRank #112 · 20K reputationPosted Jul 5, 2022, 9:02 AM EDT
Md SarfarajRank #194 · 12.4K reputationPosted Jul 6, 2022, 12:17 AM EDT
Kip HackmanRank #2,595 · 536 reputationPosted Oct 18, 2022, 12:46 PM EDT
You can use LEADTOOLS Imaging Pro SDK technology in your application.
https://www.leadtools.com/sdk/products/imaging-pro
You can use GetAreaInPixels method inside the AnnRectangleObject class. This method is used to return the area bounded inside an AnnRectangleObject in pixels.
Here is some code:
// Load the image using (RasterCodecs _codecs = new RasterCodecs()) using (RasterImage _image = _codecs.Load(@"FILE PATH TO SOURCE IMAGE")) { // Create the annotation container to store the annotation objects AnnContainer _container = new AnnContainer(); _container.Mapper.MapResolutions(_image.XResolution, _image.YResolution, _image.XResolution, _image.YResolution); _container.Size = _container.Mapper.SizeToContainerCoordinates(_image.ImageSize.ToLeadSizeD()); // Annotation unit is 1/720 of an inch double inch = 720.0; // Add 1st rectangle as annotation AnnRectangleObject _annRect = new AnnRectangleObject(); _annRect.Rect = new LeadRectD(1 * inch, 2 * inch, 1 * inch, 3 * inch); _annRect.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Green"), LeadLengthD.Create(1)); _container.Children.Add(_annRect); // Get the area of the rectangle double rectArea = _annRect.GetAreaInPixels(_container.Mapper); }Brahma Prakash ShuklaRank #633 · 3.8K reputationPosted Oct 18, 2022, 2:26 PM EDT
I assume you want to calculate area of rectangle using c#.
Please see the below code.
using System; public class AreaOfRectangle { public static void Main() { int Length = 15; int Breadth = 6; int Area = Length * Breadth; Console.WriteLine($"Area of Length {Length} and Breadth {Breadth} Rectangle is {Area}"); Console.ReadKey(); } }