I have a project I'm doing that I thought was done, but I guess you never should think that way.
This was a project that I took pieces from something existing and changed to suit the users request. Basically, it takes a variety of business benchmarks and shows them graphically (see attached JPG). Initially, this was a program that a user would run when they wanted to manually. I got a request to make this where it runs every morning and users can sign up for up to 24 of these "alerts". They would be shown on a jpg (which I converted from a bmp in my program) which would be attached to an email that the user would get. As I mentioned, it looked to work spiffy and I thought I was done, but instead of running it on my local PC for testing, I put it out for live. As it turns out, there is no graphic to the jpg now. I am thinking that it must have needed an active screen to use for a screen print in the picturebox. It works great when I test locally, but no graphic output when run from a server. It would work fine if I had it run from my PC every morning, but that isn't an option.
I have been searching all over trying to find an alternative to getting the graphic to work, but so far no luck. I have the code shown below where I save the picturebox. Does anyone have any other ideas as to how I could get what I need saved to use in an email? I haven't done much with pictureboxes, so sorry if I don't sound to knowledgeable. Thanks for your time and any help you can offer!!!
Public Sub SaveFormImageToFile(ByRef ContainerForm As Form, _
ByRef PictureBoxControl As PictureBox, _
ByVal ImageFileName As String)
Dim FormInsideWidth As Long
Dim FormInsideHeight As Long
Dim PictureBoxLeft As Long
Dim PictureBoxTop As Long
Dim PictureBoxWidth As Long
Dim PictureBoxHeight As Long
Dim FormAutoRedrawValue As Boolean
With PictureBoxControl
'Set PictureBox properties
.Visible = False
.AutoRedraw = True
.Appearance = 0 ' Flat
.AutoSize = False
.BorderStyle = 0 'No border
'.Name = "Picture2"
'Store PictureBox Original Size and location Values
PictureBoxHeight = .Height: PictureBoxWidth = .Width
PictureBoxLeft = .Left: PictureBoxTop = .Top
'Make PictureBox to size to inside of form.
.Align = vbAlignTop: .Align = vbAlignLeft
DoEvents
FormInsideHeight = .Height: FormInsideWidth = .Width
'Restore PictureBox Original Size and location Values
.Align = vbAlignNone
.Height = FormInsideHeight: .Width = FormInsideWidth
.Left = PictureBoxLeft: .Top = PictureBoxTop
FormAutoRedrawValue = ContainerForm.AutoRedraw
ContainerForm.AutoRedraw = False
DoEvents
'Copy Form Image to Picture Box
' line below was un remd as test
BitBlt .hdc, 0, 0, _
1600, _
1800, _
ContainerForm.hdc, 0, 0, _
vbSrcCopy
'line below was remd. it was original..above was initially remd and not used
' BitBlt .hdc, 0, 0, _
FormInsideWidth / Screen.TwipsPerPixelX, _
FormInsideHeight / Screen.TwipsPerPixelY, _
ContainerForm.hdc, 0, 0, _
vbSrcCopy
DoEvents
SavePicture .Image, ImageFileName
DoEvents
ContainerForm.AutoRedraw = FormAutoRedrawValue
DoEvents
End With
End Sub
Kurt

New Topic/Question
Reply




MultiQuote




|