Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Visual Cobol: Gradient Coloring a Tabpage

$
0
0

I have attached an example Visual COBOL solution that demonstrates this.

The following is the COBOL equivalent to the VB code that you posted:

     $set ilusing"System.Drawing"
     $set ilusing"System.Drawing.Drawing2D"
      class-id testgradientcolor.Form1 is partial
                inherits type System.Windows.Forms.Form.
      working-storage section.
      01 a binary-long.
      method-id NEW.
      procedure division.
          invoke self::InitializeComponent
          goback.
      end method.
      method-id Form1_Paint final private.
      01 formGraphics type Graphics.
      01 GD type System.Drawing.Drawing2D.LinearGradientBrush.
      procedure division using by value sender as object e as type System.Windows.Forms.PaintEventArgs.
         set formGraphics to e::Graphics
         if a = 1
           set GD to New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(self::Width, self::Height),
              type Color::White, type Color::FromArgb(0, 0, 222))
         else
            if a = 2
               set GD to New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(self::Width, 0),
                  type Color::White, type Color::FromArgb(0, 222, 0))
            else
               if a = 3
                  set GD to New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(0, self::Height),
                     type Color::White, type Color::FromArgb(222, 0, 0))
               else
                  set GD to New System.Drawing.Drawing2D.LinearGradientBrush(New Point(0, 0), New Point(0, self::Height),
                     type Color::White, type Color::FromArgb(0, 0, 0))
                  set a to 1
               end-if
            end-if
         end-if
         invoke formGraphics::FillRectangle(GD, self::ClientRectangle)
         invoke GD::Dispose
         exit method.
      end method.
      method-id button1_Click final private.
      procedure division using by value sender as object e as type System.EventArgs.
          set a to a + 1
          invoke self::Refresh
          exit method.
      end method.
      method-id Form1_Load final private.
      procedure division using by value sender as object e as type System.EventArgs.
         invoke self::SetStyle(type ControlStyles::AllPaintingInWmPaint B-Or type ControlStyles::DoubleBuffer
            B-Or type ControlStyles::ResizeRedraw B-Or type ControlStyles::UserPaint, True)
         exit method.
      end method.
      end class.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>