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 7779371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:37:50+00:00 2026-06-01T18:37:50+00:00

I have a DrawingVisual object I have created for example using this method: Private

  • 0

I have a DrawingVisual object I have created for example using this method:

Private Function CreateDrawingVisualRectangle() As DrawingVisual

   Dim drawingVisual As New DrawingVisual() 
   Dim drawingContext As DrawingContext = drawingVisual.RenderOpen()
   Dim rect As New Rect(New Point(160, 100), New Size(320, 80))
   drawingContext.DrawRectangle(Brushes.LightBlue, New Pen(Brushes.Black, 0.5), rect)

   Return drawingVisual

End Function

There’s a way to get the type of shape drawn by DrawingContext method and its properties?

I.e.:

Dim MyVisual as DrawingVisual = CreateDrawingVisualRectangle()

Dim MyVisualType as MyType = MyVisual.GetDrawingType()
Dim MyBrush as Brush = MyVisual.GetDrawingBrush()
Dim MyPen as Pen = MyVisual.GetDrawingPen()
Dim MyRect as Rect = MyVisual.GetDrawingRect()
...

Obviously the methods I used in the last example is indicative methods that does not exist in reality, but I’d use to get MyVisual properties.

Thanks.

  • 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-06-01T18:37:51+00:00Added an answer on June 1, 2026 at 6:37 pm

    You could recursivly iterate through the Drawing objects in the DrawingGroup provided by the Drawing property of a DrawingVisual and if a child drawing is a GeometryDrawing, check for its Pen, Brush and Geometry properties:

    void InspectDrawings(DrawingVisual drawingVisual)
    {
        InspectDrawings(drawingVisual.Drawing);
    }
    
    void InspectDrawings(DrawingGroup drawingGroup)
    {
        foreach (Drawing drawing in drawingGroup.Children)
        {
            if (drawing is GeometryDrawing)
            {
                GeometryDrawing geometryDrawing = (GeometryDrawing)drawing;
                // inspect properties here
            }
            else if (drawing is DrawingGroup)
            {
                // recurse into sub-group
                InspectDrawings((DrawingGroup)drawing);
            }
        }
    }
    

    You may now retrieve the type of Geometry and check for more special properties. For example if it is a RectangleGeometry, check its Rect property.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have converted devise new session from erb to Haml but doens't work, this is
Have some code: using (var ctx = new testDataContext()) { var options = new
Have started playing with Xcode 4.2, and created a single page application using storyboard
Have following kernel function: private static String programSource = __kernel void sampleKernel(__global float *Y,
Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css
Have you ever created or encountered a self modifying code in Java? If yes,
Have you ever had to justify the choice over using .NET instead of Java
I have a class that inherits from DrawingVisual. It declares a DependencyProperty which, when
have Googled the cr*p out of this one so apologies if the answer is
Have a simple contact us XPage created. Have server side validation in place that

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.