473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help with FillRectangle in VB.net

I'm looking for a little help; I've tried everything. Here is a little section of code of a bigger project. What do I need to plug into the ? in the FillRectangleRectangle call to get this to work? I got the FillRect... example from MSDN, but I can't figure out how to call it correctly.

Thanks for any help.
-Bob

Expand|Select|Wrap|Line Numbers
  1. Private Sub PictureBox1_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox1.Click
  2. Dim i As Integer
  3. Dim pt As Point
  4.  
  5. Label1.Text = "X=" & MousePosition.X & " Y=" & MousePosition.Y & " "
  6. pt = New Point(MousePosition.X, MousePosition.Y)
  7. For i = 0 To 117
  8. If rects(i).Contains(pt) Then
  9. Beep()
  10. FillRectangleRectangle(?, i)
  11. End If
  12. Next i
  13. End Sub
  14.  
  15.  
  16. Public Sub FillRectangleRectangle(e As System.Windows.Forms.PaintEventArgs, ByVal i As Integer)
  17. Dim blueBrush As New SolidBrush(Color.Blue)
  18.  
  19. e.Graphics.FillRectangle(blueBrush, rects(i))
  20. End Sub
May 27 '11 #1
1 2753
You copied a FillRectangleRectangle from a place that tried to use it as an event andeler (byval e as ...Eventargs). All you need to do is call the graphic method.
Expand|Select|Wrap|Line Numbers
  1.   Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
  2.         Dim i As Integer
  3.         Dim pt As Point
  4.  
  5.         Label1.Text = "X=" & MousePosition.X & " Y=" & MousePosition.Y & " "
  6.         pt = New Point(MousePosition.X, MousePosition.Y)
  7.         For i = 0 To 117
  8.             If rects(i).Contains(pt) Then
  9.                 Beep()
  10.                 Dim blueBrush As New SolidBrush(Color.Blue)
  11.                  Graphics.FillRectangle(BlueBrush,rects(i)
  12.                 'FillRectangleRectangle(?, i) 
  13.             End If
  14.         Next i
  15.     End Sub
  16.  
Jun 2 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Keni | last post by:
How do I set the font color of the text on the actual tab of a tab page? I have tried changing the forecolor. That only changes the color for the text inside the tab, it doesn't change the color...
2
by: JBiagio | last post by:
Hello All, I am attempting to learn a bit about the GDI+ transforms and charting data and I feel like I'm getting a handle on how the transforms work. My chart object has a large "canvas" bitmap...
2
by: MyNameIsnt | last post by:
Can anyone tell me why, when I click on the buttons it register 2 characters on the display? if you use the right mousebutton it works ok, but the buttons dont flash?? it works fine without the...
0
by: Martin Streller | last post by:
Hello, The code below represents a simple ownerdrawn, Listview class in C#. Its purpose is to avoid the flicker of the MS ListView. So I can't fall back to their one. Does anybody know why I...
10
by: Nevets Steprock | last post by:
I'm writing a web program where one of the sections is supposed to output a correlation matrix. The typical correlation matrix looks like this: ..23 ..34 .54 ..76 .44 .28 ..02 .77 ...
2
by: Peter Proost | last post by:
Hi, I've got the following ownerdraw menu: drag a mainmenu on a form and add some menuitems to it, set all the menuitems to ownerdraw = true and for every menuitem add this code (replace...
5
by: TheGanjaMan | last post by:
Hi everyone, I'm trying to write up a simple image stamper application that stamps the Exif date information from the jpegs that I've taken from my digital camera and saves the new file with the...
2
by: Mark Ingram | last post by:
Hi, I would like to know which is the faster method to call, FillRectangle or FillPath. I have a path which is essentially a square, except for rounded corners, so I can end up with 2 almost...
3
by: Yehia A.Salam | last post by:
Hello, I'm trying to fill a rectangle with a tiled image, the problem is that Grpahics.FillRectangle (TextBrush,..,..,..,..) doesn't draw the tiled image from the origin, so the result was this:...
2
by: phommy | last post by:
please test this: public Form1() { InitializeComponent(); this.DoubleBuffered = true; } protected override void...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.