473,378 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Paint onClick

How I can paint something onClick event?
I need PaintEventArgs event in order to paint and raise Graphics, but
onClick I have only EventArgs Event...

Thanx
Nov 15 '05 #1
5 7024
Add the paint event as well as the onlcick event then use a boolean and set
it to true as you perform the click .. then check for the boolean true in
paint method and do the necessary drawings..

Nirosh
"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:ui**************@tk2msftngp13.phx.gbl...
How I can paint something onClick event?
I need PaintEventArgs event in order to paint and raise Graphics, but
onClick I have only EventArgs Event...

Thanx

Nov 15 '05 #2
Just invalidate the control in the onclick and paint from the paint event.

See the most asked GDI+ FAQ question for reasons why it shouldn't be done
any other way.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:ui****************@tk2msftngp13.phx.gbl...
How I can paint something onClick event?
I need PaintEventArgs event in order to paint and raise Graphics, but
onClick I have only EventArgs Event...

Thanx

Nov 15 '05 #3
Did it, but now I have other problem ...
I call drawlines by clicking on some image(button) ,but it paints INSIDE the
control was called from by paint event , instead of doing it on whole
screen, here is the code:

Graphics g = e.Graphics;
Point[] pts =
{
new Point(tab.button.Left, tab.button.Top), //tab.button - is the
button clicked
new Point(tab.button.Left+tab.button.Width, tab.button.Top),
new Point(tab.button.Left+tab.button.Width, tab.button.Top +
tab.button.Height),
new Point(pnlMainbar.Width,tab.button.Top + tab.button.Height),
//pnlMain - some panel on the screen
new Point(pnlMainbar.Width, pnlWorkArea.Top + pnlWorkArea.Height),
//pnlMainbar - see pnlMain
new Point(pnlWorkArea.Left, pnlWorkArea.Top + pnlWorkArea.Height), //
pnlWorkArea - see pnlMain
new Point(tab.button.Left, tab.button.Top)

};
g.DrawLines(new Pen(tab.tabColor,3),pts);
How can I force it to draw ON THE SCREEN, but not ON THE CONTROL
"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:uM*************@TK2MSFTNGP11.phx.gbl...
Just invalidate the control in the onclick and paint from the paint event.

See the most asked GDI+ FAQ question for reasons why it shouldn't be done
any other way.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:ui****************@tk2msftngp13.phx.gbl...
How I can paint something onClick event?
I need PaintEventArgs event in order to paint and raise Graphics, but
onClick I have only EventArgs Event...

Thanx


Nov 15 '05 #4
Well, you can obtain a graphics object from whatever control you want with
CreateGraphics, but in doing so you should beware the danger mentioned by
Bob.

But most likely you are updating the wrong OnPaint event.
In button_click call whateveryouwantupdated.Invalidate() and put your code
in that event

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #5

Hi Tamir,

In Click event, you can invoke Invalidate method of the control that you
want to draw.
If you want to draw on the full screen' DC, I think you should use P/invoke
some win32 APIs such as GetWindowDC, and get the full screen's DC.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #6

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

Similar topics

4
by: Tamir Khason | last post by:
Why when I lost focus (go to back) on form all GDI+ paints disappears..... BUG or I do something wrong???? TNX
0
by: vooose | last post by:
Consider a UserControl to which you do userControl.Paint += new PaintEventHandler(paint_method) If you don't like that way, and prefer to override onPaint( ) then the problem stated below...
5
by: ruca | last post by:
Hi, Can anyone give me examples of how can I hightlight cells of my datagrid? I know that I must use ItemBound event and probably JavaScript. The thing is that I have a anual calendar,...
3
by: Mike Cooper | last post by:
I have been staring at the above error for over a week now! I have a an inherited data class looking like thus: Public Class DataGridBoolColumnInherit Inherits...
6
by: jcrouse | last post by:
I am rotating some text is some label controls. In the one place I use it it works fine. In the other place I use it I can't figure out the syntax. I don't really understand the event. Where it...
7
by: hamil | last post by:
The following code will display a tif file on a form. When another form is moved over the tif image, the tif image is erased where the form was moved. A paint event occurs when this happens. My...
7
by: Rotsey | last post by:
Hi, I have a interface that I use for a form so I can pass the form to another object. How do I add the Paint event to the interface and subsequently handle the paint event in my other...
5
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, On a usercontrol I've put a set of radiobuttons within a groupbox. These radiobuttons have visual style enables, i.e. they turn orange when hovering over them and green when pushed. ...
3
by: ShadowLocke | last post by:
This is a weird one. I have a page that has two Panels on it with BorderStyle set to double. In design mode everything looks as it should. When I start the page up or move it to a production server,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.