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
0
votes
1 answer

Why OnPaint event of two glcontrols not running synchronously - opentk c#

I have two glControls. Each have it's on paint event. But before completely running the functions of paint1 event, system calls paint2 event. I thought the functions inside each event will be called completely synchronously. Can I make that way.…
nsds
  • 961
  • 4
  • 13
  • 39
0
votes
0 answers

So how can I manually draw a legend in the bottom right with OnPaint on a dynamic resize dialog?

I have a situation that I am not sure how to resolve. I have a CDialog that supports dynamic resizing and I have a static control on there: I have set the properties of this control to invisible and to move 100 in both directions: I have set it as…
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
0
votes
1 answer

C# - Button Hover Triggering OnPaint

I am attempting to have a simple program that will paint a rectangle or a circle dependant on the radio button selected. The drawing will change once the 'Draw' button is pressed. However I seem to be having an issue with the button, when I hover…
Its
  • 5
  • 2
0
votes
0 answers

Custom Control not painting?

I have created a custom control for drawing a Dial type gauge but I've come across a strange issue. The form that I am using the gauge on has two of these gauges. One gauge works perfectly fine (the one docked on the left), but the one on the right…
0
votes
1 answer

C# Save location of drawn Ellipse in List?

a small question here where I didn't find a proper answer to. I want to save a drawn location of a Ellipse so I can later on draw a line between 2 ellipses, so I want to save this as a point if this is possible. protected override void…
Vengenecx
  • 105
  • 8
0
votes
0 answers

c# Drawing lines between 2 buttons

I hope you can help me and this is a big code, so I'll try to explain it short. I'm making a program that can place logic gates and that can connect to each other, I'm using the OnPaint(PaintEventArgs e) method and I have troubles with connecting…
Vengenecx
  • 105
  • 8
0
votes
0 answers

Strange Behaviour OnPaint/OnLayout

I have a Grid and a Quad. The Grid Layouts Quads in it. class Grid : System.Windows.Forms.Control { protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); } protected override void…
mroman
  • 1,354
  • 9
  • 14
0
votes
2 answers

Painting to Form then to Printer

I often find myself needing to create custom reports that do NOT work with Crystal Reports or Report Viewer. Often, I hack a DataTable together and dumping that into a DataGridView control. It is never pretty, and printing is difficult. What I need…
user153923
0
votes
2 answers

can't invoke paint

I created my own control and overwritten the onpaint event, the problem is that the paint event stopped working Any ideas why? And how to restore it?
unicorn
  • 829
  • 2
  • 8
  • 13
0
votes
0 answers

OnPaint clearing background on invalidate

I'm developing an application in which I have a parent UserControl that draws to the screen during OnPaint with several child UserControls doing the same. However, when the parent or child are invalidated, The parent control's painting is…
Alan
  • 49
  • 8
0
votes
0 answers

How to use Invalidate() in a child window's member function?

UPDATE: Thanks for IInspectable's reply. I have edited my problem. I am writing a dialog-based application which has a static control. The app draws a line according to the points captured by OnLButtonDown() and OnLButtonUp(). I create a class…
0
votes
0 answers

User control does not refresh

I have created a usercontrol to which you can add different timeslots. All timeslots together form a trip. The control should draw all timeslots relative to the width of the control. Color depending on ActivityType. If I add the TripActivity in the…
0
votes
2 answers

How to save drew Graphics of "Paint()" into image using c#?

I actually wanted to Convert RTF into Image so after googling a lot I've got a code that does it by Paint() Event of Picturebox1 and it works perfectly : private void pictureBox1_Paint(object sender, PaintEventArgs e) { …
Khaled Rakhisi
  • 317
  • 1
  • 4
  • 18
0
votes
0 answers

Drawing border around DataGridView causes issues when scrolling

I have a custom DataGridView that I am drawing to set the colour of the cell border and also the colour of the main border. Here is the code I am using: protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); …
Codemunkie
  • 433
  • 3
  • 14
0
votes
1 answer

How to achieve ImageAlign.MiddleCenter in the overriden OnPaint method

As the subject line explains it. I want to achieve the behaviour ImageAlign.MiddleCenter in the Image property of a Button control in .NET i am overriding the Button's OnPaint event. I use e.Graphics.DrawImage(Image,oDrawRectagle); to paint the…
this-Me
  • 2,139
  • 6
  • 43
  • 70