Cadet 2nd Class Cadet 2nd Class
Cadet 2nd Class
1096 views

DataGridView Grid Borders

Hi


I have a DataGridView with 8 columns, all Text Box columns, all Read Only, populated from an indexed file.  The first tow columns are frozen.  I want the right hand border on the second column to appear thicker than the others.  Here is the code I tried to achieve this:

       class-id DataGridViewColFrzCls inherits type System.Windows.Forms.DataGridViewColumn.

       method-id NEW.
       procedure division.
           set self::CellTemplate to new DataGridViewCellFrzCls.
           goback.
       end method.

       end class.



       class-id DataGridViewCellFrzCls inherits type System.Windows.Forms.DataGridViewTextBoxCell.

      *> Automatically inserted Methods from System.Windows.Forms.DataGridViewTextBoxCell

       method-id AdjustCellBorderStyle override.
       procedure division using by value
                                   dataGridViewAdvancedBorderStyle as type System.Windows.Forms.DataGridViewAdvancedBorderStyle
                                   dataGridViewAdvancedBorderSty0 as type System.Windows.Forms.DataGridViewAdvancedBorderStyle
                                   singleVerticalBorderAdded as condition-value
                                   singleHorizontalBorderAdded as condition-value
                                   isFirstDisplayedColumn as condition-value
                                   isFirstDisplayedRow as condition-value
                          returning return-item as type System.Windows.Forms.DataGridViewAdvancedBorderStyle.
                          
           set dataGridViewAdvancedBorderSty0::Top to type DataGridViewAdvancedCellBorderStyle::None.
           set dataGridViewAdvancedBorderSty0::Left to dataGridViewAdvancedBorderStyle::Left.
           set dataGridViewAdvancedBorderSty0::Bottom to dataGridViewAdvancedBorderStyle::Bottom.
           set dataGridViewAdvancedBorderSty0::Right to type DataGridViewAdvancedCellBorderStyle::OutsetDouble.
           
      *    set return-item to super::AdjustCellBorderStyle(dataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderSty0 singleVerticalBorderAdded singleHorizontalBorderAdded isFirstDisplayedColumn isFirstDisplayedRow)
           set return-item to dataGridViewAdvancedBorderSty0
            goback
       end method.
      *> End Methods from System.Windows.Forms.DataGridViewTextBoxCell
      
       end class.

I have set column 2 to be DataGridViewColFrzCls, all the other columns are DataGridViewTextBoxColumn.

The code above only has the effect of making the left hand border, not the right hand border of cells in column 2 thicker.

Can someone tell me what I am doing wrong?  It may have something to do with column 2 being forzen.

Using Visual Cobol 2.1 Visual Studio 2010.

Thank you.

0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

It appears from the MSDN docs that type DataGridViewAdvancedCellBorderStyle::OutsetDouble can only be used for the right border if the dataGridView is set to RightToLeft processing. If I change the RightToLeft property to True then the border does show correctly as double.

If I set the right style to none and RightToLeft is set to false then the border disappears so it is being set.

Look under the Exceptions section of the docs here.

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.