Questions tagged [onpaint]

An event that is triggered when a GUI component needs to be repainted

onPaint is the method responsible for performing the paint act triggered from a PaintEvent. This event is triggered when a GUI component needs to be repainted, usually as a result of a change to the underlying data behind the GUI component. onPaint is responsible for the physical display of the component, and in particular, applying the themes and colors appropriate for the application/output device.

198 questions
3
votes
2 answers

Onpaint events (invalidated) changing execution order after a period normal operation (runtime)

I have 3 data graphs that are painted via the their paint events. When I have data that I need to insert into the graph I call the controls invalidate() command. The first control's paint event actually creates a bitmap buffer for the other 2 graphs…
Luke Mcneice
  • 3,012
  • 4
  • 38
  • 50
3
votes
1 answer

Custom Control OnPaint does not fire

I have the following custom Control: public class Line : Control { protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); using (var p = new Pen(Color.Black, 3)) { var point1 = new…
Nick
  • 10,309
  • 21
  • 97
  • 201
3
votes
6 answers

How to avoid screen flickering when a control must be constantly repainted in C#?

I have a simple panel that is used as a drawing surface. The goal here is to draw a 4 pixel wide outline around a child ListView under certain circumstances. I would like to make the outline pulsate when something can be dragged into it. I am…
Ed S.
  • 122,712
  • 22
  • 185
  • 265
3
votes
2 answers

OnPaint is updated too often

I have a problem with the OnPaint method of CFrameWnd, and I cant seem to figure out what is happening. OnPaint is called approx every 10 ms, which causes the computer to freeze. Checked CPU usage and this app takes up 50%! The application is a very…
Pphoenix
  • 1,423
  • 1
  • 15
  • 37
3
votes
1 answer

What is the right way to use OnPaint in .Net applications?

Sometimes I need a custom appearence of a control. Or do alot of custom painting. I know I can do so with OnPaint (see: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onpaint.aspx) What is the right way to custom paint stuff on…
Mike de Klerk
  • 11,906
  • 8
  • 54
  • 76
3
votes
1 answer

Draw text on a Panel

OK, I fix everything, now is exactly what I want. I have a textBox1, panel1, and drawTexta (a button). When I click the button and choose a point in the panel, I want to draw the string from the textBox1. private void panel1_Paint(object sender,…
Bor
  • 775
  • 3
  • 19
  • 44
3
votes
2 answers

Custom control onPaint event not working

Hey people I have a problem I am writing a custom control. My control inherits from Windows.Forms.Control and I am trying to override the OnPaint method. The problem is kind of weird because it works only if I include one control in my form if I add…
Leonso Medina Lopez
  • 777
  • 1
  • 10
  • 21
2
votes
1 answer

OnPaint in winform - .NET Compact Framework 3.5

I am currently working on a curved progress bar in a smart device project. I override the OnPaint function. In Override OnPaint() function, I draw the curved progress bar in dark gray and draw a part of the progress bar in yellow to reflect the…
Charles LAU
  • 281
  • 1
  • 8
  • 19
2
votes
3 answers

How to add icons to TreeView control in c# using OnPaint args

How to add icons to TreeView control in c# WITHOUT the ImageList control? I think you need tp call the OnPaint event args but no idea how to do it.
user532104
  • 1,373
  • 6
  • 17
  • 27
2
votes
2 answers

How to eliminate flickering with erase background in mfc

I am working with SDI app to redraw graph and update data by using timer in View file. Even though I use ON_WM_ERASEBKGND to eliminate flickering, but it still happen. And below are my code that I tried to implement. Anyone has any ideas to…
2
votes
1 answer

Overriding OnPaint on Button - Font different

i am trying to Override OnPaint in WinForms Button controll. I want to align the Image and Text in the center, next to each other. As i am aware there is no way to do this with the default control. The idea was to inherit from Button, and "override"…
narthir
  • 33
  • 5
2
votes
2 answers

How to define onDraw() in MFC

I understand that the onDraw() function is virtual void which is called automatically via OnPaint(), which is itself triggered by the WM_PAINT message. My declaration goes something like this: myDialog.cpp void myDialog::OnDraw(CDC* dc) { …
John Tan
  • 1,331
  • 1
  • 19
  • 35
2
votes
2 answers

Draw window with just borders

How can I create a application window that is showing just the borders of the window, but i don't want to show the contents of the window itself. I mean i want to see the rest of the desktop or the others windows through the entire region of my…
Tonatiuh
  • 41
  • 5
2
votes
2 answers

C# Labels TextAlign doesn't work after OnPaint override

I have a problem with the TextAlign property of my labels. I created a new class, based on the label class, to override the OnPaint event. I had to override this because I didn't want the label to change the ForeColer if disabled. I don't really…
2
votes
0 answers

Slower rendering when using paths

Why does the following code render much more slowly when using a path as opposed to drawing each line individually? If I draw each line individually, window resizing seems ok, but if I use a path, the resizing is very laggy. public class…
pastillman
  • 1,104
  • 2
  • 16
  • 27
1 2
3
13 14