-
May 28th, 2010, 04:53 AM
#1
Thread Starter
Lively Member
Crystal Reports Dynamic Image
I'm trying to assign a dynamic image to a picture box in CR9. I started a new exe and played around with it before incorporating into my existing program. I was easily able to get it to work. When I imported it to my program i get a permission denied error from the picture1 control. It won't open the file. I do have a default image in the picture box that views fine. When I try to load the dynamic image it gets angry and throws the error.
-
May 28th, 2010, 06:02 AM
#2
Re: Crystal Reports Dynamic Image
What code are you using to load the new picture?
-
May 28th, 2010, 07:15 AM
#3
Thread Starter
Lively Member
Re: Crystal Reports Dynamic Image
Dim myPic As StdPicture
Dim mypath
mypath = Unit1Pic11.Value
Set myPic = LoadPicture("C:\Program Files\Denali" & mypath)
Set Picture1.FormattedPicture = (myPic)
This worked on the exe I set up to test crystal reports.
Once i get it to load again i need the image to stretch to the size of the picture box. I have spent hours searching on how to do it. You would think this would be something that would be thought of in development of CR. Is there a better program then Crystal Reports. I really don't want to use HTML it just doesn't look professional in a program like mine.
-
May 28th, 2010, 09:21 AM
#4
Frenzied Member
Re: Crystal Reports Dynamic Image
Check your load picture function as you might be missing a backslash, unless it is the first character in mypath...
Next up, FormattedPicture is not a method of the VB6.0 PictureBox control. Is this control a CR Control? Or are you using .NET???
Then it is time to look at either an image control, the render method of the stdPicture Object, BitBlt, or StretchBlt.
Good Luck
Option Explicit should not be an Option!
-
May 28th, 2010, 12:36 PM
#5
Re: Crystal Reports Dynamic Image
-
May 28th, 2010, 03:25 PM
#6
Thread Starter
Lively Member
Re: Crystal Reports Dynamic Image
I'm using CR 9.22 Most the commands i see on the net concerning this problem do not show up- in the drop downs for the picture box. FormattedPicture is the only load command listed. stdPicture Object, BitBlt, or StretchBlt do not exist on the drop down as well. if I type these commands in I get an error. Could it be I'm missing a plug-in or something. There is only one option in CR to add a picture and thats the picture box control. I can't add any VB controls because they are all disabled when i have the CR page up. I looking into getting CR 8.5 maybe my VB6 is to old to handle 9.2. Could that be the problem.
-
May 28th, 2010, 07:03 PM
#7
Re: Crystal Reports Dynamic Image
This is a small sample about how to change an image inside CR at running time
Code:
Option Explicit
Dim Report As CRAXDRT.Report
Dim CRapp As New CRAXDRT.Application
Private WithEvents oSection As CRAXDRT.Section
Dim pic1 As OLEObject
Dim i As Integer
Private Sub Form_Load()
'set the report
Set Report = CRapp.OpenReport(App.Path + "\report1.rpt")
'set the section object to the Details section of the report.
Set oSection = Report.Sections("D")
'Loop through the report objects and see if they are pictures
For i = 1 To oSection.ReportObjects.Count
'fully qualified croleobjects as craxdrt.crOleobject.. otherwise you will get the error - object variable not set
' if it is a CrOleObject then
If oSection.ReportObjects(i).Kind = CRAXDRT.crOLEObject Then
'Set the pic1 object to the Ole Report object
Set pic1 = oSection.ReportObjects(i)
End If
Next i
'view the report
CrystalActiveXReportViewer1.ReportSource = Report
CrystalActiveXReportViewer1.ViewReport
End Sub
'section format event:
'this event fires every time this section is generated by the report.
Private Sub oSection_format(ByVal pFormattingInfo As Object)
'load the image. this can be done dynamically if desired.
Set pic1.FormattedPicture = LoadPicture(App.Path + "\test.bmp")
End Sub
Private Sub Form_Resize()
CrystalActiveXReportViewer1.Top = 0
CrystalActiveXReportViewer1.Left = 0
CrystalActiveXReportViewer1.Height = ScaleHeight
CrystalActiveXReportViewer1.Width = ScaleWidth
End Sub
JG
-
May 28th, 2010, 10:33 PM
#8
Thread Starter
Lively Member
Re: Crystal Reports Dynamic Image
Why does it keep telling me "permission denied" ? It was working. I also took out the variable and put in the direct path. It says picture1 is denying permission.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|