mattscotney
Member
- Joined
- Jul 9, 2003
- Messages
- 13
Hi all,
How do I change the fill color of a rectangle which is overlapped by a second different colored rectangle without having to redraw the second rectangle, please see example below:
First I create a graphics surface to draw on:
Next I add two overlapping rectangles filled with different colors to the graphics surface:
How can I change the fill color of the first rectangle without refilling over the second rectangle or having to redraw the second rectangle?
[Broken External Image]:http://www.freewebs.com/mattscotney/combined.gif
Not sure why this image wont show up, it worked on the preview! to see what I mean graphically(Its only 3kb) visit http://www.freewebs.com/mattscotney/combined.gif
Is it possible to access or create a backColor property for the rectangle?
I have been banging my head against the wall for days with this one, so any help is greatly appreciated.
How do I change the fill color of a rectangle which is overlapped by a second different colored rectangle without having to redraw the second rectangle, please see example below:
First I create a graphics surface to draw on:
Code:
Dim gfxSUR As Graphics
gfxSUR = bgPICTBOX.CreateGraphics
Create a new solid brush
Dim mybrush = New SolidBrush(bgPICTBOX.BackColor)
Create a permanent bitmap surface to draw on
Dim bmp = New Bitmap(bgPICTBOX.Width, bgPICTBOX.Height)
bgPICTBOX.Image = bmp
gfxSUR.Clear(bgPICTBOX.BackColor)
Dim gfx = Graphics.FromImage(bmp)
gfx.fillrectangle(mybrush, 0, 0, 300, 300)
Next I add two overlapping rectangles filled with different colors to the graphics surface:
Code:
Fill first rectangle
Dim mybrush = New SolidBrush(Color.BlueViolet)
gfx.fillrectangle(mybrush, 50, 50, 80, 80)
Fill second rectangle
Dim mybrush2 = New SolidBrush(Color.LemonChiffon)
gfx.fillrectangle(mybrush4, 70, 70, 80, 80)
How can I change the fill color of the first rectangle without refilling over the second rectangle or having to redraw the second rectangle?
[Broken External Image]:http://www.freewebs.com/mattscotney/combined.gif
Not sure why this image wont show up, it worked on the preview! to see what I mean graphically(Its only 3kb) visit http://www.freewebs.com/mattscotney/combined.gif
Is it possible to access or create a backColor property for the rectangle?
I have been banging my head against the wall for days with this one, so any help is greatly appreciated.
Last edited by a moderator: