Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] problem about Canvas' max size.


Probably a windows limit on widget size (and coordinates).

I guess you win the big price at las vegas to buy a screen enough large to see a canvas with that size ... ;-).



Jiao Li <lijiao@xxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

11/12/2004 11:03 AM

Please respond to
platform-swt-dev

To
platform-swt-dev@xxxxxxxxxxx
cc
Subject
[platform-swt-dev] problem about Canvas' max size.






Hi,all

  I met some problems when I use SWT's Canvas control.
  When I draw on Canvas the max size of Canvas only can extend to 32767, here I set the max size 33000 so I can see the effect.

  I don't know if this is a bug of Canvas or this is Windows control feature.

  Can you give me some suggestions?

  The following is the code I test.

  Platform: WinXP Prefessional, Eclipse 3.0.1 RC.


  public class Scroll {


       public static void main(String[] args) {

               Display display = new Display();

               Shell shell = new Shell(display);

              shell.setLayout(new FillLayout());

               ScrolledComposite sc = new ScrolledComposite(shell, SWT.HORIZONTAL | SWT.VERTICAL);

               sc.setLayout(new FillLayout());

               final Canvas canvas = new Canvas(sc,0);

               canvas.setSize(33000, 200);

               sc.setContent(canvas);

               sc.setMinSize(33000,33000);

               sc.setExpandHorizontal(true);

               sc.setExpandVertical(true);

       
               canvas.addPaintListener(new PaintListener(){        

                       public void paintControl(PaintEvent arg0) {

                               // TODO Auto-generated method stub

                               GC gc = arg0.gc;

                               //here 33000 is bigger than 32767 so drawing operations is end at 32767.

                               gc.drawLine(0, 0, 33000, 200);

                               gc.dispose();

                       }

               });

       
               shell.open();

               while(!shell.isDisposed()){

                       if(!display.readAndDispatch()){

                               display.sleep();

                       }

               }

               display.dispose();

       }

}


Back to the top