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

After form on paint, children controls don't repaint themself

I'm making a custom form with FormBorderStyle is none. In the form, I have a panel docked on the top of the form. The panel has some buttons docked on the right. I overrided OnPaint for the form to draw a border for it, when I resize the form,…
Johnny
  • 257
  • 2
  • 3
  • 6
0
votes
1 answer

OnPaint is not called when messagebox is shown

In our project I created a form and run it like below: Application.run(myform); In this form we need draw something so its OnPaint method is overridden and there is no problem normally, however OnPaint is never called when we show a messagebox or…
Garfex
  • 111
  • 1
  • 4
0
votes
2 answers

Easiest way to show update on a form when stucked in a function (OnPaint) for a long time

I am loading something that takes a long time in OnPaint function the first time I run my program, and I need a way to show my progress. I already have the progress stuff up, but I just don't know the simplest way to show it. Want either Something…
0
votes
2 answers

MemDC in OnPaint()-function

My OnPaint() function calls several other drawing functions. void CGraph::OnPaint () { CPaintDC dc(this); // CMemDC DC(&dc); dc.SetViewportOrg (0, 400); dc.SetMapMode(MM_ISOTROPIC); dc.SetWindowExt(1000, 800); …
Andreas D.
  • 73
  • 1
  • 12
0
votes
2 answers

CPaintDC in CStatic not cutting of drawing

My OnPaint() method in a derived CStatic-control is supposed to be cutting of parts of the drawing which are bigger than the control, as far as I know. However it doesn't do this. void CGraph::OnPaint () { CPaintDC dc(this); …
Andreas D.
  • 73
  • 1
  • 12
0
votes
2 answers

How to use the Control.Update method in a custom control

I'm going to post my code first since it is short and easy to understand, then i'll ask my question. public class BatteryLabel : Control { private Color _captionColor = SystemColors.Control; private Color _textColor = SystemColors.Info; …
Robert Snyder
  • 2,399
  • 4
  • 33
  • 65
0
votes
1 answer

Why won't Paint draw this image?

I am overriding the OnPaint method in my control that I've made to draw it directly from an image generated from my own ICan3D.Graphics class. When I save the image (as you can see, that line is commented out) the image is correct. When the form…
Freesnöw
  • 30,619
  • 30
  • 89
  • 138
-1
votes
2 answers

Creating a TextBox with watermark using ControlStyles.UserPaint shows the watermark just once at component creation

I work on a control inheriting from TextBox. I want it to feature a watermark property (the text you see when there is no text). All steps taken: In a new Visual Studio instance, click the link Create New Project, select the project type Windows…
user1889116
-1
votes
1 answer

Rectangle only paints sections which a label has passed over on c# form

I have a question about a program I am writing for practice, which in its current state allows the user to move a label around the Form using the arrow keys. I want to start adding some graphical rectangles to my program, and am currently practicing…
Christian T
  • 128
  • 1
  • 12
-1
votes
1 answer

OnPaint to draw 2 overlapping transparent images

Hi im trying to overlap 2 images with transparent backgrounds. i heard i can use the OnPaint method to do this so i tried protected override void OnPaint(PaintEventArgs e) { System.Drawing.Graphics obj; obj =…
Jason
  • 233
  • 4
  • 17
-1
votes
2 answers

OnPaint() and MouseMove event at same time in MFC C++ program

I have two functions- draw1() and draw2() that draws a bitmap to DC. I need to call them one after the other. So I do it in , void CDlg::OnPaint() { for(int i=0;i<10;i++) { draw1(); draw2(); } } I also want to add a clickmouse…
mrudulaw
  • 15
  • 1
  • 4
-1
votes
1 answer

C# Using onPaint with timer

I'm using onPaint with Invalidate() on timer_tick for repaints, how can I draw a background once which shouldn't be repainted with the rest? I tried using pictureBoxes, but they appearantly draw OVER the onPaint, also I can't use transparent images.…
SJ19
  • 1,933
  • 6
  • 35
  • 68
-1
votes
2 answers

repaint PictureBox with his information

When repaint my pictureboxes(from listUC) on a panel, i want to draw a ellipse and a string on each pictureBox. But nothing was drawn on the pictureBox. I want to draw the string wich is stored in the uc.Name; foreach (UseCase uc in listUC) { …
JP..t
  • 575
  • 1
  • 6
  • 28
-1
votes
1 answer

OnDrawItem does not respect horizontal scroll position when called from OnPaint

As the title says. History: To reduce flicker in my ListBox with DrawMode.OwnerDrawFixed and a custom OnDrawItem() I used the subclassing example from this page: http://yacsharpblog.blogspot.no/2008/07/listbox-flicker.html which…
-1
votes
1 answer

C# resize picturebox generated image

I draw an image based on text (_label) public Image getImage() { PointF initialLocation = new PointF(0.1f, 0.1f); //Bitmap b = new Bitmap(130, 50); Graphics g = Graphics.FromImage(new Bitmap(1,1)); …
David Evans
  • 213
  • 1
  • 2
  • 12
1 2 3
13
14