how to define scroll bar's page size value?

Hi all,

I have a confusion about calculating scroll bar's page size.

In my application, I am drawing an image according to scroll bar
position.

m_iGeneratedImgWidth - Width size of the image (this value is always
bigger)
rect.right                      - Width of the drawing area.

how to define scroll bar's page size value?

   SCROLLINFO info;
   info.cbSize = sizeof(SCROLLINFO);
   info.fMask = SIF_RANGE|SIF_PAGE|SIF_POS;
   info.nPos = 0;
   info.nMin = 0;
   info.nMax = m_iGeneratedImgWidth - rect.right;
   info.nPage = ?

In my OnHScrollBar() function, for SB_PAGELEFT / SB_PAGERIGHT codes, I
subtract/add 10 for displaying image.

I want to set correct value, because this is the only way to change
size of the tracking thumb of scroll bar control.

:)
Purusothaman A

0
1/10/2007 8:33:43 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1412 Views

Similar Articles

[PageSpeed] 37

A page size value is whatever you want it to be.  In your WM_HSCROLL or WM_VSCROLL
handlers you increment or decrement the value by whatever you feel like.  For example, for
a "page" you might increment or decrement by the GetClientRect() values Width() or
Height() values appropriately.  Or half of them.  Or 3/4 of them.  Or whatever.

The thumb size, which is the thumb size, has nothing to do with the amount of space you
will scroll on a page-up/down or page-left/right operation. Instead, it is the amount of
the range that is visible.

So if you have a window 200 pixels high, and you have an image 800 pixels high, you might
set the scroll range to be 0..600 (that's 0..(picture size - client height)).  You would
set the nPage value to 200.  This would give a wide thumb position.  It would *not* change
the amount you scroll in a WM_HSCROLL/WM_VSCROLL handler when a page request comes in.  It
just shows the amount of the image being shown.
					joe

On 10 Jan 2007 00:33:43 -0800, "Purusothaman A" <Purusothaman.A@gmail.com> wrote:

>Hi all,
>
>I have a confusion about calculating scroll bar's page size.
>
>In my application, I am drawing an image according to scroll bar
>position.
>
>m_iGeneratedImgWidth - Width size of the image (this value is always
>bigger)
>rect.right                      - Width of the drawing area.
>
>how to define scroll bar's page size value?
>
>   SCROLLINFO info;
>   info.cbSize = sizeof(SCROLLINFO);
>   info.fMask = SIF_RANGE|SIF_PAGE|SIF_POS;
>   info.nPos = 0;
>   info.nMin = 0;
>   info.nMax = m_iGeneratedImgWidth - rect.right;
>   info.nPage = ?
>
>In my OnHScrollBar() function, for SB_PAGELEFT / SB_PAGERIGHT codes, I
>subtract/add 10 for displaying image.
>
>I want to set correct value, because this is the only way to change
>size of the tracking thumb of scroll bar control.
>
>:)
>Purusothaman A
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
1/10/2007 2:56:16 PM
Thanks Joseph M.Newcomer for your nice reply.

:)
Purusothaman A

"Joseph M. Newcomer" wrote:

> A page size value is whatever you want it to be.  In your WM_HSCROLL or WM_VSCROLL
> handlers you increment or decrement the value by whatever you feel like.  For example, for
> a "page" you might increment or decrement by the GetClientRect() values Width() or
> Height() values appropriately.  Or half of them.  Or 3/4 of them.  Or whatever.
> 
> The thumb size, which is the thumb size, has nothing to do with the amount of space you
> will scroll on a page-up/down or page-left/right operation. Instead, it is the amount of
> the range that is visible.
> 
> So if you have a window 200 pixels high, and you have an image 800 pixels high, you might
> set the scroll range to be 0..600 (that's 0..(picture size - client height)).  You would
> set the nPage value to 200.  This would give a wide thumb position.  It would *not* change
> the amount you scroll in a WM_HSCROLL/WM_VSCROLL handler when a page request comes in.  It
> just shows the amount of the image being shown.
> 					joe
> 
> On 10 Jan 2007 00:33:43 -0800, "Purusothaman A" <Purusothaman.A@gmail.com> wrote:
> 
> >Hi all,
> >
> >I have a confusion about calculating scroll bar's page size.
> >
> >In my application, I am drawing an image according to scroll bar
> >position.
> >
> >m_iGeneratedImgWidth - Width size of the image (this value is always
> >bigger)
> >rect.right                      - Width of the drawing area.
> >
> >how to define scroll bar's page size value?
> >
> >   SCROLLINFO info;
> >   info.cbSize = sizeof(SCROLLINFO);
> >   info.fMask = SIF_RANGE|SIF_PAGE|SIF_POS;
> >   info.nPos = 0;
> >   info.nMin = 0;
> >   info.nMax = m_iGeneratedImgWidth - rect.right;
> >   info.nPage = ?
> >
> >In my OnHScrollBar() function, for SB_PAGELEFT / SB_PAGERIGHT codes, I
> >subtract/add 10 for displaying image.
> >
> >I want to set correct value, because this is the only way to change
> >size of the tracking thumb of scroll bar control.
> >
> >:)
> >Purusothaman A
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
> 
0
a9969 (81)
1/11/2007 4:51:00 AM
Reply:

Similar Artilces:

changing formula result to constant value
What's the quickest, easiest way to convert the result of a formula into a constant? For examply, I used the proper command to change fields of data to title case. Now I need to do a mail merge, and I want to change the fields so that the title case data is a value, rather than still being the formula. Thanks! Patience -- pemily ------------------------------------------------------------------------ pemily's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=7588 View this thread: http://www.excelforum.com/showthread.php?threadid=491857 For a single cell: ...

How many pages can a booklet have?
Hi how many pages can a booklet have? Is there a limit to the pages in a publisher booklet. Each page has three photos. There is no limit, your RAM may decide for you. What version Publisher? -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Verystumped" <Verystumped@discussions.microsoft.com> wrote in message news:8F2778CF-7B14-4BDD-93C5-EF9B39E2C1A7@microsoft.com... > Hi how many pages can a booklet have? Is there a limit to the pages in a > publisher booklet. Each page has three photos. ...

Collections Management
Dynamics GP v9 - Collections Management Users are unable to use "user defined letters" (Word Documents) for mass mailings. They are limited to only using predefined letters, or printing each letter individually for every customer. Error received when users attempt to use a custom letter: -------------------------------------------------- Unhandled script exception: Cannot find report "COL_Reminder_UpcomingDue". EXCEPTION_CLASS_SCRIPT_MISSING SCRIPT_CMD_REPORT -------------------------------------------------- ---------------- This post is a suggestion for Microso...

Excel formula bar
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel The formula bar in Excel has migrated part way off the screen to the left so I can neither close it nor move it. How can I get it back onto the screen? First thing to try: While Excel is running go to System Preferences> Display & set your display resolution to a higher setting. Switch back to Excel & see if you can drag the bar back to the middle of the screen, then set your resolution back to its normal setting. If that doesn't work post a new message in the Excel group for other suggestions. Make su...

Scrolling not working in spreadsheet (Excel 2000)
Good afternoon. We have Excel 2000 running on Windows 2000. I have a spreadsheet with a column that is filtered by Status - Open or Closed. If I am showing the 'Open' items, I can page up and down, use the up/down arrows and the mouse to scroll up and down in the document. If I show the 'Closed' items, none of the scrolling options work. The scroll bar on the right indicates that I'm 'moving' down in the document, and the cell reference in the upper left corner changes (as does the display of the cell contents) but all I see on the screen is the first page. An...

Page Breaks on cells
It pops up with putting a page break for every cell then when I am trying to reset them it tells me margins do fit and that it would take it to less than 10% minumum if I try to move them. Jo - Did you ever get an answer to this? I am having the same problem, and it is on a 30-tab workbook that I can't just re-created. I'm getting a page for every cell when I move the page breaks and they used to be fine! Help! :) "Jo Pratt" wrote: > It pops up with putting a page break for every cell then > when I am trying to reset them it tells me margins do fit > and...

Save page breaks
After I open a file and tell it to show page breaks then next time I open the file I need to re-tell it to show page breaks. How caon I make it stick? dave Zoid, Do a print preview. After that, the page breaks will show. -- Regards from Virginia Beach, EarlK ------------------------------------------------------------- "Guitarzoid" <guitarzoid@aol.com> wrote in message news:20030825212940.02716.00000314@mb-m23.aol.com... > After I open a file and tell it to show page breaks then next time I open the > file I need to re-tell it to show page breaks. How caon I make i...

Business Cards
Can anyone tell me whether you can change the print layout of the business cards? It is such a waste of card to only print 4 cards! I would likt to be able to print 8 business cards to a page. Can this be done? And how? Thanks, What version Publisher? What is the style number of your business cards? Are they the standard 3.5 x 2? Most templates are 2 columns of five or 10 to a page. It would be helpful to know the style number so as to calculate the margins and gaps. -- Mary Sauer http://msauer.mvps.org/ "Tonijr" <Tonijr@discussions.microsoft.com> wrote in message ...

how to show the stander tool bar??
Greeting, how to show the stander tool bar ?? such as File, Edit....Tools?? they just disppears?? if you are able to see the shortcut icons (i.e. new, open, save, etc.) that are normally under the main menu bar, right click in that area and click customize. a window will pop up and in the toolbars tab look for menu bar and check it's box if it is not checked. "Jon" <Jon@discussions.microsoft.com> wrote in message news:448A2535-394F-42C8-8E53-087D0DED7224@microsoft.com... > Greeting, > > how to show the stander tool bar ?? such as File, Edit....Tools?? >...

Value Return with the offset(?) function
I have a spreadsheet that has (for example) the following values A5 = 5 A10 = 18 A15 = 7 A20 = 22 Basically these numbers are summing other parts in the spreadsheet (weekly numbers). They are every 5 rows. Each week I add a new row (this week the value will be placed in A25, the week after, a30 etc etc. I would like to have a referenced cell (say in B1) that will give me the bottom most value, this week it should return what's in cell A20, next week A25 and so on. I tried using the Offset function with Count, but for the life of me cannot do it - if it can be done at all >...

Application-defined or object-defined error
Hi, I find myself stumped by an incredibly easy piece of code and one that I have used before. I am getting the error: Run-time error '1004': Application-defined or object-defined error I am getting the error when I run the following code: Private Sub Workbook_Open() With Application .ScreenUpdating = False .DisplayAlerts = False Workbooks.Open "\\depot02\rel\www\internal\business_areas\edg\Metrics\Phones\HighHoldTimesDetailed.xls" Workbooks("HighHoldTimesDetailed.xls").Worksheets("data").Cells.Copy _ Workbooks("phoneholdtime...

Criteria for opening a form based on a value in another form's subform
Hello everyone, Please pardon the noob question, but I've got a form with a subform and I would like to be able to open another form with only the records that match the primary key from the first form's subform, but I am unable to figure out how to specify that value in the query. In other forms (where subforms are not invovled), I can accomplish this with something like: =[Forms]![Form_Name].[Desired_Value] Is there something different I need to be doing when attempting to get a similar value from a subform? With many thanks in advance for any advice... -- Message posted via h...

Sumif and zero values question
I have a long list of product codes. Against each code is a number obtained from a sumif calculation from another long list of the same codes. A large number of these sumif results are zero. Is there a way of automatically hiding the zero lines such that if one became greater than zero it would automatically appear in the list? In other words I would like to be able to automatically only list those product codes where the sumif result was greater than zero. (Hope that's clear!) Thanks "Gordon" <GordonBP1@yahoo.invalid> wrote in message news:elseLfUeEHA.596@TK2MSFTNGP1...

Scrolling in Form View
In previous releases Access allowed you to scroll through records using the mouse wheel. 2007 seems to have done away with this function. This seems strange because it was very useful. Am I missing an option setting or is there some other way to allow this? Of all the issues involved in this upgrade this is the one that has my users on the brink of revolution. Any help will be greatly appreciated. ...

Titles rolling over to page 2
Hi everyone, I have a report with several subreports. When the report prints and any one of the sub-reports' data is too long to fit on the 1st page, it rolls over the remaining data to the 2nd page (which is fine). How would I have the column titles for that particular sub-report also roll over to the 2nd page? It is also cutting off half the words at the bottom of the page and the top of the second page when it does roll over to the 2nd page. I've tried adjusting the margins and that doesn't work. I am a new user and don't know if I set something up wrong. All ...

Questions on Bar Chart
Hello all, I have 2 sheets, "Data Sheet" and "Chart Sheet". Data Sheet contains data to create a bar chart in the Chart Sheet, including the data for bar chart title. I have no problem creating the bar chart using the data in the Data Sheet. I am just wondering whether I can make the chart title dynamic, which means whenever the value for chart title in the Data Sheet changes, the chart title will change. In addition, I want to insert an area on the bar chart for the Source information. I also want the source information dynamic from the value from the Data S...

runtime error 2465: application-defined or object-defined error
I'm trying to use a button on a main form to change the sort order of a sub- subform.When I execute the following, I get runtime error 2465: application- defined or object-defined error. opting to debug, I find the line with orderbyon highlighted. Anybody see what's wrong? Private sub timesort_click() Forms![control]![worklist]![approved].Form.OrderBy = "Forms![control]! [worklist]![approved]![time]" Forms![control]![worklist]![approved].Form.OrderBy0n = True End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/a...

Error bars in VBA
Hi everyone, I am having trouble with some vba code to add error bars to a new series I am creating. When I run the following code I get a 'ErrorBar method of Series class failed' error on the first .errorbar line. Can anyone help me out? With ActiveChart.SeriesCollection.NewSeries .name = GraphForm.tbxSeriesName.Value .Values = Worksheets("Data").Range("B1:B25") .XValues = Worksheets("Data").Range("A1:A25") .ErrorBar Direction:=xlX, Include:=xlErrorBarIncludeBoth, Type:=xlCustom, _ Amount:=Worksheets("Dat...

Get web page title from URL
I produce a monthly report of the number of page views on a web site. The data is obtained from Google Analytics, and the pages are designated by their URLs. A data analysis service we used previously furnished both the title and URL of each page. The URL isn't terribly user-friendly--most people want to know what was on the page, not what its URL was (yes, they can click on the URL, but there are hundreds of pages in this report). Is there any way to get Excel to extract the page title of a URL listed in the workbook, and report it in an adjacent cell? These are hyperlinks in cells? May...

Who do I get Publisher 2003 to open to a blank page?
I'd like to get Publisher 2003 to open to a blank page - no "start" page, no "new publication" dialog box on the left...just click the icon and a plain, blank page opens. silver <silver@discussions.microsoft.com> was very recently heard to utter: > I'd like to get Publisher 2003 to open to a blank page - no "start" > page, no "new publication" dialog box on the left...just click the > icon and a plain, blank page opens. Tools > Options > Uncheck "Use New Publication task pane at startup" > User Assistance &g...

how to do self-defined regression in excel?
Hi, I want to do regression ananlysis in excel using a sigmoid function, which is not offered in the general 6 functions in excel(by adding trendline). How can I do it? Thanks. The Analysis ToolPak - VBA addin has a regression function and probably everything else you want. Tools > AddIns then checkmark Analysis ToolPak - VBA Go back to Tools dropdown and it should be listed near the bottotm of the dropdown. >-----Original Message----- >Hi, I want to do regression ananlysis in excel using a >sigmoid function, which is not offered in the general 6 >functions in excel(by a...

Defining a variable to = MATCH
Dim thingy As Integer thingy = "=MATCH(""DiceC"",qperiodagentperformance!A:A,0)" ActiveCell.Formula = _ "=INDEX(qperiodagentperformance!D" & thingy & ":D13000,MATCH(""Agen Summary"",qperiodagentperformance!A" & thingy & ":A13000,0))" Range("D26").Select my thingy doesnt seem to work..... no comment Any suggestions on correcting this? Mik -- Message posted from http://www.ExcelForum.com Try with thingy = Application.Match("DiceC", Sheets("qperiodagentperformance"...

Proper way to store Form size in an XML config file? (Is this approach good?)
Hi, I need to store the size of my form in a config file. I was saving this in the registry, but I need it in a config file now. I came up with the following code. The part I'm not so sure about is where I call form.Height.ToString(). Should I be making use of some better built-in serialization capability? When I was usind the registry I was using TypeConverter to change things like Size, Location, BackgroundColor, etc. to strings. Is this the right way to do this in XML? Thanks, John System.Xml.XmlDocument d = new System.Xml.XmlDocument(); d.AppendChild(d.CreateXmlDeclaration("1...

I want to be able to scroll smoothly rather than one cell at a ti.
I want to be able to view my Excel file a certain way, but when I use the scrollbar, it only lets me scroll based on the widths of the cells. I want to be able to scroll smoothly. I want to be able to view partial cells, without being forced to view the entire cell. If i want to have some border cells surrounding the information of interest, it doesn;t let me partially exclude them from view. Please fix this so that I can view my files the way I want to view them. I can scroll "smoothly" ... using my mouse! *Clicking* the scroll wheel brings up a 4 headed arrow "thi...

title bar problem in Excel 2007
Sometimes when I start Excel for the first time after starting the PC, the title bar is overlaid with the status bar that would normally appear at the bottom of Excel, so I don't get to see the round Office button, and I see the zoom facility at the top, not the bottom, and the workspace is empty - no default empty spreadsheet. If I close Excel (by right clicking on the taskbar because there is X button to be seen) and then start it up, it then starts up fine. Excel was installed as part of Office 2007 SBE, running on Vista Ultimate 64 bit. Is this a known problem? I've not be...