473,854 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question paint method

Hello,

Sorry if that question has already been raised...

I'm looking for the exact equivalent of Java paint(Graphics g) method in c#
in order to paint a specific component and all its children on a particular
graphics object. Can anyone help me ?

Thanks,

Franck.

Nov 15 '05 #1
4 6221
..NET controls have:

protected override void OnPaint(PaintEv entArgs pe)

"Franck" <fr*******@yaho o.fr> wrote in message
news:3f******** *************** @news.free.fr.. .
Hello,

Sorry if that question has already been raised...

I'm looking for the exact equivalent of Java paint(Graphics g) method in c# in order to paint a specific component and all its children on a particular graphics object. Can anyone help me ?

Thanks,

Franck.

Nov 15 '05 #2
Hello,

I don't think OnPaint is equivalent to "Java paint" but more to "Java
paintComponent" ... "Java paint" call the paintComponent of the current
JComponent (Control in c#) AND the paintComponent of the JComponent
childrens. I think OnPaint doesn't do that...

So I'm looking for a method that can paint a specific control and its
children in a specific graphics object.

Thanks

Franck.

"Alien" <al***@sympatic o.ca> a écrit dans le message de
news:AY******** ***********@new s01.bloor.is.ne t.cable.rogers. com...
.NET controls have:

protected override void OnPaint(PaintEv entArgs pe)

"Franck" <fr*******@yaho o.fr> wrote in message
news:3f******** *************** @news.free.fr.. .
Hello,

Sorry if that question has already been raised...

I'm looking for the exact equivalent of Java paint(Graphics g) method in

c#
in order to paint a specific component and all its children on a

particular
graphics object. Can anyone help me ?

Thanks,

Franck.


Nov 15 '05 #3
In the OnPaint method you could call Invalidate or UpdateWindow on the child
controls, this would have the effect of them painting, but this is not
usually required because generally speaking Windows will invalidate the
controls for you as required.

S.

"Franck" <fr*******@yaho o.fr> wrote in message
news:3f******** *************** @news.free.fr.. .
Hello,

I don't think OnPaint is equivalent to "Java paint" but more to "Java
paintComponent" ... "Java paint" call the paintComponent of the current
JComponent (Control in c#) AND the paintComponent of the JComponent
childrens. I think OnPaint doesn't do that...

So I'm looking for a method that can paint a specific control and its
children in a specific graphics object.

Thanks

Franck.

"Alien" <al***@sympatic o.ca> a écrit dans le message de
news:AY******** ***********@new s01.bloor.is.ne t.cable.rogers. com...
.NET controls have:

protected override void OnPaint(PaintEv entArgs pe)

"Franck" <fr*******@yaho o.fr> wrote in message
news:3f******** *************** @news.free.fr.. .
Hello,

Sorry if that question has already been raised...

I'm looking for the exact equivalent of Java paint(Graphics g) method
in c#
in order to paint a specific component and all its children on a

particular
graphics object. Can anyone help me ?

Thanks,

Franck.



Nov 15 '05 #4
Hello,

When calling Invalidate or Update, I can't give a specific graphics object
in paramater...

The idea is to control the graphics object on which the painting occurs for
the current control and all its children and not let .NET create its own
graphics object.

Any idea ?

Thanks

Franck

"Simon Trew" <ten.egnaro@wer ts> a écrit dans le message de
news:u9******** ********@tk2msf tngp13.phx.gbl. ..
In the OnPaint method you could call Invalidate or UpdateWindow on the child controls, this would have the effect of them painting, but this is not
usually required because generally speaking Windows will invalidate the
controls for you as required.

S.

"Franck" <fr*******@yaho o.fr> wrote in message
news:3f******** *************** @news.free.fr.. .
Hello,

I don't think OnPaint is equivalent to "Java paint" but more to "Java
paintComponent" ... "Java paint" call the paintComponent of the current
JComponent (Control in c#) AND the paintComponent of the JComponent
childrens. I think OnPaint doesn't do that...

So I'm looking for a method that can paint a specific control and its
children in a specific graphics object.

Thanks

Franck.

"Alien" <al***@sympatic o.ca> a écrit dans le message de
news:AY******** ***********@new s01.bloor.is.ne t.cable.rogers. com...
.NET controls have:

protected override void OnPaint(PaintEv entArgs pe)

"Franck" <fr*******@yaho o.fr> wrote in message
news:3f******** *************** @news.free.fr.. .
> Hello,
>
> Sorry if that question has already been raised...
>
> I'm looking for the exact equivalent of Java paint(Graphics g)
method
in c#
> in order to paint a specific component and all its children on a
particular
> graphics object. Can anyone help me ?
>
> Thanks,
>
> Franck.
>
>
>



Nov 15 '05 #5

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

Similar topics

11
6209
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the OnPaint . The recangle draws correct when i press the mouse, but when i release the mouse the background is not restored What should i do in the Onpaint to make sure the background (the form) is restored correctly ? This problem already keeps...
3
9003
by: pacemkr | last post by:
Is it possible to force a control to paint to a Graphics object (or Device Context, or a bitmap, anywhere aside from the form) that I provide. I am writing a windows form class that supports full alpha blending. Basically I'm trying to make a layered window that supports controls. In order to do that I need to redirect painting of the controls to a memory DC (which is then sent to the layered window). All this asuming that I figured out...
3
1989
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 System.Windows.Forms.DataGridBoolColumn Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal As CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)
3
1410
by: James Ramaley | last post by:
I have created a VB.NET User Control which inherits from TextBox. I have a general question regarding how functionality should be overwritten: I can either write a method which handles an event: function MyControl_Enter(...) handles MyControl.Enter or I can overwrite the relevant virtual method:
7
1832
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 question is..how would I save the tif images as soon as it is initially painted, and then restore the image in a paint event. It seems to me that there should be some sort of a SaveImage method and a RestoreImage method that would be fast. Note:...
9
3194
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I want to be able to draw lines in a picturebox based upon certain data points I have received. I dragged a picturebox from the toolbar onto my form, but after having gone through the help files, looking online and trying a variety of things, I...
3
1673
by: jm | last post by:
>From a C. Petzold book I have Programming Windows C#. It's a little old now, but anyway, it has on page 71 (shortened): form.Paint += new PaintEventHandler(MyPaintHandler); static void MyPaintHandler(object objSender, PaintEventArgs pea) { Graphics grfx = pea.Graphics; grfx.Clear(Color.Chocolate); }
2
3908
by: Kool-Aide | last post by:
Alright, here goes...When I put a menu strip on the windows form I can double click the exit button to go to the source page and it takes me to the on click exit blah blah blah and you would put Application.Exit(); Alright well what would I put for the print preview and the print and Save and saveas and open and new? I can't find anything for these. I am new at this and I am sure I am not going in the correct order to learn this stuff but I...
8
1305
by: Keith Rebello | last post by:
I have a program whose main form has a picture box on which concrete column sections are drawn. Input to the drawing is achieved by filling in data in various dialog boxes (called by using Form.Showdialog). When a dialog box is closed the drawing on the picture box is updated. Everything works fine when I run the program from the VS2005 IDE. However, when I run the program by clicking on the .exe outside the IDE, I have to keep...
0
9901
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11024
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10679
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10371
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9513
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5741
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4560
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4159
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3186
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.