بيضاوية

إنشاء بيضاوية

في هذا الموضوع، سنقدم للمطورين كيفية إضافة أشكال البيضاوية إلى الشرائح باستخدام Aspose.Slides لـ C++ . يوفر Aspose.Slides لـ C++ مجموعة أسهل من واجهات برمجة التطبيقات لرسم أنواع مختلفة من الأشكال مع بضع أسطر من التعليمات البرمجية فقط. لإضافة بيضاوية بسيطة إلى شريحة مختارة من العرض التقديمي، يرجى اتباع الخطوات أدناه:

  1. إنشاء مثال من Presentation class
  2. الحصول على مرجع لشريحة باستخدام الفهرس الخاص بها
  3. إضافة AutoShape من نوع البيضاوية باستخدام طريقة AddAutoShape المعروضة بواسطة IShapes object
  4. كتابة العرض التقديمي المعدل كملف PPTX

في المثال المعطى أدناه، قمنا بإضافة بيضاوية إلى الشريحة الأولى.

For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/SimpleEllipse.pptx";
const String templatePath = u"../templates/HelloWorld.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add autoshape of ellipse type
SharedPtr<IAutoShape> ashp = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 50, 150, 150, 50);
// Save PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);

إنشاء بيضاوية بتنسيق أفضل

لإضافة بيضاوية بتنسيق أفضل إلى شريحة، يرجى اتباع الخطوات أدناه:

  1. إنشاء مثال من Presentation class.
  2. الحصول على مرجع لشريحة باستخدام الفهرس الخاص بها.
  3. إضافة AutoShape من نوع البيضاوية باستخدام طريقة AddAutoShape المعروضة بواسطة IShapes object.
  4. تعيين نوع التعبئة للبيضاوية إلى صلب.
  5. تعيين لون البيضاوية باستخدام خاصية SolidFillColor.Color المعروضة بواسطة كائن FillFormat المرتبط بكائن IShape.
  6. تعيين لون خطوط البيضاوية.
  7. تعيين عرض خطوط البيضاوية.
  8. كتابة العرض التقديمي المعدل كملف PPTX.

في المثال المعطى أدناه، قمنا بإضافة بيضاوية بتنسيق إلى الشريحة الأولى من العرض التقديمي.

For complete examples and data files, please go to https://github.com/aspose-slides/Aspose.Slides-for-C
// The path to the documents directory.
const String outPath = u"../out/FormattedEllipse_out.pptx";
const String templatePath = u"../templates/AltText.pptx";
// Load the desired the presentation
SharedPtr<Presentation> pres = MakeObject<Presentation>();
// Access first slide
SharedPtr<ISlide> slide = pres->get_Slides()->idx_get(0);
// Add an autoshape of type line
SharedPtr<IAutoShape> shape = slide->get_Shapes()->AddAutoShape(ShapeType::Ellipse, 50, 150, 150, 50);
// Set the fill color of the rectangle shape
shape->get_FillFormat()->set_FillType(FillType::Solid);
shape->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Chocolate());
// Apply some formatting on the line
shape->get_LineFormat()->set_Style(LineStyle::ThickThin);
shape->get_LineFormat()->set_Width(5);
shape->get_LineFormat()->set_DashStyle(LineDashStyle::DashDot);
shape->get_LineFormat()->get_FillFormat()->set_FillType(FillType::Solid);
shape->get_LineFormat()->get_FillFormat()->get_SolidFillColor()->set_Color(Color::get_Black());
//Write the PPTX to Disk
pres->Save(outPath, Aspose::Slides::Export::SaveFormat::Pptx);