I have a DrawRectangle() method to draw a rectangle on my UserControl. The
OnPaint clear it. But in my reall application I cannot draw or update the
rectangle in OnPain. I have to draw or update it in my own method. What
shoudl I do?
Another question: how to draw just one pixel. The coe snippet do not work.
theGraphicsToDrawPoints.DrawRectangle(pen, xCoordinate, yCoordinate, 1, 1);
// Draw 2 by 2 sqare.
theGraphicsToDrawPoints.DrawRectangle(pen, xCoordinate, yCoordinate, 0, 0);
// Draw nothing.
theGraphicsToDrawPoints.DrawRectangle(pen, xCoordinate, yCoordinate, -1,
-1); // Draw nothing. 4 1961
The OnPaint method is overridden to do any custom painting. It is called
whenever the surface needs to be repainted. Call your method in an override
of the OnPaint method.
--
HTH,
Kevin Spencer
Microsoft MVP
DSI PrintManager, Miradyne Component Libraries: http://www.miradyne.net
"Haiping" <Ha*****@discussions.microsoft.comwrote in message
news:F0**********************************@microsof t.com...
>I have a DrawRectangle() method to draw a rectangle on my UserControl. The
OnPaint clear it. But in my reall application I cannot draw or update the
rectangle in OnPain. I have to draw or update it in my own method. What
shoudl I do?
Another question: how to draw just one pixel. The coe snippet do not work.
theGraphicsToDrawPoints.DrawRectangle(pen, xCoordinate, yCoordinate, 1,
1);
// Draw 2 by 2 sqare.
theGraphicsToDrawPoints.DrawRectangle(pen, xCoordinate, yCoordinate, 0,
0);
// Draw nothing.
theGraphicsToDrawPoints.DrawRectangle(pen, xCoordinate, yCoordinate, -1,
-1); // Draw nothing.
Hi Kevin,
Yes, I have to use this way. It works!
Thank you,
Haiping
How to draw just one pixel?
Thank you,
Hello,
Tamirro told me the following solution.
// Create a 1 x 1 bitmap and set the color
Bitmap bitmap = new Bitmap(1, 1);
bitmap.SetPixel(0, 0, seriesColor);
// Draw bitmap on Graphics surface
theGraphicsToDrawPoints.DrawImageUnscaled(bitmap, (int)xCoordinate,
(int)yCoordinate);
I am concerned about their speed. When we just move our application from VS
2003 to VS 2005 the SetPixel and GetPixel are very slow. We have to use some
unfafe code to avoid use them. Do you know Microsoft fix the problem? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: RickDee |
last post by:
I really can't understand on how to use CreateGraphics. Even though I have
follow what is shown in many sites, I can't get it working at all.
For...
|
by: S Domadia |
last post by:
hi,
now actually i want to design custom combo in which combo's button (in
which down arrow is there to perform clicking for dropdown type of...
|
by: JH |
last post by:
I have a tab control in my form. I am trying to create a dynamic pie chart.
If I use the following code,it works fine on the main form....
|
by: takilroy |
last post by:
Hi,
I am trying to implement this snippet of code from the .Net help
documentatiion so that I can modify the width of a textbox on one of my...
|
by: active |
last post by:
picInfo is a PictureBox that I write into when the mouse moves. Below is a
snip of the code.
The text flashes on the screen but does not stay...
|
by: saunderl |
last post by:
Hello Everyone,
I'm trying to just play with managed VC++. I just want to draw a box
on the form when it is clicked. Here is my click event...
|
by: pigeonrandle |
last post by:
Hi,
Please pity me, i am on a dial-up connection for the first time in 5
years :( !
Does anyone know how the resulting Graphics objects differ...
|
by: active |
last post by:
I did the following and then wondered it's good practice.
Me.CreateGraphics.DrawImage(Img, 0, 0)
I'm thinking about disposing the Graphics...
|
by: vijay_3491 |
last post by:
Hi,
How to write a CreateGraphics method for a class similar to
form.CreateGraphics()?
Pls help. Thanks in Advance.
|
by: bromptonville-un |
last post by:
Hello,
I'm an amateur in VB6, and I just switched to VB.Net (2003) .
However, I've never used graphicals functions in neither those
language... ...
|
by: tammygombez |
last post by:
Hey fellow JavaFX developers,
I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: CD Tom |
last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
| |