473,487 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How can I draw graphics?

What is the best way to draw graphics like Task Manager's Performance
Graphic??
Mar 18 '07 #1
2 4213
"Overseer" <ce****@gmail.comwrote in message
news:OD*************@TK2MSFTNGP05.phx.gbl...
What is the best way to draw graphics like Task Manager's Performance
Graphic??
Use the routines in GDI+. First you'll need a Graphics object. Depending
on where you want to draw the graphics, you'll use the CreateGraphics
function of a control, or if you are going to use a Paint event, you will
receive the Graphics as an argument. For instance, if you want to paint in
the background of a PictureBox, you implement the Paint event of the
PictureBox and receive the Graphics object in the EventArgs argument. The
example provided by MSDN is this one:

private void pictureBox1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
// Create a local version of the graphics object for the PictureBox.
Graphics g = e.Graphics;

// Draw a string on the PictureBox.
g.DrawString("This is a diagonal line drawn on the control",
new Font("Arial",10), System.Drawing.Brushes.Blue, new
Point(30,30));
// Draw a line in the PictureBox.
g.DrawLine(System.Drawing.Pens.Red, pictureBox1.Left, pictureBox1.Top,
pictureBox1.Right, pictureBox1.Bottom);
}

As you can see, the Graphics object has many methods that start with
Draw..., such as DrawString, DrawLine, DrawElipse, etc., which let you paint
anything you want if you use them properly.

Mar 18 '07 #2
VJ
http://www.bobpowell.net/

Could help you!

VJ

"Overseer" <ce****@gmail.comwrote in message
news:OD*************@TK2MSFTNGP05.phx.gbl...
What is the best way to draw graphics like Task Manager's Performance
Graphic??


Mar 18 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
14708
by: °Ë´óɽÈË | last post by:
Hi, I create a graphics object for desktop window by following step: IntPtr hWnd = GetDesktopWindow(); // API Graphics g = Graphics.FromHWnd(hWnd); then draw the screen by g, but I can't draw...
6
41781
by: redneon | last post by:
Is it possible to draw directly to the screen using the .net libraries? I thought that it might be possible with GDI+ but I can't find out how to do it anywhere. A part of me suspects I may have to...
3
10307
by: Colin McGuire | last post by:
Hi there. I have written a small procedure to draw various shapes on things. A bit of it is shown below. Private Sub drawShape(ByVal shapeType As Integer, ByRef g As Graphics) Select Case...
2
3107
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
4
30787
by: Jason Huang | last post by:
Hi, In my C# Windows Form, how do I draw a Line? Thanks for help. Jason
9
4010
by: zhaow | last post by:
Hi, All Greetings! I want to develop as appllication that requires a line-drawing function in the blank area between two forms. I have looked up the MSDN, it says that a graphics object need a...
2
1592
by: =?Utf-8?B?S3VuIE5pdQ==?= | last post by:
Dear all, I'm new here and I'm sorry to trouble. But I've got the following problem when trying to draw a PNG file on a panel. My code is like this: Image mapImage = Image.FromFile...
1
5106
by: kummu4help | last post by:
hi, i want to draw rectangle based on mousedrag event. if user dragging the mouse, then the rectangle on the applet should increase or decrease basing on current mouse coordinates. i have the...
1
5575
by: martinsmith160 | last post by:
Hi all I am trying to create a level builder tool for a final year project and im having some problems drawing. I have placed a picture box within a panel so i can scroll around the image which is...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6847
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
272
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.