Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 999771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:24:23+00:00 2026-05-16T07:24:23+00:00

Am using the below code to create polygon. i just want to fill this

  • 0

alt textAm using the below code to create polygon. i just want to fill this polygon surface with black dots, how i can do that, then i want to convert this polygon to bitmap or in memory stream, how to do this??

 // Create a blue and a black Brush
        SolidColorBrush yellowBrush = new SolidColorBrush();
        yellowBrush.Color = Colors.Transparent;
        SolidColorBrush blackBrush = new SolidColorBrush();
        blackBrush.Color = Colors.Black;

        // Create a Polygon
        Polygon yellowPolygon = new Polygon();
        yellowPolygon.Stroke = blackBrush;
        yellowPolygon.Fill = yellowBrush;
        yellowPolygon.StrokeThickness = 4;

        // Create a collection of points for a polygon
        System.Windows.Point Point1 = new System.Windows.Point(50, 100);
        System.Windows.Point Point2 = new System.Windows.Point(200, 100);
        System.Windows.Point Point3 = new System.Windows.Point(200, 200);
        System.Windows.Point Point4 = new System.Windows.Point(300, 30);

        PointCollection polygonPoints = new PointCollection();
        polygonPoints.Add(Point1);
        polygonPoints.Add(Point2);
        polygonPoints.Add(Point3);
        polygonPoints.Add(Point4);

        // Set Polygon.Points properties
        yellowPolygon.Points = polygonPoints;          

        // Add Polygon to the page
        mygrid.Children.Add(yellowPolygon);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:24:24+00:00Added an answer on May 16, 2026 at 7:24 am

    Do the dots have to be positioned in a particular order or do you just want to have a dotted pattern in your polygon without specific order?

    If you don’t need a special order you could use a Brush, a DrawingBrush for instance. Check out this link: http://msdn.microsoft.com/en-us/library/aa970904.aspx

    You can then set this Brush as the Fill-Property of your Polygon instead of the SolidColorBrush.


    This is the DrawingBrush example from the msdn link, but modified to display dots:

      // Create a DrawingBrush and use it to
    // paint the rectangle.
    DrawingBrush myBrush = new DrawingBrush();
    
    GeometryDrawing backgroundSquare =
        new GeometryDrawing(
            Brushes.Yellow,
            null,
            new RectangleGeometry(new Rect(0, 0, 100, 100)));
    
    GeometryGroup aGeometryGroup = new GeometryGroup();
    aGeometryGroup.Children.Add(new EllipseGeometry(new Rect(0, 0, 20, 20)));
    
    SolidColorBrush checkerBrush = new SolidColorBrush(Colors.Black);
    
    GeometryDrawing checkers = new GeometryDrawing(checkerBrush, null, aGeometryGroup);
    
    DrawingGroup checkersDrawingGroup = new DrawingGroup();
    checkersDrawingGroup.Children.Add(backgroundSquare);
    checkersDrawingGroup.Children.Add(checkers);
    
    myBrush.Drawing = checkersDrawingGroup;
    myBrush.Viewport = new Rect(0, 0, 0.05, 0.05);
    myBrush.TileMode = TileMode.Tile;   
    
    yellowPolygon.Fill = myBrush;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using below code, I am getting this error: NSTask: Task create for path '/Users/media/Library/Developer/Xcode/DerivedData/Manager-gnixeptcszdoubbnfcncumzypwge/Build/Products/Debug/lib'
I'm downloading files using the below code. Can I create folders dynamically and download
I'm using the code below to create a folder and then download the assocated
I am using below code to create a reminder in Google calendar (using Google
I'm trying to create a custom drop down and using the code below it
I am using jquery to create a custom dropdown with the code below. I
Below is the code i am using to create a video list of my
Okay, so I've got the following code shown below to create a dialog using
I am using below code to create three tab in activity but it gives
Hi all I am using below code to create an event : EKEvent *oneLabEvent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.