473,698 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

4 New Member
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 = GetPageNumberAt Point(new Point(Width / 2, scrollValue));

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

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

Point p = new Point(firstPage Loc.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 < _defaultRectPag es.Length & _pnlPages[activePage].Location.Y < 0)
{
Rectangle secondRect = _currentRectPag es[activePage + 1];
if (secondRect.Wid th < Width)
secondPageLoc = new Point(Width / 2 - secondRect.Widt h / 2);

_pnlPages[activePage + 1].Location = new Point(secondPag eLoc.X - hScroll.Value,
(firstRect.Top - vScroll.Value) + firstRect.Heigh t + 5);

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

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

Similar topics

1
11266
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 which are fixed. Then a div tag inside which there is a table which is used for scrolling the data.When i select a radio i'm submitting the form.The problem is here i'm able to set focus to the radio button, but i'm unable to maintain the...
14
21918
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 (for edit, delete and update). I want to position these 3 href items in the same columns, which would be posible if the span could be positioned - for instance on the extreme right of the td in which it is contained.
3
9664
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 size was changed. How can I make the scrolling content "stick" the position with respect to the scrollowing box? Your advise is appreciated. Spencer
2
5301
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 RWD <script type='text/javascript'>
7
7983
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 archives of this forum) that apparently allows you to do exactly that. <img src="whateveryourfilelocationis" style="position:absolute; left:Xpx; top:Xpx"> What do you call this command? The responder of the particular message where I found it...
2
11483
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. Been searching for some functions to get scrollbar position for a textarea object but coming up empty. A nudge in the right direction would be appreciated. Thanks.
6
24956
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 panel and displaying different panel). 1) Temporarily setting MaintainScrollPositionOnPostbox=False in the postback event *seems* to work... but it's not the right answer as it messes up any subsequent event postbacks. 2) Registering a startup...
2
12915
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: document.defaultView.getComputedStyle(element,null).getPropertyValue("left") / getPropertyValue("width") ... It will return "auto" in certain circumstances.
2
5008
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 page will return to the last position it had.) Is there any "easy" way to accomplish this? I've been using window.opener.location.reload();
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9026
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.