1. [ VB ] Drawing rectangles and using colour
- draw
- The word draw is often used to indicate that only the outline shows
pen and stroke are associated with drawing - fill
- Typically fill is used to indicate that the shape is filled in a solid
way
brush and fill are associated with filling
We produce three rectangles. One uses drawRect,
the others use fillRect.
test text
1. [ C++ ] Drawing rectangles and using colour
- draw
- The word draw is often used to indicate that only the outline shows
pen and stroke are associated with drawing - fill
- Typically fill is used to indicate that the shape is filled in a solid
way
brush and fill are associated with filling
draw the stroke colour and fill colour are used.
The stroke determines the outline, the fill determines the fill.
Either of these may take the value "none".
"none" "red" "blue" ColorRGB(.1,.2,.3)
We produce three rectangles. One uses drawRect,
the others use fillRect.
test text
1. [ C# ] Drawing rectangles and using colour
- draw
- The word draw is often used to indicate that only the outline shows
pen and stroke are associated with drawing - fill
- Typically fill is used to indicate that the shape is filled in a solid
way
brush and fill are associated with filling
The Graphics method allows us to draw or to fill rectangles.
- DrawRectangle(Pens.Blue,10,10,70,50)
- Draws the rectangle using the blue pen.
- FillRectangle(Brushes.Red,200,0,100,400)
- Fills the rectangle. The top left corner of the rectangle is at 200,0 the width and height are 100 and 400.
- FillRectangle(new SolidBrush( Color.FromArgb(255,128,128)), 10,70,150,50)
- This fill a rectangle with an awful pink. The three numbers are the Red, Green and Blue components. The maximum value for each component is 255 - so 255,128,128 means full red, half green and half blue.
We produce three rectangles. One uses drawRect,
the others use fillRect.
test text
1. [ Java ] Drawing rectangles and using colour
- draw
- The word draw is often used to indicate that only the outline shows
pen and stroke are associated with drawing - fill
- Typically fill is used to indicate that the shape is filled in a solid
way
brush and fill are associated with filling
The Graphics class permits us to draw on a surface. Useful methods of this class:
- fillRect(200,0,100,400)
- Fills the rectangle. The top left corner of the rectangle is at 200,0 the width and height are 100 and 400.
- setColor(Color.red)
- This method doesn't do anything immediately, but the draw and
fill operation will be in red from now on. There are a handful of colours
we can use:
black,blue,cyan,darkGray,gray,green,lightGray,magenta,orange,pink,red,white,yellow. - setColor(new Color(255,128,128))
- This sets the color to an awful pink. The three numbers are the Red, Green and Blue components. The maximum value for each component is 255 - so 255,128,128 means full red, half green and half blue.
We produce three rectangles. One uses drawRect,
the others use fillRect.
test text
1. [ Perl ] Drawing rectangles and using colour
- draw
- The word draw is often used to indicate that only the outline shows
pen and stroke are associated with drawing - fill
- Typically fill is used to indicate that the shape is filled in a solid
way
brush and fill are associated with filling
We produce three rectangles. One uses drawRect,
the others use fillRect.
The first colour allocated is the background colour.
Rectangles are specified by the top-left and bottom-right corners.
test text