473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Is there a way to change the position of the child control on scrolling

4
I am developing a custom control which would act as a PDF viewer. I am extending this control from the Panel control(Please note i have enabled double buffering of controls). I am not using the auto scroll property i.e. i am manually controlling the scrolling. The control works fine if there are no controls. But when there are controls in it then i have to change the poistion of the controls when the scroll bar value changes. The problem is there's alot of flickering of child controls. Please see the code below may be i am doing something wrong. Also please note that i have to dynamically judge the position of the child controls

private void RenderPDFFields()
{
int scrollValue = vScroll.Value == 0 ? 10 : vScroll.Value;
//Getting the current PDF page
int activePage = GetPageNumberAtPoint(new Point(Width / 2, scrollValue));

if (activePage > -1)
{
//Calculating the location of the page
Rectangle firstRect = _currentRectPages[activePage];
Point firstPageLoc = new Point(5);
Point secondPageLoc = new Point(5);

if (firstRect.Width < Width)
firstPageLoc = new Point(Width / 2 - firstRect.Width / 2);

Point p = new Point(firstPageLoc.X - hScroll.Value,
firstRect.Top - vScroll.Value);
_pnlPages[activePage].Location = p;

_pnlPages[activePage].Visible = true;
_pnlPages[activePage].Invalidate();

//Hiding previous page
if (activePage > 0)
_pnlPages[activePage - 1].Visible = false;

//If there's enough virtual space left then show the next page as well
if (activePage + 1 < _defaultRectPages.Length & _pnlPages[activePage].Location.Y < 0)
{
Rectangle secondRect = _currentRectPages[activePage + 1];
if (secondRect.Width < Width)
secondPageLoc = new Point(Width / 2 - secondRect.Width / 2);

_pnlPages[activePage + 1].Location = new Point(secondPageLoc.X - hScroll.Value,
(firstRect.Top - vScroll.Value) + firstRect.Height + 5);

_pnlPages[activePage + 1].Visible = true;
_pnlPages[activePage].Invalidate();
}
}
}
Aug 17 '07 #1
0 1199

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Muralidhar | last post by:
Hi, I'm having a jsp page which is having a table and a div tag.The heading such as a radio button,Name , Age etc. are fixed.Only the data under it is scrolling. So i've set one table for header...
14
by: Zenobia | last post by:
Hello folks, Is it possible to position an item within a <td> element? For instance see below. The table has multiple rows, one for each database record. Each row has 3 hrefs associated with it...
3
by: spencer | last post by:
Hello, I have an index page with an autoscroller writen with CSS. The problem is the scrolling content(text and inages)'s position is correct but will off position when the broswer(IE) window...
2
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance...
7
by: Doc | last post by:
I've read in a couple of different places including the archives of this forum that html doesn't allow you to precisely dictate the position of an image, but I found this command (again in the...
2
by: Mike Brophy | last post by:
Here's my problem: I need to present text in a scrolling textarea such that a checkbox is not enabled until the user has scrolled to the very last line of the text using the vertical scrollbar. ...
6
by: C. Moya | last post by:
I hope someone has an answer: MaintainScrollPositionOnPostback works great. But, the problem is that sometimes we need to manually reset the scroll position back to the top (such as when hiding a...
2
by: Benjamin Kalytta | last post by:
Hi there, How do I get and set position and size of a html node (certain elements)? Following will not work for non absolute elements: ...
2
by: Brent | last post by:
I have a child page opened with a simple open() statement. I'd like to be able to refresh the parent page and keep the current scroll position. (If I do an "F5" refresh on IE, for instance, the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.