WinForms performance secret: is the result of PictureBox control slower than the original?

In my .NET 2.0 project, I made an empty derived class System.Windows.Forms.PictureBox:

public class NewPictureBox : PictureBox
{
    //absolutely nothing 
}

Then I did the following:

  • set both the derived control and the basic control property Imageto a rather large image (800x600), SizeMode- Normal(only the upper left part is displayed);
  • several events are connected NewPictureBoxand PictureBox, therefore, when you drag the mouse to the surface, you can draw a selection box;
  • configure it so that the properties of the selection window ( Width/ Height) will be updated in the elements NumericUpDownin real time.

The problem is that when you drag the mouse onto the high-speed PB, there is significant “variability” compared to the same as that based on PB. The Width/ values ​​are Heightnot updated in real time.

Does anyone know why this is? How to achieve the same smoothness with derivative control? Thank!

For those who want to check the minimum sample project with the described problem:

http://www.mediafire.com/?i2nq2tmmjzx

+3
source share
1 answer

, PB , . GDI + , . , Image, PB .

, Format32bppPArgb, , 10 , .

+1

Source: https://habr.com/ru/post/1730299/


All Articles