color in a rectangle

Posted on 2006-07-13
Last Modified: 2010-04-23
 grpContainer = Graphics.FromHwnd(Me.FindForm.ActiveForm.Handle)

With grpContainer
 .DrawRectangle(penBlue, x0, 20, h0, 80)

how can I 'fill' in the rectangle?

Or is it outside of this particular method's ability ?
Question by:sirbounty
  • 3

Accepted Solution

Shakti109 earned 125 total points
ID: 17102548

You use a brush and the "fillrectangle method" as follows :

      Dim bluebrush As New SolidBrush(Color.Blue)

      With grpContainer
         .DrawRectangle(penBlue, x0, 20, h0, 80)
         .fillrectangle(bluebrush, x0, 20, h0, 80)
      end with

You can of course change the colors when you declare it to anything you wish.
LVL 67

Author Comment

ID: 17102586
LVL 67

Author Comment

ID: 17102825
Having some difficulty - opening a new Q on it...
LVL 67

Author Comment

ID: 17108482

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now