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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:37:17+00:00 2026-06-08T09:37:17+00:00

I have a set of shapes created in visual basic that need to be

  • 0

I have a set of shapes created in visual basic that need to be colored in:

Public Class Form1

Private Sub btnDraw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDraw.Click
    Dim formSurface As Graphics = Me.CreateGraphics 'creates surface

    Dim world As New Pen(Color.Black, 3)
    formSurface.DrawRectangle(world, 250, 50, 300, 300) 'world


    Dim roof As New Pen(Color.Black, 3)
    Dim roof1 As New Point(325, 200)
    Dim roof2 As New Point(475, 200)
    Dim roof3 As New Point(400, 100)
    Dim roof4 As New Point(400, 100)
    Dim curvePoints As Point() = {roof1, roof2, roof3, roof4}
    formSurface.DrawPolygon(roof, curvePoints) 'triangle roof

    Dim body As New Pen(Color.Black, 3)
    formSurface.DrawRectangle(body, 325, 200, 150, 150) 'square body

    Dim sun As New Pen(Color.Black, 3)
    formSurface.DrawEllipse(sun, 450, 75, 50, 50) 'sun

    Dim door As New Pen(Color.Black, 3)
    formSurface.DrawRectangle(door, 387, 300, 25, 50) 'door

End Sub

End Class

Everything works perfectly; the shapes are all generated where I want them to be. (I’m trying to draw a house) However, how do I color them in? Also, if I do, will the colors overlap (I want that to happen)?

Should I use some function like image.fill? I know that isn’t right but I’m looking for something like that.

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-08T09:37:19+00:00Added an answer on June 8, 2026 at 9:37 am

    You want to use the formSurface.FillPolygon, FillRectangle, and FillEllipse commands. You can still use the Draw commands to create an outline with a different color than the fill.

    The “Fill” commands need Brushes instead of pens. (Pens draw lines, brushes fill space.) The easiest type of brush to use would be like “Brushes.AliceBlue”.

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

Sidebar

Related Questions

I have a BitmapData object created dynamically that contains user-drawn shapes. I then attach
I have a set of lines that define a W shape. On each line
I have set the eclipse java formatter to wrap lines that exceed 120 characters
I have set up an app that is registered for remote notifications. - (void)application:(UIApplication*)application
I have created a basic example of a falling ball but I am slightly
I have a System.Windows.Controls.Canvas on to which I programatically place a System.Windows.Shapes.Polygon: private Canvas
I have created a ShapeDrawable and placed it within an imageview that is dynamically
i have created little search method. The problem that its hard to read it
If the constraint has to be set that the Radius of any Circle created
I've created a button in Flash, and inside that I have a TextField and

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.