?
Solved

How to change border line color.

Posted on 2011-10-01
11
Medium Priority
?
923 Views
Last Modified: 2012-06-27
Hi, by further referring to ID: 27375157. What i looking forward are shown in screencast below. I trying to create in datagridview.
      
TITO2009-508594.flv
0
Comment
  • 6
  • 4
11 Comments
 
LVL 7

Expert Comment

by:Bill Nolan
ID: 36898562
?
0
 

Author Comment

by:Ramanathan Tito Titan Nadar
ID: 36898602
Hi, Currently by default the border of datagirdview is white. I wanted the selected cell i wants the border to be different color.
0
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 36900199
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Ramanathan Tito Titan Nadar
ID: 36900959
Hi, I did browse the site but to change the border line color, I did get it how? please do assist.
0
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 36901050
I am at a remote site that only has visual studio 2005 so unfortunately I can't write my own example for you at this time. But  here are some examples. If you try it and get stuck, just ask a specific question about the part you are stuck on and I'll try to help you.

Are you using C#? Here is an example of deriving a CustomDataGridView from the DataGridView.  Then in your CustomDataGridView you override the DataGridViewAdvancedBorderStyle which allows you to customize the cells borders.  Then when you instantiate your CustomDataGridView you are able to control the borders.

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewadvancedborderstyle(v=vs.90).aspx

0
 

Author Comment

by:Ramanathan Tito Titan Nadar
ID: 36902780
Hi, I didn't see any option for increase the border thickness and colors to the border cells. Please do advice.
public class DataGridViewCustomCell : DataGridViewTextBoxCell
    {
        public override DataGridViewAdvancedBorderStyle AdjustCellBorderStyle(
            DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
            DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceHolder,
            bool singleVerticalBorderAdded,
            bool singleHorizontalBorderAdded,
            bool firstVisibleColumn,
            bool firstVisibleRow)
        {
            // Customize the top border of cells in the first row and the 
            // right border of cells in the first column. Use the input style 
            // for all other borders.
            dataGridViewAdvancedBorderStylePlaceHolder.Left = firstVisibleColumn ?
                DataGridViewAdvancedCellBorderStyle.OutsetDouble :
                DataGridViewAdvancedCellBorderStyle.None  ;
                
                
            dataGridViewAdvancedBorderStylePlaceHolder.Top = firstVisibleRow ?
                DataGridViewAdvancedCellBorderStyle.OutsetDouble :
                DataGridViewAdvancedCellBorderStyle.None  ;

            dataGridViewAdvancedBorderStylePlaceHolder.Right =
                dataGridViewAdvancedBorderStyleInput.Right;
            dataGridViewAdvancedBorderStylePlaceHolder.Bottom =
                dataGridViewAdvancedBorderStyleInput.Bottom;
           
            
            return dataGridViewAdvancedBorderStylePlaceHolder;
        }
    }

Open in new window

0
 
LVL 11

Accepted Solution

by:
MajorBigDeal earned 1500 total points
ID: 36903895
After further research I think you might be right.  I was looking at  DataGridViewAdvancedBorderStyle not DataGridViewAdvancedCellBorderStyle and I am not in a position to try it myself.  This might not be doable without developing a custom control and painting it yourself, which is a lot of work.  But I'm not really sure.
0
 

Author Comment

by:Ramanathan Tito Titan Nadar
ID: 36907103
I will keep on try with custom control and painting. If you come cross any link related to this please do post. Cheers
0
 

Author Comment

by:Ramanathan Tito Titan Nadar
ID: 36908553
Hi, I did work around and managed. But not so sure about it.

My cell ( row height & column width are 62 )
DG1.DefaultCellStyle.SelectionBackColor = Color.GreenYellow  ;

Then on the Edit column in my DG1, i did Columntype =  Datagridviewimagecolumn
I did inset a white image image (57X57)

Sorry about the screen shot, actually it works accordingly
TITO2009-509091.flv
0
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 36911284
Very cool - glad you got it working!
0
 

Author Closing Comment

by:Ramanathan Tito Titan Nadar
ID: 36916572
Thanks for giving the starting points
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question