Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
C#
2D Graphics 468 codes
Home
C#
2D Graphics
1 11-Pixel Centered Pen
2 11-Pixel Inset Pen
3 A color converter class
4 A long string that will wrap and centered both vertically and horizontally
5 Add a rectangle to a Path
6 Add a translation to the existing transformation
7 Add Bezier to a Path
8 Add closed figures to GraphicsPath
9 Add Ellipse to path
10 Add Line and Arc to Path
11 Add lines to Path
12 Add size and point
13 Add size to a Point
14 All dash styles
15 All Line Join
16 All Linear Gradient Mode
17 All LineCap illustration
18 All the colors that are supported in C# according
19 Allows drawing fonts with borders and auto centers the font on a bitmap
20 Alternate
21 Animate Demo
22 Animate Image
23 Animate Image with ImageAnimator
24 Animates a circle
25 Animates an image
26 Animation and double buffer
27 Apply the scaling transformation(scale subsequent operations by 2x horizontally and 3x vertically)
28 Arc Pie Demo
29 Bezier (Mouse Defines Control Points)
30 Bezier Art
31 Bit operation with PixelFormat Alpha
32 Bitmap HorizontalResolution
33 Bitmap Image Utils
34 Bitmap Operations
35 BitMap Pixel Format
36 Bitmap property
37 Bitmap SetResolution
38 Blend Alpha
39 Brush Style
40 Brushes Black
41 Button click action to move a ball
42 Calculate font unit metrics from the font family
43 Calculate GraphicsUnit metrics from the font
44 Calculate the RBG projection
45 Center an Image (VerticalResolution, HorizontalResolution)
46 Center each line of text horizontally and vertically
47 Center Pixel-Size Image by using Image Width and Image Height
48 CenterColor
49 Changing image opacity, Resize image, crop image and gray scale image
50 Clear a Graphics
51 Click on the form to draw curve
52 Clip Draw
53 Clip many shapes
54 Clip Text
55 Clipping
56 Clipping Combinations
57 Clone Image
58 Close all figures
59 Color Changer
60 Color Chocolate
61 Color representation in h,s,v with h = [0 - 360], s,v = [0 0 - 1 0]
62 Color representation in r,g,b with values [0 0 - 1 0]
63 Color to Hue,Lightness,Saturation value
64 Color To Rgb
65 Color to RGB value
66 Color to String
67 Control Palette
68 Convert bmp image format to jpg, gif, png format images
69 Convert color name to Color object
70 Convert Hex To Color
71 Convert pixels to EMU, EMU to pixels
72 Convert RGB to HSL
73 Convert String value To Color
74 Converts a color string to a hex value string
75 Coordiate Translate Transform
76 Create a Bitmap image in memory and set its CompositingMode
77 Create a green color with an alpha component then draw a green rectangle to the bitmap in memory
78 Create a red color with an alpha component then draw a red circle to the bitmap in memory
79 Create a Region whose boundary is the GraphicsPath
80 Create a StringFormat object, and set the tab stops, in pixels
81 Create an ImageAttributes object and set its color matrix
82 Create Color From HLS value
83 Create Color Object from RGB value
84 Create Graphics object From Image
85 Create Icon from Image
86 Create Metafile
87 Create Metafile (Memory)
88 Create Metafile (Reload)
89 Create New Bitmap From Image
90 Create Path from String
91 Create Pen from Texture Brush
92 Create repeatable Texture Brush
93 Create System Brush from System Color
94 Create Texture Brush from image
95 Create Thumbnail
96 Create two color instances with different alpha components
97 Create your own BitMap
98 Creates a new bitmap from a specific region of another bitmap
99 Creates the custom dash pattern
100 Creates the custom dash pattern 5
101 Cube Image
102 Custom Pen
103 DashDot style Pen
104 Deal with Tab and New Line in Painting String
105 Derive surrounding Rectangle from String
106 Dispose a pen
107 Double buffer draw
108 Double buffer with Bitmap
109 Double Buffering
110 DpiY and DpiX
111 Drag and draw
112 Drag and Draw Demo
113 Drag and drop shape
114 Draw a line
115 Draw a line 2
116 Draw a line for the ascent, descent, baseline, textOrigin
117 Draw a pie
118 Draw a Rectangle
119 Draw an array of images
120 Draw an ellipse
121 Draw an Image
122 Draw Arrow
123 Draw closed curve
124 Draw each of 100 cells with randomly chosen colors
125 Draw Ellipse
126 Draw font cell ascent, cell descent, line space, em height
127 Draw image
128 Draw image based on its size
129 Draw image with Interpolation Mode
130 Draw left justified text
131 Draw line 1
132 Draw line 2
133 Draw line 3
134 Draw line and string
135 Draw multiline text
136 Draw on an Bitmap
137 Draw on Pixel-Size Image
138 Draw Partial Image
139 Draw path
140 Draw Polygon
141 Draw Polygon with dashed pen
142 Draw Pyramid
143 Draw radiation lines
144 Draw Rectangle
145 Draw rectangle and string inside
146 Draw Rectangle surrounding the Text
147 Draw right justified text
148 Draw shapes to the bitmap in memory
149 Draw something onto the drawing surface (with the clipping region applied)
150 Draw Square
151 Draw string with hatch brush
152 Draw string with Interpolation Mode
153 Draw string with new font and solid brush
154 Draw text on an Image
155 Draw the rectangle and draw the string, using the rectangle as a bounding box
156 Draw the string, using the rectangle as a bounding box
157 Draw Vertical String Text
158 DrawImage with destination points
159 DrawImage with size
160 Drawing Shapes
161 Drawing Squares
162 DrawPie with offset
163 Draws Bitmap in a cell within a DataGridView
164 DrawString with solid brush and rectangle
165 DrawString with solid brush, string format
166 Easy to create Texture based on Image
167 Ellipse with DrawLines
168 Emboss
169 Engrave
170 Enuermate the StringAlignment value
171 Enumerate LinearGradientMode
172 Enumerate Metafile
173 Fill a Rectangle with LinearGradientBrush
174 Fill a Rectangle with TextureBrush
175 Fill a Region
176 Fill Ellipse with image based Texture Brush
177 Fill path and draw path
178 Fill region
179 Fill the area bounded by the path
180 Filled with the semi transparent and transparent color
181 FillEllipse
182 Fillpath Demo
183 FillPolygon
184 Five yellow squares with different alpha values(Transparensy)
185 Font Attributes
186 Font Famylies
187 Font Metrics
188 Font size, name and strike out
189 Font Style
190 Font Viewer
191 FontFamilies
192 Fonts Class
193 FromSystemColor
194 Get all known color
195 Get Bitmap Source
196 Get Bytes From BitmapSource
197 Get Clipping region painted
198 Get Color From String
199 Get color outof String
200 Get font cell ascent, descent, LineSpacing and EmHeight
201 Get font family info
202 Get font from Font dialog and redraw string
203 Get Gravatar Image
204 Get Image Decoder information
205 Get Image Resolution and Image size and Display size
206 Get Luminance
207 Get Pixel information
208 Get Rainbow Colors
209 Get repainted regions
210 Get Screen Resolution
211 Get the energy of a pixel
212 GIF Converter
213 Gradient Brush Ball
214 Gradient brush demo
215 Gradient Brushes
216 Gradient Button
217 Gradient Demo
218 Gradient Label
219 Gradient Label Host
220 Gradient Wrap
221 Graphics
222 Graphics Path Example
223 Graphics Properties
224 Graphics SmoothingMode
225 Graphics Unit
226 GraphicsPath closes a figure and starts a new figure
227 GraphicsPath starts a new figure
228 GraphicsPath starts two figures and close them
229 Hatch Brush
230 Hatch Brush Rendering Origin
231 Hatch Brush Style
232 Hatch Brush Styles
233 HatchBrush
234 HatchBrush Demo
235 Heat Map background colour calculations
236 Helper method to get a color based on its string value
237 Hex Color Util
238 Hexagon Gradient Brush
239 Hotkey Prefix
240 HSL to RGB conversion
241 Hsv To Rgb
242 Icon Extraction
243 Icon Image Draw
244 Illustrates filling shapes with a brush
245 Illustrates the use of multiple Pens
246 Illustrates the use of Pens and Lines
247 Illustrates using a graphics file
248 Image At Points (Draw part of the image)
249 Image Cache
250 Image Class
251 Image Filter
252 Image Flip
253 Image Flipping and Rotating
254 Image FromStream
255 Image GetThumbnailImage
256 Image Icon Form
257 Image manipulation using ColorMatrix
258 Image Open
259 Image Paint Simple Demo
260 Image Reflection
261 Image Resize
262 Image Save
263 Image Scale Isotropic
264 Image Scale To Rectangle
265 Image Warper App
266 Image Zoom
267 Image Zoom 1
268 Is a point visible to a Region
269 Is click inside a path
270 Is Region Empty
271 Is Region finite
272 Is this Rectangle visible to the Region
273 Known Colors
274 Line and Arc Combo
275 Line cap
276 Line Cap style
277 Line Gradient
278 Line Join style
279 Line Joins
280 Line style
281 LinearGradientMode Horizontal, Vertical, BackwardDiagonal, ForwardDiagonal
282 LineCap
283 List all Hatch Brush styles
284 List all known color in a system
285 List Fonts
286 Load animated ani file
287 Load Image
288 Load Image from an image file with Exception handler
289 Load image and display
290 Load image from a URL(Web) and draw it
291 Load JPG file and paint the image
292 Make Bitmap from UIElement
293 Make red and blue pens
294 Make Thumb
295 Masks an image and returns a two color bitmap
296 Matrix Demo
297 Matrix Draw
298 Matrix Util
299 Measure Font height and draw surrounding Rectangle
300 MetaFile and Draw
301 Metafile Page Units
302 Mouse click action and draw circle
303 Multiply two Matrixes
304 New Bitmap(bitmap, size)
305 New Matrix(0 707f, 0 707f, -0 707f, 0 707f, 0, 0)
306 New Pen(clr, f)
307 New Pen(ForeColor)
308 New Pen(lgbrush, Math Min(cx, cy) 25), Gradient Pen
309 New SolidBrush(ForeColor)
310 New TextureBrush(bmp)
311 New TextureBrush(bmp, new Rectangle(0, 0, 25, 25))
312 No Flicker (Flicker Free) Animation
313 No Smoothing Mode
314 Object collision
315 One-Inch Ellipse
316 Overlapping Hatch Brushes
317 Paint along points in a list points
318 Parse Color
319 Parse Color with Color FromArgb
320 Partial Image Rotate
321 Partial Image Stretch
322 Path Gradient
323 Path Gradient Brush from Graphics Path
324 Path Gradient Demo
325 Pen alignment
326 Pen Dash Caps
327 Pen dash pattern
328 Pen Dash style
329 Pen Dash Styles
330 Pen Start Cap
331 Pen Start Cap = Line Cap RoundAnchor
332 Pen StartCap
333 Pen width and color
334 Perform a Screen Capture
335 Picture Controls
336 Picture Cube
337 PixelFormat DontCare
338 PixelOffsetMode
339 Play Gif animation
340 Read Bitmap Size by using BinaryReader
341 Rectangle Linear-Gradient Brush
342 Region Clips
343 Region clips a text path
344 Region Excludes
345 Region Unions
346 Reset the transformation
347 Reset the transformation Translate by 30 pixels in vertical direction
348 Resize Image
349 Resize image to fit
350 Resize the Bitmap using the highest quality interpolation mode
351 Resize the Bitmap using the lowest quality interpolation mode
352 Resizes an image
353 Return a randomly-generated color
354 Returns an HTML #XXXXXX format for a color
355 Rgb Linear Interpolate
356 Rgb To Color
357 Rotate by angles
358 Rotate the text 45 degrees
359 Rotate the text 45 degrees clockwise and translate the text 150 pixels horizontally
360 Rotate the text 45 degrees clockwise then Translate the text 150 pixels horizontally
361 Rotate the text through 45 degrees
362 Rotate Transform
363 Rotate Transform and Translate Transform
364 Save WindowCanvas to Image
365 Saves the image to a bytes array Used to store an image into DB
366 Scale Bitmap By Percent
367 Scale subsequent operations by 3x horizontally and 2x vertically
368 Scribble
369 Scribble with Bitmap
370 Scribble with Mouse
371 Scribble with Path
372 Scrolling Demo
373 Set DashStyle
374 Set image resolution and paint it
375 Set LineJoin for Pen
376 Set WrapMode of TextureBrush
377 Shape and Transform
378 Shear Image
379 Shrink Image
380 Simple Resize Bmp
381 Simple way to create linear gradient brush
382 Simplest code to draw a line
383 Simplest code to draw a Rectangle
384 Simplest Coordinate
385 Sine Curve
386 Smoothing Fonts
387 Smoothing Paint
388 SmoothingMode
389 Solid Brush
390 Solid brush demo
391 Solid Texture Brush
392 Spiral
393 Square Tile
394 Star Gradient Brush
395 Start A Figure
396 StartCap, EndCap
397 String Alignment (PointF in DrawString)
398 String Format based on Tab info data
399 String format flag
400 String Rectangle
401 StringAlignment Center
402 StringAlignment Far
403 StringAlignment Near
404 StringFormat
405 StringFormat GenericTypographic
406 StringTrimming Character
407 StringTrimming EllipsisCharacter
408 StringTrimming EllipsisPath
409 StringTrimming EllipsisWord
410 StringTrimming Word
411 Takes a screen shot saves it to the specified directory and returns the full file path
412 Tall in the Center
413 Text Columns
414 Text direction (Matrix Rotate)
415 Text Format
416 Text region clips shape
417 Text Rendering Hint
418 Text Rotate
419 Text Rotate 2
420 Text strings containing rectangle
421 Text wrap
422 TextRenderingHint
423 Texture Brush Wrap mode
424 Texture Brushes
425 This text is centered and underlined
426 Thumbnail Image
427 Timer based animation
428 To Grey scale
429 Transform and RotateTransform in a loop
430 TransformPoints
431 Translate and Rotate the string
432 Translate the text 150 pixels horizontally and 75 vertically
433 Translate Transform
434 Translate Transform three times
435 TranslateTransform
436 Transparent color
437 Triangle Gradient Brush
438 Triangle Tile
439 Two-Point Linear Gradient Brush
440 Two-Triangle Tile
441 Use a 12pt font, and assume the text string must fit into a width of 150 pixels
442 Use a color matrix to change the color properties of the image
443 Use Brush to draw a Rectangle
444 Use Brushes Aquamarine to draw a Ellipse
445 Use Brushes BlueViolet ro draw a Polygon
446 Use Color FromArgb to create Color
447 Use Color Matrix to gray the image
448 Use different Font object to draw a line of text
449 Use HatchBrush to draw String
450 Use LinearGradientBrush to draw a Rectangle
451 Use tab to control the DrawString
452 Use Texture Brush to fill Rectangle
453 Use TexturedBrush to draw string
454 Use the color of Window and WindowText from SystemColors
455 Uses a thread to Animate a ball
456 Using the mouse to draw on a form
457 Wide Polyline
458 Widen a Path
459 Winding
460 With a 200px-width rectangle, and a 12pt font, it requires six lines to display the string in its entirety
461 Work with Point type
462 Work with Rectangle type
463 Write Alpha Jpg
464 Write font metrics for Arial font family
465 Write font metrics for Courier New font family
466 Write font metrics for Times New Roman font family
467 Write info about the clipping rectangle to the console window
468 Write the pixel information to the console window