tedmillerx
Programmer
I have a report that contains several text boxes. Some of these text boxes have an image that goes with them. Right now the report is designed so that whenever there is an image, a rectangle appears behind both the text and the image. The length of the text varies, as does the font size, which is determined by a drop down list in a form. Here's the code I'm using. 'PictureBox' is the image, 'txtName' is the textbox.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim PrintForm As String
PrintForm = "Print Out"
If PictureBox.ImageBytes > 0 Then
PictureBox.height = 1000
Me.Detail.height = 1500
Me.Rectangle01.Visible = True
Me.Rectangle01.height = 1750
PictureBox.BorderWidth = 1
Else
PictureBox.height = 10
PictureBox.BorderWidth = 0
Me.Rectangle01.Visible = False
Me.Rectangle01.height = 10
Me.Detail.height = 500
End If
Me.txtName.FontSize = [Forms]![Print Out]![cmbRecipesFontSize]
This worked nicely before I made the font size variable - always had my block of text and image with a rectangle neatly around it. The problem - if a larger font size is selected, the textbox grows, the image (positioned below the textbox) is pushed down and out of the rectangle. I could make the rectangle bigger, but then if a smaller font size is used I wind up with a lot of empty space in the rectangle. So the question is - can I make that rectangle grow with the text box? I've found that I can get the rectangle to match the size of the textbox plus the image, thus:
Me.Rectangle01.height = Me.txtName.height + Me.PictureBox.height
- but this only sets the rectangle to the default textbox size as it is set in properties, and doesn't recognize that the textbox grows and shrinks. So what do I need to tell it to make it understand the can grow/can shrink factor? Any help would be MUCH appreciated. Sorry for the lengthy post.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim PrintForm As String
PrintForm = "Print Out"
If PictureBox.ImageBytes > 0 Then
PictureBox.height = 1000
Me.Detail.height = 1500
Me.Rectangle01.Visible = True
Me.Rectangle01.height = 1750
PictureBox.BorderWidth = 1
Else
PictureBox.height = 10
PictureBox.BorderWidth = 0
Me.Rectangle01.Visible = False
Me.Rectangle01.height = 10
Me.Detail.height = 500
End If
Me.txtName.FontSize = [Forms]![Print Out]![cmbRecipesFontSize]
This worked nicely before I made the font size variable - always had my block of text and image with a rectangle neatly around it. The problem - if a larger font size is selected, the textbox grows, the image (positioned below the textbox) is pushed down and out of the rectangle. I could make the rectangle bigger, but then if a smaller font size is used I wind up with a lot of empty space in the rectangle. So the question is - can I make that rectangle grow with the text box? I've found that I can get the rectangle to match the size of the textbox plus the image, thus:
Me.Rectangle01.height = Me.txtName.height + Me.PictureBox.height
- but this only sets the rectangle to the default textbox size as it is set in properties, and doesn't recognize that the textbox grows and shrinks. So what do I need to tell it to make it understand the can grow/can shrink factor? Any help would be MUCH appreciated. Sorry for the lengthy post.