DrawingPanel
Public Member Functions | Static Public Member Functions | Properties | List of all members
DrawingPanel Class Reference

A simplified C# drawing window class based on DrawingPanel.java class that accompanies the Building Java Programs textbook. More...

Public Member Functions

 DrawingPanel ()
 Constructs a new panel of a default width and height. More...
 
 DrawingPanel (int width, int height)
 Constructs a new panel of the given width and height. More...
 
 DrawingPanel (int x, int y, int width, int height)
 Constructs a new panel of the given width and height, with its top/left coordinate at the given (x, y) pixel. More...
 
 DrawingPanel (string filename)
 Constructs a new panel to display an image from the given file. The panel window will be sized to tightly fit that image. More...
 
void Clear ()
 Fills the panel's canvas area with its background color, wiping out any shapes that have been previously drawn. More...
 
void Close ()
 Closes the panel window, causing it to disappear from the screen. More...
 
Graphics GetGraphics ()
 Returns the Graphics object for this panel's canvas. Note that certain DrawingPanel methods invalidate the Graphics object and switch to a new one, such as when the panel is resized; for that reason, it is not recommended to store the result of GetGraphics for long periods in your code. Equivalent to the Graphics property; kept in for compatibility with some Java-isms. More...
 
Color GetPixelColor (int x, int y)
 Returns the color of the given pixel in the panel's canvas. More...
 
Color [,] GetPixelArray ()
 Returns the colors of all pixels in the panel's canvas as a 2D array in [x, y] order. The first index of the array is the x-coordinate, and the second index is the y-coordinate. So, for example, index [a, b] represents the RGB pixel data for the pixel at position (x=a, y=b). Equivalent to GetPixels. More...
 
Color [,] GetPixels ()
 Returns the colors of all pixels in the panel's canvas as a 2D array. The first index of the array is the x-coordinate, and the second index is the y-coordinate. So, for example, index [a, b] represents the RGB pixel data for the pixel at position (x=a, y=b). Equivalent to GetPixelArray. More...
 
int [,] GetPixelsArgb ()
 Returns the colors of all pixels in the panel's canvas as a 2D array of RGB integers. The first index of the array is the x-coordinate, and the second index is the y-coordinate. So, for example, index [a, b] represents the RGB pixel data for the pixel at position (x=a, y=b). Equivalent to GetPixelsRgb. More...
 
int [,] GetPixelsRgb ()
 Returns the colors of all pixels in the panel's canvas as a 2D array of RGB integers. The first index of the array is the x-coordinate, and the second index is the y-coordinate. So, for example, index [a, b] represents the RGB pixel data for the pixel at position (x=a, y=b). Equivalent to GetPixelsArgb. More...
 
void Hide ()
 Hides the window from the screen so that it will not be shown. You can cause the window to reappear by calling Show(). More...
 
bool InBounds (int x, int y)
 Returns whether the given 0-based (x, y) pixel offset is within the bounds of this panel's drawing canvas area; in other words, if it is between (0, 0) and (width-1, height-1) inclusive. More...
 
void Load (string filename)
 Reads an image from a file and draws it onto this panel's canvas at (0, 0). Also resizes the canvas to be the size of the given image. Equivalent to LoadImage. More...
 
void LoadImage (string filename)
 Reads an image from a file and draws it onto this panel's canvas at (0, 0). Also resizes the canvas to be the size of the given image. Equivalent to Load. More...
 
void MainLoop ()
 Shows the panel window on the screen and loops waiting until it closes. More...
 
void Pause ()
 Causes the program to pause until the Enter key is pressed. see also: MainLoop. More...
 
void RefreshDisplay ()
 Causes the panel to redraw itself on the screen. You normally do not need to call this method, unless you have set the RepaintImmediately flag to false. Equivalent to Repaint. More...
 
void Repaint ()
 Causes the panel to redraw itself on the screen. You normally do not need to call this method, unless you have set the RepaintImmediately flag to false. Equivalent to RefreshDisplay. More...
 
void Resize (int width, int height)
 Resizes this panel's canvas to be the given size. The surrounding window will resize to tightly fit the canvas at its new size. More...
 
void Save ()
 Saves the pixels of this panel's canvas to the default save file. More...
 
void Save (string filename)
 Saves the pixels of this panel's canvas to the given file. More...
 
void SetPixelArray (Color[,] pixels)
 Sets the color of every pixel in the panel's canvas to the given array of [x, y] pixels. If the given 2D array's size is not the same as the size of this panel's canvas, this panel is resized to match the size of the array. Equivalent to SetPixels. More...
 
void SetPixelColor (int x, int y, Color color)
 Sets the color of the pixel at the given x/y coordinate to be the given color. More...
 
void SetPixelColor (int x, int y, int r, int g, int b)
 Sets the color of the pixel at the given x/y coordinate to the given red, green, and blue values. More...
 
void SetPixelColor (int x, int y, int a, int r, int g, int b)
 Sets the color of the pixel at the given x/y coordinate to the given alpha, red, green, and blue values. More...
 
void SetPixelColor (int x, int y, int rgb)
 Sets the color of the pixel at the given x/y coordinate to the color represented by the given RGB integer. More...
 
void SetPixelColorArgb (int x, int y, int argb)
 Sets the color of the pixel at the given x/y coordinate to the color represented by the given ARGB integer. More...
 
void SetPixels (Color[,] pixels)
 Sets the color of every pixel in the panel's canvas to the given array of [x, y] pixels. If the given 2D array's size is not the same as the size of this panel's canvas, this panel is resized to match the size of the array. Equivalent to SetPixelArray. More...
 
void SetPixelArray (int[,] pixels)
 Sets the color of every pixel in the panel's canvas to the given array of [x, y] pixels as RGB integers. If the given 2D array's size is not the same as the size of this panel's canvas, this panel is resized to match the size of the array. Equivalent to SetPixels. More...
 
void SetPixels (int[,] pixels)
 Sets the color of every pixel in the panel's canvas to the given array of [x, y] pixels as RGB integers. If the given 2D array's size is not the same as the size of this panel's canvas, this panel is resized to match the size of the array. Equivalent to SetPixelArray. More...
 
void Show ()
 Causes the panel's window to display itself on the screen. More...
 
void Sleep ()
 Causes the program to pause for 1/60 of a second. Useful for producing animations. More...
 
void Sleep (int ms)
 Causes the program to pause for the given number of milliseconds. Useful for producing animations. More...
 
void ToBack ()
 Moves the panel's window to the back of the Z-ordering of windows on the screen. More...
 
void ToFront ()
 Moves the panel's window to the front of the Z-ordering of windows on the screen. More...
 
void Zoom (int zoomFactor)
 Zooms the drawing panel in/out to the given factor. A zoom factor of 1, the default, indicates normal size. A zoom factor of 2 would indicate 200% size, and so on. The factor value passed should be at least 1; if not, 1 will be used. More...
 

Static Public Member Functions

static int GetAlpha (int argb)
 Returns the alpha component of the given ARGB integer, which is stored in bits 24-31. More...
 
static int GetBlue (int rgb)
 Returns the blue component of the given RGB integer, which is stored in bits 0-7. More...
 
static int GetGreen (int rgb)
 Returns the green component of the given RGB integer, which is stored in bits 8-15. More...
 
static int GetRed (int rgb)
 Returns the red component of the given RGB integer, which is stored in bits 16-23. More...
 
static void SaveAll ()
 Saves all active drawing panels into image files. Not meant to be called by students. More...
 
static void SetSaveFileName (string filename)
 Sets the file to be used when saving graphical output for all DrawingPanels. Not meant to be called by students. More...
 
static int ToRgbInteger (int r, int g, int b)
 Returns an RGB integer made from the given red, green, and blue components from 0-255. The returned integer is suitable for use with various RGB integer methods in this class such as SetPixel. More...
 
static int ToRgbInteger (int a, int r, int g, int b)
 Returns an RGB integer made from the given alpha, red, green, and blue components from 0-255. The returned integer is suitable for use with various RGB integer methods in this class such as SetPixel. More...
 

Properties

bool Antialiased [get, set]
 Whether the panel performs smoothing on its pixels; default false. More...
 
Brush Background [get, set]
 The background color painted onto the panel's drawing canvas; default white. When this is set, it clears the panel and fills its canvas area with the new background color. More...
 
int Bottom [get, set]
 The y-coordinate of the bottom of the panel window, which is equal to its top y coordinate plus the window's height. More...
 
Form Form [get]
 The Windows Form representing this panel's window. In general you should not need to directly access the window, and can mostly just call methods on the DrawingPanel itself or its Graphics object; but this is provided as a convenience. Note that calling some methods and properties on this form directly (e.g. Top, Width, Size) could cause the form state to go out of sync with the DrawingPanel state; this is not recommended. More...
 
Graphics Graphics [get]
 The Graphics object that can be used to draw on the panel's canvas. Note that certain DrawingPanel methods invalidate the Graphics object and switch to a new one, such as when the panel is resized; for that reason, it is not recommended to store the returned Graphics property result for long periods in your code. More...
 
int Height [get, set]
 The height of the panel's canvas area in pixels. The panel's window will size itself to tightly fit a canvas of this height. More...
 
int Left [get, set]
 The x-coordinate of the left side of the panel window. Equivalent to X property. More...
 
Point Location [get, set]
 The x/y location of the top-left corner of the panel window. More...
 
bool RepaintImmediately [get, set]
 Whether the panel should automatically redraw itself after each drawing operation; default true. It can be useful to set this to false if you are about to perform a bunch of small drawing operations, such as setting the color of many individual pixels, and do not want the slowdown of repainting after each individual pixel changes color. More...
 
int Right [get, set]
 The x-coordinate of the right side of the panel window, which is equal to its left x coordinate plus the window's width. More...
 
Size Size [get, set]
 The size of the panel's drawing canvas in pixels. More...
 
string Title [get, set]
 The title text that will appear in the window's top title bar; default "DrawingPanel". More...
 
int Top [get, set]
 The y-coordinate of the top of the panel window. Equivalent to Y property. More...
 
bool Visible [get, set]
 Whether the panel's window should be shown on the screen; default true. More...
 
int Width [get, set]
 The height of the panel's canvas area in pixels. The panel's window will size itself to tightly fit a canvas of this width. More...
 
int X [get, set]
 The x-coordinate of the left side of the panel window. Equivalent to Left property. More...
 
int Y [get, set]
 The y-coordinate of the top of the panel window. Equivalent to Top property. More...
 

Detailed Description

A simplified C# drawing window class based on DrawingPanel.java class that accompanies the Building Java Programs textbook.

author: Marty Stepp, Stanford University. version: 1.031, 2018/11/13 Some code written by or based on code by Alec McTavish, Bothell High School (thanks!).

The DrawingPanel class provides a simple interface for drawing persistent images using a Graphics object. An internal Bitmap object is used to keep track of what has been drawn. A client of the class simply constructs a DrawingPanel of a particular size and then draws on it with its Graphics object, setting the background color if they so choose.

The following is a short example program that uses DrawingPanel:


using System.Drawing;
using System.Drawing.Drawing2D;
public class SmileyFace
{
    public static void Main()
    {
        DrawingPanel panel = new DrawingPanel(400, 300);
        panel.Background = Brushes.Yellow;
        Graphics g = panel.GetGraphics();
        g.DrawEllipse(Pens.Red, 10, 20, 100, 100);
        g.FillRectangle(Brushes.Blue, 50, 50, 70, 20);
        panel.MainLoop();
    }
}

Constructor & Destructor Documentation

◆ DrawingPanel() [1/4]

DrawingPanel.DrawingPanel ( )
inline

Constructs a new panel of a default width and height.

◆ DrawingPanel() [2/4]

DrawingPanel.DrawingPanel ( int  width,
int  height 
)
inline

Constructs a new panel of the given width and height.

Parameters
widthpanel's width in pixels
heightpanel's height in pixels

◆ DrawingPanel() [3/4]

DrawingPanel.DrawingPanel ( int  x,
int  y,
int  width,
int  height 
)
inline

Constructs a new panel of the given width and height, with its top/left coordinate at the given (x, y) pixel.

Parameters
xpanel's left x coordinate
ypanel's top y coordinate
widthpanel's width in pixels
heightpanel's height in pixels

◆ DrawingPanel() [4/4]

DrawingPanel.DrawingPanel ( string  filename)
inline

Constructs a new panel to display an image from the given file. The panel window will be sized to tightly fit that image.

Parameters
filenamefile path/name containing image file to display

Member Function Documentation

◆ Clear()

void DrawingPanel.Clear ( )
inline

Fills the panel's canvas area with its background color, wiping out any shapes that have been previously drawn.

◆ Close()

void DrawingPanel.Close ( )
inline

Closes the panel window, causing it to disappear from the screen.

◆ GetAlpha()

static int DrawingPanel.GetAlpha ( int  argb)
inlinestatic

Returns the alpha component of the given ARGB integer, which is stored in bits 24-31.

Parameters
argbthe ARGB integer from which to extract alpha component

◆ GetBlue()

static int DrawingPanel.GetBlue ( int  rgb)
inlinestatic

Returns the blue component of the given RGB integer, which is stored in bits 0-7.

Parameters
rgbthe RGB integer from which to extract blue component

◆ GetGraphics()

Graphics DrawingPanel.GetGraphics ( )
inline

Returns the Graphics object for this panel's canvas. Note that certain DrawingPanel methods invalidate the Graphics object and switch to a new one, such as when the panel is resized; for that reason, it is not recommended to store the result of GetGraphics for long periods in your code. Equivalent to the Graphics property; kept in for compatibility with some Java-isms.

◆ GetGreen()

static int DrawingPanel.GetGreen ( int  rgb)
inlinestatic

Returns the green component of the given RGB integer, which is stored in bits 8-15.

Parameters
rgbthe RGB integer from which to extract green component

◆ GetPixelArray()

Color [,] DrawingPanel.GetPixelArray ( )
inline

Returns the colors of all pixels in the panel's canvas as a 2D array in [x, y] order. The first index of the array is the x-coordinate, and the second index is the y-coordinate. So, for example, index [a, b] represents the RGB pixel data for the pixel at position (x=a, y=b). Equivalent to GetPixels.

◆ GetPixelColor()

Color DrawingPanel.GetPixelColor ( int  x,
int  y 
)
inline

Returns the color of the given pixel in the panel's canvas.

Parameters
xx-coordinate of pixel
yy-coordinate of pixel

◆ GetPixels()

Color [,] DrawingPanel.GetPixels ( )
inline

Returns the colors of all pixels in the panel's canvas as a 2D array. The first index of the array is the x-coordinate, and the second index is the y-coordinate. So, for example, index [a, b] represents the RGB pixel data for the pixel at position (x=a, y=b). Equivalent to GetPixelArray.

◆ GetPixelsArgb()

int [,] DrawingPanel.GetPixelsArgb ( )
inline

Returns the colors of all pixels in the panel's canvas as a 2D array of RGB integers. The first index of the array is the x-coordinate, and the second index is the y-coordinate. So, for example, index [a, b] represents the RGB pixel data for the pixel at position (x=a, y=b). Equivalent to GetPixelsRgb.

◆ GetPixelsRgb()

int [,] DrawingPanel.GetPixelsRgb ( )
inline

Returns the colors of all pixels in the panel's canvas as a 2D array of RGB integers. The first index of the array is the x-coordinate, and the second index is the y-coordinate. So, for example, index [a, b] represents the RGB pixel data for the pixel at position (x=a, y=b). Equivalent to GetPixelsArgb.

◆ GetRed()

static int DrawingPanel.GetRed ( int  rgb)
inlinestatic

Returns the red component of the given RGB integer, which is stored in bits 16-23.

Parameters
rgbthe RGB integer from which to extract red component

◆ Hide()

void DrawingPanel.Hide ( )
inline

Hides the window from the screen so that it will not be shown. You can cause the window to reappear by calling Show().

◆ InBounds()

bool DrawingPanel.InBounds ( int  x,
int  y 
)
inline

Returns whether the given 0-based (x, y) pixel offset is within the bounds of this panel's drawing canvas area; in other words, if it is between (0, 0) and (width-1, height-1) inclusive.

Parameters
xx-coordinate of pixel to check
yy-coordinate of pixel to check

◆ Load()

void DrawingPanel.Load ( string  filename)
inline

Reads an image from a file and draws it onto this panel's canvas at (0, 0). Also resizes the canvas to be the size of the given image. Equivalent to LoadImage.

Parameters
filenamefile name/path of image to load

◆ LoadImage()

void DrawingPanel.LoadImage ( string  filename)
inline

Reads an image from a file and draws it onto this panel's canvas at (0, 0). Also resizes the canvas to be the size of the given image. Equivalent to Load.

Parameters
filenamefile name/path of image to load

◆ MainLoop()

void DrawingPanel.MainLoop ( )
inline

Shows the panel window on the screen and loops waiting until it closes.

◆ Pause()

void DrawingPanel.Pause ( )
inline

Causes the program to pause until the Enter key is pressed. see also: MainLoop.

◆ RefreshDisplay()

void DrawingPanel.RefreshDisplay ( )
inline

Causes the panel to redraw itself on the screen. You normally do not need to call this method, unless you have set the RepaintImmediately flag to false. Equivalent to Repaint.

◆ Repaint()

void DrawingPanel.Repaint ( )
inline

Causes the panel to redraw itself on the screen. You normally do not need to call this method, unless you have set the RepaintImmediately flag to false. Equivalent to RefreshDisplay.

◆ Resize()

void DrawingPanel.Resize ( int  width,
int  height 
)
inline

Resizes this panel's canvas to be the given size. The surrounding window will resize to tightly fit the canvas at its new size.

◆ Save() [1/2]

void DrawingPanel.Save ( )
inline

Saves the pixels of this panel's canvas to the default save file.

◆ Save() [2/2]

void DrawingPanel.Save ( string  filename)
inline

Saves the pixels of this panel's canvas to the given file.

Parameters
filenamefile name/path in which to save file

◆ SaveAll()

static void DrawingPanel.SaveAll ( )
inlinestatic

Saves all active drawing panels into image files. Not meant to be called by students.

◆ SetPixelArray() [1/2]

void DrawingPanel.SetPixelArray ( Color  pixels[,])
inline

Sets the color of every pixel in the panel's canvas to the given array of [x, y] pixels. If the given 2D array's size is not the same as the size of this panel's canvas, this panel is resized to match the size of the array. Equivalent to SetPixels.

Parameters
pixels2D array of pixels to display, in [x, y] dimension order

◆ SetPixelArray() [2/2]

void DrawingPanel.SetPixelArray ( int  pixels[,])
inline

Sets the color of every pixel in the panel's canvas to the given array of [x, y] pixels as RGB integers. If the given 2D array's size is not the same as the size of this panel's canvas, this panel is resized to match the size of the array. Equivalent to SetPixels.

Parameters
pixels2D array of pixel RGB integers to display, in [x, y] dimension order

◆ SetPixelColor() [1/4]

void DrawingPanel.SetPixelColor ( int  x,
int  y,
Color  color 
)
inline

Sets the color of the pixel at the given x/y coordinate to be the given color.

Parameters
xx-coordinate of pixel
yy-coordinate of pixel
colorcolor to use for pixel

◆ SetPixelColor() [2/4]

void DrawingPanel.SetPixelColor ( int  x,
int  y,
int  r,
int  g,
int  b 
)
inline

Sets the color of the pixel at the given x/y coordinate to the given red, green, and blue values.

Parameters
xx-coordinate of pixel
yy-coordinate of pixel
rred component to use for pixel from 0-255
ggreen component to use for pixel from 0-255
bblue component to use for pixel from 0-255

◆ SetPixelColor() [3/4]

void DrawingPanel.SetPixelColor ( int  x,
int  y,
int  a,
int  r,
int  g,
int  b 
)
inline

Sets the color of the pixel at the given x/y coordinate to the given alpha, red, green, and blue values.

Parameters
xx-coordinate of pixel
yy-coordinate of pixel
aalpha component to use for pixel from 0-255
rred component to use for pixel from 0-255
ggreen component to use for pixel from 0-255
bblue component to use for pixel from 0-255

◆ SetPixelColor() [4/4]

void DrawingPanel.SetPixelColor ( int  x,
int  y,
int  rgb 
)
inline

Sets the color of the pixel at the given x/y coordinate to the color represented by the given RGB integer.

Parameters
xx-coordinate of pixel
yy-coordinate of pixel
rgbRGB integer representing color to use for pixel

◆ SetPixelColorArgb()

void DrawingPanel.SetPixelColorArgb ( int  x,
int  y,
int  argb 
)
inline

Sets the color of the pixel at the given x/y coordinate to the color represented by the given ARGB integer.

Parameters
xx-coordinate of pixel
yy-coordinate of pixel
argbARGB integer representing color to use for pixel

◆ SetPixels() [1/2]

void DrawingPanel.SetPixels ( Color  pixels[,])
inline

Sets the color of every pixel in the panel's canvas to the given array of [x, y] pixels. If the given 2D array's size is not the same as the size of this panel's canvas, this panel is resized to match the size of the array. Equivalent to SetPixelArray.

Parameters
pixels2D array of pixels to display, in [x, y] dimension order

◆ SetPixels() [2/2]

void DrawingPanel.SetPixels ( int  pixels[,])
inline

Sets the color of every pixel in the panel's canvas to the given array of [x, y] pixels as RGB integers. If the given 2D array's size is not the same as the size of this panel's canvas, this panel is resized to match the size of the array. Equivalent to SetPixelArray.

Parameters
pixels2D array of pixel RGB integers to display, in [x, y] dimension order

◆ SetSaveFileName()

static void DrawingPanel.SetSaveFileName ( string  filename)
inlinestatic

Sets the file to be used when saving graphical output for all DrawingPanels. Not meant to be called by students.

◆ Show()

void DrawingPanel.Show ( )
inline

Causes the panel's window to display itself on the screen.

◆ Sleep() [1/2]

void DrawingPanel.Sleep ( )
inline

Causes the program to pause for 1/60 of a second. Useful for producing animations.

◆ Sleep() [2/2]

void DrawingPanel.Sleep ( int  ms)
inline

Causes the program to pause for the given number of milliseconds. Useful for producing animations.

◆ ToBack()

void DrawingPanel.ToBack ( )
inline

Moves the panel's window to the back of the Z-ordering of windows on the screen.

◆ ToFront()

void DrawingPanel.ToFront ( )
inline

Moves the panel's window to the front of the Z-ordering of windows on the screen.

◆ ToRgbInteger() [1/2]

static int DrawingPanel.ToRgbInteger ( int  r,
int  g,
int  b 
)
inlinestatic

Returns an RGB integer made from the given red, green, and blue components from 0-255. The returned integer is suitable for use with various RGB integer methods in this class such as SetPixel.

Parameters
rred component of pixel from 0-255
ggreen component of pixel from 0-255
bblue component of pixel from 0-255

◆ ToRgbInteger() [2/2]

static int DrawingPanel.ToRgbInteger ( int  a,
int  r,
int  g,
int  b 
)
inlinestatic

Returns an RGB integer made from the given alpha, red, green, and blue components from 0-255. The returned integer is suitable for use with various RGB integer methods in this class such as SetPixel.

Parameters
aalpha component of pixel from 0-255
rred component of pixel from 0-255
ggreen component of pixel from 0-255
bblue component of pixel from 0-255

◆ Zoom()

void DrawingPanel.Zoom ( int  zoomFactor)
inline

Zooms the drawing panel in/out to the given factor. A zoom factor of 1, the default, indicates normal size. A zoom factor of 2 would indicate 200% size, and so on. The factor value passed should be at least 1; if not, 1 will be used.

NOTE: This method is not yet implemented.

Parameters
zoomFactorthe zoom factor to use (1 or greater)

Property Documentation

◆ Antialiased

bool DrawingPanel.Antialiased
getset

Whether the panel performs smoothing on its pixels; default false.

◆ Background

Brush DrawingPanel.Background
getset

The background color painted onto the panel's drawing canvas; default white. When this is set, it clears the panel and fills its canvas area with the new background color.

◆ Bottom

int DrawingPanel.Bottom
getset

The y-coordinate of the bottom of the panel window, which is equal to its top y coordinate plus the window's height.

◆ Form

Form DrawingPanel.Form
get

The Windows Form representing this panel's window. In general you should not need to directly access the window, and can mostly just call methods on the DrawingPanel itself or its Graphics object; but this is provided as a convenience. Note that calling some methods and properties on this form directly (e.g. Top, Width, Size) could cause the form state to go out of sync with the DrawingPanel state; this is not recommended.

◆ Graphics

Graphics DrawingPanel.Graphics
get

The Graphics object that can be used to draw on the panel's canvas. Note that certain DrawingPanel methods invalidate the Graphics object and switch to a new one, such as when the panel is resized; for that reason, it is not recommended to store the returned Graphics property result for long periods in your code.

◆ Height

int DrawingPanel.Height
getset

The height of the panel's canvas area in pixels. The panel's window will size itself to tightly fit a canvas of this height.

◆ Left

int DrawingPanel.Left
getset

The x-coordinate of the left side of the panel window. Equivalent to X property.

◆ Location

Point DrawingPanel.Location
getset

The x/y location of the top-left corner of the panel window.

◆ RepaintImmediately

bool DrawingPanel.RepaintImmediately
getset

Whether the panel should automatically redraw itself after each drawing operation; default true. It can be useful to set this to false if you are about to perform a bunch of small drawing operations, such as setting the color of many individual pixels, and do not want the slowdown of repainting after each individual pixel changes color.

◆ Right

int DrawingPanel.Right
getset

The x-coordinate of the right side of the panel window, which is equal to its left x coordinate plus the window's width.

◆ Size

Size DrawingPanel.Size
getset

The size of the panel's drawing canvas in pixels.

◆ Title

string DrawingPanel.Title
getset

The title text that will appear in the window's top title bar; default "DrawingPanel".

◆ Top

int DrawingPanel.Top
getset

The y-coordinate of the top of the panel window. Equivalent to Y property.

◆ Visible

bool DrawingPanel.Visible
getset

Whether the panel's window should be shown on the screen; default true.

◆ Width

int DrawingPanel.Width
getset

The height of the panel's canvas area in pixels. The panel's window will size itself to tightly fit a canvas of this width.

◆ X

int DrawingPanel.X
getset

The x-coordinate of the left side of the panel window. Equivalent to Left property.

◆ Y

int DrawingPanel.Y
getset

The y-coordinate of the top of the panel window. Equivalent to Top property.


The documentation for this class was generated from the following file: