Graphics and Multimedia
Graphics and Multimedia
Graphics and Multimedia
Introduction
Class
class
Bitmap
Structure
Font
FontFamily
Graphics
Color
Icon
Point
Pen
Rectangle
Region
Size
SolidBrush
TextureBrush
Image
SolidBrush
HatchBrush
LinearGradient
PathGradient
SolidBrush
TextureBrush
1-Overriding OnPaint() :
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
graphicsObjects.DrawCircle(……)
Color Control
Structure Color
ARGB values
Alpha, red, green and blue values, respectively
Each value represented as a Byte
Fonts
After a Font is created, its properties cannot be modified
Programmers must create a new Font object to be different
Font constructors
Must require a font name as an argument
They usually require the font size as an argument
DrawString constructors:
String to display
Font,
Brush
and the x- and y-coordinates of the location for the String’s first
character.
Example
Dim textbrush As New SolidBrush(Color.Red)
g.DrawString("Hello World", Me.Font, textbrush, 10, 10)
Example
Drawing Lines, Rectangles and Ovals
Draw Shape
Pen Brush
Example:
DrawRectangle(ByVal p As Pen, ByVal x As Integer, ByVal y As Integer, ByVal
width As Integer, ByVal height As Integer)
(x, y)
height
width