|
Please, I am using crystal report version 13 for Visual Studio 2019 and I followed the steps to create a watermark as follows
I inserted the watermark image in the Page Header and went to Report > Section Expert and highlighted Page Header in list of sections on the left and marked the Underlay Following Sections checkbox and Clicked OK.
I previewed the report but did not see any watermark. Please what could be the problem?
I have tried so many means to get this done but to no avail. The wartermark refuses to show up. Please I need your help. Thanks.
|
|
|
|
|
Benniit wrote: Please what could be the problem? Crystal Reports.
Simple solution; print it beforehand. I assume that a background picture didn't work?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
It's been 15 years since I did anything with VBA (in Excel) and I've been asked to document for non-technical users what an Excel Macro is doing. I can do that but it's going to be very time consuming not only b/c it's been so long since I messed with VBA but because the macro consists of many functions so a lot of jumping around and the author opted to not use parenthesis so when looking at the code you don't know if the thing on the right side of = is a variable or a function.
Since ChatGPT is being promoted as being able to do just about everything I figured it should be able to do this yes? If anyone does know do you know what the proper request would be? What I would ask it to do and how it would get the VBA code to document it?
Thanks
|
|
|
|
|
Perhaps ask in the lounge?
Not that I mind but I think that question is more about ChatGPT rather than VB.
And more likely to get a response there.
|
|
|
|
|
Can an existing post be moved to another forum or do you have to just delete and re-create?
|
|
|
|
|
You really need to ask ChatGPT.
Also, I think you will find that most people here have a fairly low opinion of ChatGPT's abilities.
|
|
|
|
|
Considering I've not touched VBA in 15-20 year sand I didn't write the macro so I don't have any idea what it's supposed to do, yes. It's not that I couldn't do it but that it's a huge time suck that if I could pass off onto Chat GPT to do it I'm more than happy to.
|
|
|
|
|
YSLGuru wrote: I've not touched VBA in 15-20 year Interesting, about the same as me.
|
|
|
|
|
Than I'm sure you can appreciate why one if they could avoid it would ass off documenting someone else's Excel Macro. It's one thing when it's your code but another when it's someone you don't even know; aren't familiar with how they code. And to top it off there is of course ZERO notes/documentation in the macro. I know that even a year from now I'm not always going to remember everything important about some code I created so I document it extensively going so far as to also include my thinking of why I choose to do something the way I did and that has saved my butt more than once. This wasn't ion VBA but some SQL code where my boss had me change some logic and a year later it was an issue and he wanted to know why it had been changed and because I documented that in the script I was able to say "because you told me on XX date to change it".
|
|
|
|
|
UPDATE:
I found where someone else had used ChatGPT to document an Excel macro so I used the same question (with code pasted after) as they did and it worked. I still have to doublecheck it but according to the person who used it before me the thing correctly detailed every macro. That said I'm guessing the better the quality of the code the more likely ChatGPT will correctly document it.
|
|
|
|
|
me.datagridview_1.rows.add("ColumnName",stringvalue)
or
me.datagridview_1.rows.add(string1, string2,string3)
The above does not add an additional line
If I load a form and populate the obj the above is fine
I need to add an extra line(s) manually, say either with textbox controls or other vars
|
|
|
|
|
|
1st attempt at creating a control. i have a class, that Inherits PictureBox
here are some custom properties
<Category("Boarder"), Description("Border Size")>
Public Property BorderSize As Integer
Get
Return borderSizeField
End Get
Set(ByVal value As Integer)
borderSizeField = value
Invalidate()
End Set
End Property
<Category("Boarder"), Description("Border Color")>
Public Property BorderColor As Color
Get
Return borderColorField
End Get
Set(ByVal value As Color)
borderColorField = value
Invalidate()
End Set
End Property
<Category("Boarder"), Description("Border Color2")>
Public Property BorderColor2 As Color
Get
Return borderColor2Field
End Get
Set(ByVal value As Color)
borderColor2Field = value
Invalidate()
End Set
End Property
If i select "Categorized" in the property grid of the control when i place it on the form, my properties are grouped together.
However, when i select "Alphabetized" they are not grouped.
Question: How can i have them grouped when "Alphabetized" is selected. Just like the Location property is on the picturebox control
|
|
|
|
|
You have only this 2 choices - "Categorized" and "in alphabetical order".
When you chose "Alphabetical" then all the Properties (as you allready mentioned) are sorted by their name.
A combination of both is not designated ...
|
|
|
|
|
if you like to have it like the (for example) Location-Property then you have to create a seperate class which has all your custom Properties in it and this class will be one Property of your Control.
Here is an example for you ... I hope you will not have circumstances with my german descriptions ...
<Category("Anzeige"), Description("Definition des Einheiten-Textes")>
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
ReadOnly Property Einheit As SpalteEinheitDefinition
Get
Return my_Unit
End Get
End Property
WithEvents my_Unit As New SpalteEinheitDefinition With {.Text = "mm"}
Private Sub Einheit_Changed() Handles my_Unit.Changed
ResizeElements()
'Me.Invalidate()
End Sub
<TypeConverter(GetType(ExpandableObjectConverter))>
Public Class SpalteEinheitDefinition
<Description("auszugebender Text")>
<Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design", GetType(System.Drawing.Design.UITypeEditor))>
Property Text As String
Get
Return my_Text
End Get
Set(ByVal value As String)
my_Text = value
OnValueChanged()
End Set
End Property
Private my_Text As String = ""
<Description("Bestimmt die Ausrichtung des Textes im Control")>
<DefaultValue(GetType(HorizontalAlignment), "Center")>
Property TextAlign As HorizontalAlignment
Get
Return my_TextAlign
End Get
Set(ByVal value As HorizontalAlignment)
If my_TextAlign <> value Then
my_TextAlign = value
OnValueChanged()
End If
End Set
End Property
Private my_TextAlign As HorizontalAlignment = HorizontalAlignment.Center
<Description("gibt die Seiten-Abstände im Inneren des Controls an")>
<DefaultValue(GetType(Padding), "2,0,2,0")>
Property Padding As Padding
Get
Return my_Padding
End Get
Set(ByVal value As Padding)
my_Padding = value
OnValueChanged()
End Set
End Property
Private my_Padding As New Padding(2, 0, 2, 0)
Private Sub OnValueChanged()
RaiseEvent Changed()
End Sub
Public Event Changed()
'Sub New()
'OnValueChanged()
'End Sub
Overrides Function toString() As String
Return "<" & Text & ">"
End Function
End Class
modified 1-Apr-23 6:23am.
|
|
|
|
|
Appreciate the sample.
Am almost there! now have everything under my category, now only issue is the following code.
FYI, i inherit a PictureBox on 1st class. then i have the category items on a 2nd class.
my problem is with the "OnPaint" event
Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
MyBase.OnPaint(pe)
Dim graph = pe.Graphics
Dim rectContourSmooth = Rectangle.Inflate(ClientRectangle, -1, -1)
Dim rectBorder = Rectangle.Inflate(rectContourSmooth, -m_borderSizeField, -m_borderSizeField)
Dim smoothSize = If(m_borderSizeField > 0, m_borderSizeField * 3, 1)
Dim newText = m_captiontext
Using borderGColor = New LinearGradientBrush(rectBorder, m_borderColorField, m_borderColor2Field, m_gradientAngleField)
Using pathRegion = New GraphicsPath()
Using penSmooth = New Pen(Parent.BackColor, smoothSize)
Using penBorder = New Pen(borderGColor, m_borderSizeField)
graph.SmoothingMode = SmoothingMode.AntiAlias
penBorder.DashStyle = m_borderLineStyleField
penBorder.DashCap = m_borderCapStyleField
pathRegion.AddEllipse(rectContourSmooth)
Region = New Region(pathRegion)
graph.DrawString(m_captiontext, New Font("Segoe UI", 12, FontStyle.Regular), New SolidBrush(Color.Black), m_captionx.X, m_captionx.Y, StringFormat.GenericDefault)
graph.DrawEllipse(penSmooth, rectContourSmooth)
If m_borderSizeField > 0 Then graph.DrawEllipse(penBorder, rectBorder)
End Using
End Using
End Using
End Using
End Sub the values with "m_" (these are in the 2nd class) give the following error message in the class view. I have the OnPaint in the 1st class.
(field) NewPictureBox.m_borderSizeField As TextLocation
Operator is not defined for type
i am at a loss. are you able to point me in direction so i have the "OnPaint" event in correct class??
Appreciate your help!
|
|
|
|
|
if I understand you right your new Property is working as you want ?
If Yes - please show me the code belonging to this Property AND the definition of the Class-Variable and the M_*-Variables.
I suppose that you are not using this Variable in the right way inside the OnPaint-Event ...
|
|
|
|
|
Appreciate your help
here is complete class i am using.
again, my 1st attempt, picking up knowledge from this group!
Imports System.ComponentModel
Imports System.Drawing.Drawing2D
Public Class NewPictureBox
Inherits PictureBox
Public Sub New()
Size = New Size(100, 100)
SizeMode = PictureBoxSizeMode.Zoom
Me.m_properties = New TextLocation(Me)
Me.m_captiontext = New TextLocation(Me)
Me.m_captionx = New TextLocation(Me)
Me.m_captiony = New TextLocation(Me)
Me.m_borderSizeField = New TextLocation(Me)
Me.m_borderColorField = New TextLocation(Me)
Me.m_borderColor2Field = New TextLocation(Me)
Me.m_borderLineStyleField = New TextLocation(Me)
Me.m_borderCapStyleField = New TextLocation(Me)
Me.m_gradientAngleField = New TextLocation(Me)
End Sub
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public ReadOnly Property Properties() As TextLocation
Get
Return Me.m_properties
End Get
End Property
Friend Sub NotifyStateChanged(source As TextLocation, propertyName As String)
Me.Invalidate()
Debug.WriteLine("UIListBox: State changed.")
End Sub
Protected Overrides Sub OnResize(ByVal e As EventArgs)
MyBase.OnResize(e)
Size = New Size(Width, Width)
End Sub
Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
MyBase.OnPaint(pe)
Dim graph = pe.Graphics
Dim rectContourSmooth = Rectangle.Inflate(ClientRectangle, -1, -1)
Dim rectBorder = Rectangle.Inflate(rectContourSmooth, -m_borderSizeField, -m_borderSizeField)
Dim smoothSize = If(m_borderSizeField > 0, m_borderSizeField * 3, 1)
Dim newText = m_captiontext
Using borderGColor = New LinearGradientBrush(rectBorder, m_borderColorField, m_borderColor2Field, m_gradientAngleField)
Using pathRegion = New GraphicsPath()
Using penSmooth = New Pen(Parent.BackColor, smoothSize)
Using penBorder = New Pen(borderGColor, m_borderSizeField)
graph.SmoothingMode = SmoothingMode.AntiAlias
penBorder.DashStyle = m_borderLineStyleField
penBorder.DashCap = m_borderCapStyleField
pathRegion.AddEllipse(rectContourSmooth)
Region = New Region(pathRegion)
graph.DrawString(m_captiontext, New Font("Segoe UI", 12, FontStyle.Regular), New SolidBrush(Color.Black), m_captionx.X, m_captionx.Y, StringFormat.GenericDefault)
graph.DrawEllipse(penSmooth, rectContourSmooth)
If m_borderSizeField > 0 Then graph.DrawEllipse(penBorder, rectBorder)
End Using
End Using
End Using
End Using
End Sub
Private m_properties As TextLocation
Private m_captiontext As TextLocation
Private m_captionx As TextLocation
Private m_captiony As TextLocation
Private m_borderSizeField As TextLocation
Private m_borderColorField As TextLocation
Private m_borderColor2Field As TextLocation
Private m_borderLineStyleField As TextLocation
Private m_borderCapStyleField As TextLocation
Private m_gradientAngleField As TextLocation
End Class
<ToolboxItem(False)>
Public Class TextLocation
Inherits Component
Private m_captiontext As String = "label"
Private m_captionx As New Point(50.0F, 10.0F)
Private m_borderSizeField As Integer = 2
Private m_borderColorField As Color = Color.Blue
Private m_borderColor2Field As Color = Color.RoyalBlue
Private m_borderLineStyleField As DashStyle = DashStyle.Solid
Private m_borderCapStyleField As DashCap = DashCap.Flat
Private m_gradientAngleField As Single = 50.0F
Public Sub New(picturebox As NewPictureBox)
Me.m_borderSizeField = m_borderSizeField
Me.m_borderColorField = m_borderColorField
Me.m_borderColor2Field = m_borderColor2Field
Me.m_borderLineStyleField = m_borderLineStyleField
Me.m_borderCapStyleField = m_borderCapStyleField
End Sub
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public Property Caption As String
Get
Return m_captiontext
End Get
Set(ByVal Value As String)
m_captiontext = Value
End Set
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Property CaptionLocation As Point
Get
Return m_captionx
End Get
Set(ByVal Value As Point)
m_captionx = Value
End Set
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public Property BorderSize As Integer
Get
Return m_borderSizeField
End Get
Set(ByVal value As Integer)
m_borderSizeField = value
End Set
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public Property BorderColor As Color
Get
Return m_borderColorField
End Get
Set(ByVal value As Color)
m_borderColorField = value
End Set
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public Property BorderColor2 As Color
Get
Return m_borderColor2Field
End Get
Set(ByVal value As Color)
m_borderColor2Field = value
End Set
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public Property BorderLineStyle As DashStyle
Get
Return m_borderLineStyleField
End Get
Set(ByVal value As DashStyle)
m_borderLineStyleField = value
End Set
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public Property BorderCapStyle As DashCap
Get
Return m_borderCapStyleField
End Get
Set(ByVal value As DashCap)
m_borderCapStyleField = value
End Set
End Property
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public Property GradientAngle As Single
Get
Return m_gradientAngleField
End Get
Set(ByVal value As Single)
m_gradientAngleField = value
End Set
End Property
End Class Thanks again!
|
|
|
|
|
I will take a look on it and come back later to this Discussion ...
In fact it is very good to have the complete Control - so I could test what is going wrong ...
|
|
|
|
|
OK ... changes made ...
I have deleted all unnecessary content and added all needed content to make it work - you should carefully take a look on it ...!!!
Also the Designer now will store all the changes at the properties inside the class. Perhaps, for later use, you should find a better name for it ...
Imports System.ComponentModel
Imports System.Drawing.Drawing2D
Public Class NewPictureBox
Inherits PictureBox
Public Sub New()
Size = New Size(100, 100)
SizeMode = PictureBoxSizeMode.Zoom
End Sub
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
Public ReadOnly Property Properties() As TextLocation
Get
Return Me.m_properties
End Get
End Property
Private WithEvents m_properties As New TextLocation
Private Sub Properties_Changed() Handles m_properties.Changed
Me.Invalidate()
End Sub
Friend Sub NotifyStateChanged(source As TextLocation, propertyName As String)
Me.Invalidate()
Debug.WriteLine("UIListBox: State changed.")
End Sub
Protected Overrides Sub OnResize(ByVal e As EventArgs)
MyBase.OnResize(e)
Size = New Size(Width, Width)
End Sub
Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
MyBase.OnPaint(pe)
Dim graph = pe.Graphics
Dim rectContourSmooth = Rectangle.Inflate(ClientRectangle, -1, -1)
Dim rectBorder = Rectangle.Inflate(rectContourSmooth, -m_properties.BorderSize, -m_properties.BorderSize)
Dim smoothSize = If(m_properties.BorderSize > 0, m_properties.BorderSize * 3, 1)
Dim newText = m_properties.Caption
Using borderGColor = New LinearGradientBrush(rectBorder, m_properties.BorderColor, m_properties.BorderColor2, m_properties.GradientAngle)
Using pathRegion = New GraphicsPath()
Using penSmooth = New Pen(Parent.BackColor, smoothSize)
Using penBorder = New Pen(borderGColor, m_properties.BorderSize)
graph.SmoothingMode = SmoothingMode.AntiAlias
penBorder.DashStyle = m_properties.BorderLineStyle
penBorder.DashCap = m_properties.BorderCapStyle
pathRegion.AddEllipse(rectContourSmooth)
Region = New Region(pathRegion)
graph.DrawString(m_properties.Caption, New Font("Segoe UI", 12, FontStyle.Regular), New SolidBrush(Color.Black), m_properties.CaptionLocation.X, m_properties.CaptionLocation.Y, StringFormat.GenericDefault)
graph.DrawEllipse(penSmooth, rectContourSmooth)
If m_properties.BorderSize > 0 Then graph.DrawEllipse(penBorder, rectBorder)
End Using
End Using
End Using
End Using
End Sub
End Class
<TypeConverter(GetType(ExpandableObjectConverter))>
Public Class TextLocation
Public Property Caption As String
Get
Return m_captiontext
End Get
Set(ByVal Value As String)
m_captiontext = Value
OnValueChanged()
End Set
End Property
Private m_captiontext As String = "label"
Overrides Function toString() As String
Return "<" & m_captiontext & ">"
End Function
Property CaptionLocation As Point
Get
Return m_captionx
End Get
Set(ByVal Value As Point)
m_captionx = Value
OnValueChanged()
End Set
End Property
Private m_captionx As New Point(50.0F, 10.0F)
Public Property BorderSize As Integer
Get
Return m_borderSizeField
End Get
Set(ByVal value As Integer)
m_borderSizeField = value
OnValueChanged()
End Set
End Property
Private m_borderSizeField As Integer = 2
Public Property BorderColor As Color
Get
Return m_borderColorField
End Get
Set(ByVal value As Color)
m_borderColorField = value
OnValueChanged()
End Set
End Property
Private m_borderColorField As Color = Color.Blue
Public Property BorderColor2 As Color
Get
Return m_borderColor2Field
End Get
Set(ByVal value As Color)
m_borderColor2Field = value
OnValueChanged()
End Set
End Property
Private m_borderColor2Field As Color = Color.RoyalBlue
Public Property BorderLineStyle As DashStyle
Get
Return m_borderLineStyleField
End Get
Set(ByVal value As DashStyle)
m_borderLineStyleField = value
OnValueChanged()
End Set
End Property
Private m_borderLineStyleField As DashStyle = DashStyle.Solid
Public Property BorderCapStyle As DashCap
Get
Return m_borderCapStyleField
End Get
Set(ByVal value As DashCap)
m_borderCapStyleField = value
OnValueChanged()
End Set
End Property
Private m_borderCapStyleField As DashCap = DashCap.Flat
Public Property GradientAngle As Single
Get
Return m_gradientAngleField
End Get
Set(ByVal value As Single)
m_gradientAngleField = value
OnValueChanged()
End Set
End Property
Private m_gradientAngleField As Single = 50.0F
Private Sub OnValueChanged()
RaiseEvent Changed()
End Sub
Public Event Changed()
Overrides Function toString() As String
Return "<" & "..." & ">"
End Function
End Class
|
|
|
|
|
Wow!
Just seen the email, 1st coffee and this is a great surprise. Very kind of you to fix my issues. I really appreciate your time.
Only thing I found was the following, Visual Studio complained about multiple definitions with identical signatures.
Overrides Function toString() As String
Return "<" & m_captiontext & ">"
End Function so I did this, and it works fantastic.
'Public Overrides Function toString() As String
'Return "<" & "..." & ">"
'End Function
|
|
|
|
|
I'm sorry - but very good if you fixed it by yourself.
It would be glad, when it is working for you, when you rate (upvote) my Solution.
|
|
|
|
|
Another Suggestion for your custom class / Properties - take a look at the Defaultvalue-Attribute :
<DefaultValue("label")>
Public Property Caption As String
Get
Return m_captiontext
End Get
Set(ByVal Value As String)
m_captiontext = Value
OnValueChanged()
End Set
End Property
Private m_captiontext As String = "label"
|
|
|
|
|
Been searching on this subject, as this is still new to me, and I came across those Attributes. This is what I have started to work on.
<DisplayName("Caption"),
DescriptionAttribute("Enter Caption for image"),
ParenthesizePropertyName(False),
XmlElementAttribute("Caption"),
NotifyParentProperty(True),
DefaultValue("label"),
EditorBrowsable(EditorBrowsableState.Always),
RefreshProperties(RefreshProperties.All)> Still looking into this, but it looks nice in the Property Page, to see these appear! Liking where this is going. Again, your help, time and knowledge very much appreciated.
|
|
|
|
|
Since Control-Development is/was one of my favourites I could give a lot of additional tipps - so if you want feel free to ask for ...
Generally what is possible to do :
- delete unused Properties
- switch dependend Properties visible / unvisible
- create Smart-Tags to a Control
- make a Control usable in Designmode
and so on ...
|
|
|
|
|