location property of control not accepting values more than 32767

G

Guest

Hi,
In my application i need to create the controls at runtime and also need to
position them.
I am doing it by this like,

control.Location = new Point(x,y);

Now when i am getting lets say y greater than 32767 (lets say y = 33421)
after setting this location property it again becomes 32767. so i am not able
to position my controls.

can any one help me in this?
 
G

Gerald Hernandez

Nilesh said:
Hi,
In my application i need to create the controls at runtime and also need to
position them.
I am doing it by this like,

control.Location = new Point(x,y);

Now when i am getting lets say y greater than 32767 (lets say y = 33421)
after setting this location property it again becomes 32767. so i am not able
to position my controls.

can any one help me in this?

This is a limitation of Windows OS, not .NET.
IMHO, it sounds like maybe you have a design issue, as personally I can not
think of a "practical" reason for truely needing values like that.
 
G

Guest

hi , Gerald
Thanks for the quick response.
let me tell you the case.

I have a requirement like this.
I need to display multiple pictureboxes in my application in different modes
(line dual window, 4 window, 8 window etc..) . means in dual window mode i
have to display only 2 "full" pictureboxes in entire client rectangle area
and when user scrolls next 2 should come up, but at a time only 2 will be
visible. same case for 4 window mode , at this time 4 pictureboxes will be
fully visible and other comes up on scroll.
now in this 1 more option is "show all images". in this i need to create all
the pictureboxes but need to display 2 or 4 at a time. i need to create all
the pictureboxes bcoz i need to provide navigation also through pictureboxes.
means when user clicks on "Next" , next picturebox should gets highlighted.
Now in this option i am facing problem which i stated.

Can you please suggest me what should i do?
Thanks,
Nilesh
 
G

Gerald Hernandez

Nilesh said:
hi , Gerald
Thanks for the quick response.
let me tell you the case.

I have a requirement like this.
I need to display multiple pictureboxes in my application in different modes
(line dual window, 4 window, 8 window etc..) . means in dual window mode i
have to display only 2 "full" pictureboxes in entire client rectangle area
and when user scrolls next 2 should come up, but at a time only 2 will be
visible. same case for 4 window mode , at this time 4 pictureboxes will be
fully visible and other comes up on scroll.
now in this 1 more option is "show all images". in this i need to create all
the pictureboxes but need to display 2 or 4 at a time. i need to create all
the pictureboxes bcoz i need to provide navigation also through pictureboxes.
means when user clicks on "Next" , next picturebox should gets highlighted.
Now in this option i am facing problem which i stated.

Can you please suggest me what should i do?
Thanks,
Nilesh

What you want is pretty common, and usually when the question about the
limits come up.
Basically, you need to handle the scrolling yourself. In the "show all
images" mode, you would pretty much do exactly what you are doing in the
other mode. Only you would need to keep track of what images need to
currently be displayed and load those as necessary. Like you said, even
though they chose "show all", you are really only showing 2 or 4 at a time.
So you only need 2 or 4 picture boxes on screen. When they choose "Next",
all you do is load up the next block of images into the same picture boxes.

If you wanted to perform smooth scrolling, where you see just portions of
the neighboring pictures, then at most you only need one additional row or
column of picture boxes in the scroll direction. As the user scrolls in the
desired direction, once they hit the point where only entire pictures are
displayed, you kind of snap back.
For example: Let's say you want to scroll smoothly horizontally, but only
display 1 whole picture.
You would want 2 picture boxes. 1 to fill the current screen, and another to
scroll into view.
So at 50% scroll, you would see half of each picture.
Once you scroll the second picture fully into view, you no longer need the
first picture. So discard the first picture, load the second picture into
the first box, and reset your view to show the first box. Now load up the
third picture into the second box so it is ready to scroll into view.

I know it is much more complicated than just creating the whole array of
controls and letting the system handle the scrolling for you. But this is
really the way to do it. And yes, this is how many of the other apps that
handle this do it as well. And it is not just limited to pictures. List
boxes, tree views, and other things that need to perform lots of scrolling
follow the same general concept.

Gerald
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top