Highlighted
Absent Member.
Absent Member.
2719 views

Cobol Code

Jump to solution

Hi All,

I'm using the system.drawing.font property and i want to print bold and underlined.

Ive found how to do it in VB or C# see:-

http://stackoverflow.com/questions/2186810/how-can-i-use-multiple-combinations-of-font-styles-in-vb-net

So Ive got the following COBOL code:-

invoke e::"Graphics"::"DrawString"(ws-string, type System.Drawing.Font::New("Arial", ls-FontSize, type System.Drawing.FontStyle::Bold) , type System.Drawing.SolidBrush::New(typeSystem.Drawing.Color::FromArgb(ls-Alpha, ls-Red, ls-Green,  ls-Blue)), ls-x, ls-y, ws-cStringFormat)

Can you pls advise how to Cobol code BOLD + UNDERLINED

Thanks in advance

Neil.

0 Likes
2 Solutions

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: Cobol Code

Jump to solution

Hi Neil,

You need to OR the values together so use code such as:-

          set myFont to new System.Drawing.Font("Microsoft Sans Serif"

                                                , 18

                                                , type System.Drawing.FontStyle::Bold

                                                                b-or

                                                  type System.Drawing.FontStyle::Underline)

Regards

David

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Cobol Code

Jump to solution

HI Neil,

That's the bitwise operator. There also an equivalence for and (b-and). See:-

documentation.microfocus.com/.../index.jsp

One trick you can use if that if you can set the property in a Form manually you can look at the MF generated code and copy it.

For example in this case just put a Label or Textbox on a form and in the control properties go to Font. Then change the Font and make it Bold with Underline.

This causes code to be generated in the code behind file form.designer.cbl that will do the font work at runtime when the form gets loaded. You can copy that code and use as a basis for what you want to do at runtime. You might want change and make it readable but it does give you a start point.

Regards

David

View solution in original post

0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

RE: Cobol Code

Jump to solution

Hi Neil,

You need to OR the values together so use code such as:-

          set myFont to new System.Drawing.Font("Microsoft Sans Serif"

                                                , 18

                                                , type System.Drawing.FontStyle::Bold

                                                                b-or

                                                  type System.Drawing.FontStyle::Underline)

Regards

David

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Cobol Code

Jump to solution

Hi David,

Thanks for that it works.

Could I have found or worked that out somehow because I wouldn't have guessed that Or becomes b-or .

Kind regards

Neil.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Cobol Code

Jump to solution

HI Neil,

That's the bitwise operator. There also an equivalence for and (b-and). See:-

documentation.microfocus.com/.../index.jsp

One trick you can use if that if you can set the property in a Form manually you can look at the MF generated code and copy it.

For example in this case just put a Label or Textbox on a form and in the control properties go to Font. Then change the Font and make it Bold with Underline.

This causes code to be generated in the code behind file form.designer.cbl that will do the font work at runtime when the form gets loaded. You can copy that code and use as a basis for what you want to do at runtime. You might want change and make it readable but it does give you a start point.

Regards

David

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Cobol Code

Jump to solution

Ahhhh good tip thanks David

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.