Click here to Skip to main content
15,915,702 members
Home / Discussions / C#
   

C#

 
GeneralRe: icon Pin
Expert Coming14-Feb-06 17:40
Expert Coming14-Feb-06 17:40 
GeneralRe: icon Pin
Andy Moore15-Feb-06 3:02
Andy Moore15-Feb-06 3:02 
GeneralRe: icon Pin
mostafa_h15-Feb-06 9:37
mostafa_h15-Feb-06 9:37 
QuestionPDF Pin
tabrez_0114-Feb-06 10:41
tabrez_0114-Feb-06 10:41 
QuestionArranging Toolbar window items in IE to a single row .. Pin
sreejnarayan14-Feb-06 10:37
sreejnarayan14-Feb-06 10:37 
QuestionUsing Remoting For Whole Application Pin
mk2014-Feb-06 10:00
mk2014-Feb-06 10:00 
AnswerRe: Using Remoting For Whole Application Pin
malharone14-Feb-06 10:24
malharone14-Feb-06 10:24 
QuestionOverriding DataGridViewColumnHeaderCell Pin
Wjousts14-Feb-06 9:48
Wjousts14-Feb-06 9:48 
I wanted to try and create a new DataGridViewColumnHeaderCell class that would allow me the option of having the column headers displayed vertically instead or horizontally. So I created a new class that inherits from DataGridViewColumnHeaderCell and overrode the Paint and GetPreferredSize methods. This seems to work okay so long as all my columns are visible from the start (except I can't see the result at design time, which is annoying). The problem is when I start with a column that is not visible and then make it visible later so weird things happen. The columns are set to autofit their contents but the width and height aren't getting set correctly. Here's my override for GetPreferredSize

protected override Size GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize)
{
    if (!verticalText)
    {
        return base.GetPreferredSize(graphics, cellStyle, rowIndex, constraintSize);
    }
    else
    {
        StringFormat sf = new StringFormat(StringFormatFlags.DirectionVertical);
        SizeF size = graphics.MeasureString((string)this.FormattedValue, this.DataGridView.Font, constraintSize, sf);
        return new Size((int)size.Width, (int)size.Height);
    }
}


Is there something I'm missing here? Is there something else I need to override? Has anybody else tried something similar?
I would at least like the width to be set correctly as I can just manually set the height of the header row to something sufficient.

Thanks
QuestionQuestion on reflection Pin
malharone14-Feb-06 9:06
malharone14-Feb-06 9:06 
AnswerRe: Question on reflection Pin
leppie14-Feb-06 10:01
leppie14-Feb-06 10:01 
GeneralRe: Question on reflection Pin
malharone14-Feb-06 10:40
malharone14-Feb-06 10:40 
QuestionHow to Marshal a Native Struct Pin
Richard Andrew x6414-Feb-06 8:16
professionalRichard Andrew x6414-Feb-06 8:16 
AnswerRe: How to Marshal a Native Struct Pin
Richard Andrew x6414-Feb-06 8:27
professionalRichard Andrew x6414-Feb-06 8:27 
GeneralRe: How to Marshal a Native Struct Pin
leppie14-Feb-06 10:04
leppie14-Feb-06 10:04 
QuestionExecuting Another Windows Process Pin
MarkMokris14-Feb-06 7:51
MarkMokris14-Feb-06 7:51 
AnswerRe: Executing Another Windows Process Pin
kasik14-Feb-06 8:14
kasik14-Feb-06 8:14 
Questionbest way to read string Pin
cppdotnet14-Feb-06 7:43
cppdotnet14-Feb-06 7:43 
AnswerRe: best way to read string Pin
Joshua Quick14-Feb-06 8:56
Joshua Quick14-Feb-06 8:56 
AnswerRe: best way to read string Pin
cppdotnet14-Feb-06 10:32
cppdotnet14-Feb-06 10:32 
Questionchange global project dbConnectionString during runtime Pin
cpramhofer14-Feb-06 7:23
cpramhofer14-Feb-06 7:23 
AnswerRe: change global project dbConnectionString during runtime Pin
CWIZO14-Feb-06 21:04
CWIZO14-Feb-06 21:04 
QuestionHow to Place a MDI Child on Parent form panel controll Pin
GetFree123GetFree14-Feb-06 6:09
GetFree123GetFree14-Feb-06 6:09 
Questiondword values in .reg files Pin
Lara Pate14-Feb-06 6:08
Lara Pate14-Feb-06 6:08 
AnswerRe: dword values in .reg files Pin
Andy Moore14-Feb-06 6:23
Andy Moore14-Feb-06 6:23 
GeneralRe: dword values in .reg files Pin
Lara Pate14-Feb-06 6:53
Lara Pate14-Feb-06 6:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.