Maximum Width And Height of panel
-
hi friends, i am using a panel of which i want to increase the size to maximum of may be 20,000 X 20,000 how can i achieve this on runtime? It gives me error like System.ComponentModel.Win32Exception: The operation completed successfully at System.Windows.Forms.DibGraphicsBufferManager.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits) at System.Windows.Forms.DibGraphicsBufferManager.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height) etc.. actually i am working on zooming of image.. i am calculating the zoom percent and just increasing the width and height of panel and redrawing the image on it.. this works fine ..but when my panel size is set to above 12,000 X 8000 the system gives the above error.. thanks in advance Samir
-
hi friends, i am using a panel of which i want to increase the size to maximum of may be 20,000 X 20,000 how can i achieve this on runtime? It gives me error like System.ComponentModel.Win32Exception: The operation completed successfully at System.Windows.Forms.DibGraphicsBufferManager.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits) at System.Windows.Forms.DibGraphicsBufferManager.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height) etc.. actually i am working on zooming of image.. i am calculating the zoom percent and just increasing the width and height of panel and redrawing the image on it.. this works fine ..but when my panel size is set to above 12,000 X 8000 the system gives the above error.. thanks in advance Samir
I just experimented subclassing
Panel
and it worked OK for me.public class MyPanel : Panel
{
public static readonly Size DefaultMaxSize = new Size(20000, 20000);
protected override Size DefaultMaximumSize
{
get { return DefaultMaxSize; }
}
}MyPanel myPanel = new MyPanel();
myPanel.Size = myPanel.Size = MyPanel.DefaultMaxSize;
Console.WriteLine(myPanel.Size);Dave
If this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) -
hi friends, i am using a panel of which i want to increase the size to maximum of may be 20,000 X 20,000 how can i achieve this on runtime? It gives me error like System.ComponentModel.Win32Exception: The operation completed successfully at System.Windows.Forms.DibGraphicsBufferManager.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits) at System.Windows.Forms.DibGraphicsBufferManager.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height) etc.. actually i am working on zooming of image.. i am calculating the zoom percent and just increasing the width and height of panel and redrawing the image on it.. this works fine ..but when my panel size is set to above 12,000 X 8000 the system gives the above error.. thanks in advance Samir
Try to disable double buffering, if you enable it. It seems that Control class (and its subclasses) tries to create a bitmap as a back buffer of same size as the control.