Solved

Crystal Reports XI Viewer, size to percent or screen ?

Posted on 2006-11-30
7
791 Views
Last Modified: 2012-08-13

Hello, I have a vb .net 2003 application using CR XI viewer to display reports.  when the user increases the magnification, I increase the viewer width with the code below.  

I can only get it to work with the units in pixels: Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Pixel(800)
This will not work: Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Percentage(100)

If I use the percentage it sizes to 100 pixels instead of 100%.  Ive tried .Percentage(100) and .Percentage(100%)

Here's the code:  Every thing works but the case else.

    Private Sub crViewer1_ViewZoom(ByVal source As Object, ByVal e As CrystalDecisions.Web.ZoomEventArgs) Handles crViewer1.ViewZoom

        Me.crViewer1.BestFitPage = False

        Select Case e.NewZoomFactor

            Case 100
                Me.crViewer1.BestFitPage = True

            Case 125
                Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Pixel(1100)
                Me.crViewer1.Height = System.Web.UI.WebControls.Unit.Pixel(1100)

            Case 150
                Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Pixel(1400)
                Me.crViewer1.Height = System.Web.UI.WebControls.Unit.Pixel(1400)

            Case Else
                Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Percentage(100)
                Me.crViewer1.Height = System.Web.UI.WebControls.Unit.Percentage(100)

        End Select

    End Sub

this is the link that I used:
http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2016117&sliceId=&dialogID=10458781&stateId=1%200%2010460751

Thanks for any help.

0
Comment
Question by:sourcelink
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 18051079
It would probably be better to ask this in the VB.Net TA.

mlmcc
0
 
LVL 8

Expert Comment

by:mhunts
ID: 18062212
You could write a user function that takes the percentage as an input parameter, and converts it to pixels, then use the WebControls.Unit.Pixel technique.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 18063907
0
 

Author Comment

by:sourcelink
ID: 18069660

Thanks mhunts for your response,

This is probably a dumb question, but how do I know on the server side, what the client resolution is?

Thanks!

0
 
LVL 8

Accepted Solution

by:
mhunts earned 500 total points
ID: 18072242
The server can't know what the client resolution is, unless the client passes it explicitly.

However, if you look at your program, which works, except for the else, you have:

125% mapping to a resolution of 1100 pixels
150% mapping to a resolution of 1400 pixels
else you want to map to 100%

So when you select 125% zoom, you're assuming that 100% resolution is 880 (1100 / 125%), and
when you select 150% zoom, you're assuming that 100% resolution is 933 (1400 / 150%)

Instead of the else statement you have, why don't you use either 880 or 933 as your 100% scaling, and use the pixel measurement. What I mean is:

            Case Else
                Me.crViewer1.Width = System.Web.UI.WebControls.Unit.Pixel(800)
                Me.crViewer1.Height = System.Web.UI.WebControls.Unit.Pixel(800)

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question