Cobol Code

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:-

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


  • Verified Answer

    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


                                                      type System.Drawing.FontStyle::Underline)



  • 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


  • Verified Answer

    HI Neil,

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

    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.