Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
تعمل مقتطفات الشيفرة التالية أيضًا مع مكتبة Aspose.PDF.Drawing .
مثل الرسوم البيانية الشريطية، يمكن استخدام الرسوم البيانية الدائرية لعرض البيانات في عدد من الفئات المنفصلة. ومع ذلك، على عكس الرسوم البيانية الشريطية، يمكن استخدام الرسوم البيانية الدائرية فقط عندما يكون لديك بيانات لجميع الفئات التي تشكل الكل. لذا دعونا نلقي نظرة على إضافة كائن دائرة باستخدام Aspose.PDF for .NET.
اتبع الخطوات أدناه:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void Circle()
{
// The path to the document directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Images();
// Create PDF document
using (var document = new Aspose.Pdf.Document())
{
// Add page
var page = document.Pages.Add();
// Create Drawing object with certain dimensions
var graph = new Aspose.Pdf.Drawing.Graph(400, 200);
// Set border for Drawing object
var borderInfo = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, Aspose.Pdf.Color.Green);
graph.Border = borderInfo;
// Create a circle with the specified coordinates and radius
var circle = new Aspose.Pdf.Drawing.Circle(100, 100, 40);
// Set the circle's color
circle.GraphInfo.Color = Aspose.Pdf.Color.GreenYellow;
// Add the circle to the graph shapes
graph.Shapes.Add(circle);
// Add Graph object to paragraphs collection of page
page.Paragraphs.Add(graph);
// Save PDF document
document.Save(dataDir + "DrawingCircle1_out.pdf");
}
}
ستبدو دائرتنا المرسومة كما يلي:
تظهر هذه المثال كيفية إضافة كائن دائرة مملوءة باللون.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void CircleFilled()
{
// The path to the document directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Images();
// Create PDF document
using (var document = new Aspose.Pdf.Document())
{
// Add page
var page = document.Pages.Add();
// Create Drawing object with certain dimensions
var graph = new Aspose.Pdf.Drawing.Graph(400, 200);
// Set border for Drawing object
var borderInfo = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, Aspose.Pdf.Color.Green);
graph.Border = borderInfo;
// Create a filled circle
var circle = new Aspose.Pdf.Drawing.Circle(100, 100, 40)
{
GraphInfo =
{
Color = Aspose.Pdf.Color.GreenYellow,
FillColor = Aspose.Pdf.Color.Green
},
Text = new Aspose.Pdf.Text.TextFragment("Circle")
};
// Add the circle to the graph shapes
graph.Shapes.Add(circle);
// Add Graph object to paragraphs collection of page
page.Paragraphs.Add(graph);
// Save PDF document
document.Save(dataDir + "DrawingCircle2_out.pdf");
}
}
دعونا نرى نتيجة إضافة دائرة مملوءة:
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.