Click here to Skip to main content
15,891,704 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Advice on where to start Pin
cRaCKh0rN8-Nov-05 5:47
cRaCKh0rN8-Nov-05 5:47 
GeneralRe: Advice on where to start Pin
Bob Stanneveld8-Nov-05 5:54
Bob Stanneveld8-Nov-05 5:54 
GeneralRe: Advice on where to start Pin
Chris Losinger8-Nov-05 5:59
professionalChris Losinger8-Nov-05 5:59 
GeneralRe: Advice on where to start Pin
cRaCKh0rN8-Nov-05 10:08
cRaCKh0rN8-Nov-05 10:08 
AnswerRe: Advice on where to start Pin
LighthouseJ8-Nov-05 19:43
LighthouseJ8-Nov-05 19:43 
QuestionBeginner Programmer, Got some ideas for me? Pin
Monkey De Lufy: Pirate King8-Nov-05 4:47
Monkey De Lufy: Pirate King8-Nov-05 4:47 
AnswerRe: Beginner Programmer, Got some ideas for me? Pin
David Crow8-Nov-05 4:50
David Crow8-Nov-05 4:50 
QuestionDataGrid Pin
rsw18-Nov-05 4:38
rsw18-Nov-05 4:38 
Hello All,

I am using visual studio .net 2003 c++.
I am trying to get my datagrid to auto resize its columns automatically
using the following code from:
www.hanselman.com/blog/PermaLink.aspx?guid=f3e94fab-335d-497f-8340-9c4ae8e02fa3"
This is his take on the subject and how to do it:
If you double click on the little splitter between columns they will autosize. Therefore, the code to autosize has been written for me; no need to measure strings, etc. How do I force a double click? No, wait, wrongheadedness, how do I call whatever THEY call when a double click happens? So, I reflectored into DataGrid.OnMouseDown and saw their custom HitTest calls a private ColAutoResize.

private void dgLogging_DataSourceChanged(object sender, System.EventArgs e)
{
try
{
Type t = dgLogging.GetType();
MethodInfo m = t.GetMethod("ColAutoResize",BindingFlags.NonPublic);
for (int i = dgLogging.FirstVisibleColumn; (i <
dgLogging.VisibleColumnCount); i++)
{
m.Invoke(dgLogging, new object[]{i});
}
}
catch (Exception ex)
{
System.Diagnostics.Trace.Write("Failed Resizing Columns: " + ex.ToString());
}
}
To tell you the truth I have been away from programming for over a year and I was using viusual c++ 6 at that time so .net is new to me and sure don't understand reflection that well. As to the statement above "So, I reflectored into DataGrid.OnMouseDown and saw their custom HitTest calls a private ColAutoResize."
I don't understand how I can find this method. What I have done is entered this code in order to see all the methods in my datagrid and can find nothing on ColAutoResize.

Type* typ = this->dataGrid1->GetType();
MethodInfo* mi[] = typ->GetMethods();
int MethodCount = mi->Count;
for (int i = 0; i < MethodCount; i++)
{
listBox1->Items->Add(mi[i]->Name);
}
By the above statement,"So, I reflectored into DataGrid.OnMouseDown and saw their custom HitTest calls a private ColAutoResize."
Can someone tell me if I'm looking in the right place for this method or how
I can reflector into DataGrid.OnMouseDown.
Thank You.





RSW
QuestionCRC-16 Convert to vb.Net Pin
RichardBerry8-Nov-05 4:33
RichardBerry8-Nov-05 4:33 
Questionshowing a bitmap on a CStatic in a toolbar Pin
Mircea Grelus8-Nov-05 4:33
Mircea Grelus8-Nov-05 4:33 
Questionvirtual detstruct question when multi derived Pin
followait8-Nov-05 4:23
followait8-Nov-05 4:23 
AnswerRe: virtual detstruct question when multi derived Pin
toxcct8-Nov-05 4:34
toxcct8-Nov-05 4:34 
QuestionRe: virtual detstruct question when multi derived Pin
Bob Stanneveld8-Nov-05 5:51
Bob Stanneveld8-Nov-05 5:51 
AnswerRe: virtual detstruct question when multi derived Pin
Maximilien8-Nov-05 6:40
Maximilien8-Nov-05 6:40 
GeneralRe: virtual detstruct question when multi derived Pin
Bob Stanneveld8-Nov-05 21:57
Bob Stanneveld8-Nov-05 21:57 
AnswerRe: virtual detstruct question when multi derived Pin
toxcct8-Nov-05 6:58
toxcct8-Nov-05 6:58 
GeneralRe: virtual detstruct question when multi derived Pin
Bob Stanneveld8-Nov-05 21:53
Bob Stanneveld8-Nov-05 21:53 
AnswerRe: virtual detstruct question when multi derived Pin
followait8-Nov-05 15:03
followait8-Nov-05 15:03 
GeneralRe: virtual detstruct question when multi derived Pin
Bob Stanneveld8-Nov-05 21:52
Bob Stanneveld8-Nov-05 21:52 
GeneralRe: virtual detstruct question when multi derived Pin
Blake Miller9-Nov-05 5:43
Blake Miller9-Nov-05 5:43 
QuestionCRC-16 Convert to vb.Net Pin
RichardBerry8-Nov-05 3:55
RichardBerry8-Nov-05 3:55 
Questionclicking the titlebar Pin
bonosa8-Nov-05 3:54
bonosa8-Nov-05 3:54 
AnswerRe: clicking the titlebar Pin
Rage8-Nov-05 4:03
professionalRage8-Nov-05 4:03 
QuestionSetWindowText Problem in Release Version Pin
LittleYellowBird8-Nov-05 3:38
LittleYellowBird8-Nov-05 3:38 
AnswerRe: SetWindowText Problem in Release Version Pin
toxcct8-Nov-05 3:57
toxcct8-Nov-05 3:57 

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.