I would like to know what is the correct name of the printpreviewdialog's toolstrip to get it through reflection. I want to know the correct name to use from windows xp, vista and seven. I do no know if its name is Windows version dependant. Currently I am doing (I am referring to it as toolStrip1):
Type type = typeof(this);
FieldInfo toolStripBar = type.GetField("toolStrip1", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo printToolStripButton = type.GetField("printToolStripButton", BindingFlags.Instance | BindingFlags.NonPublic);
ToolStrip toolStrip1 = (ToolStrip)toolStripBar.GetValue(this);
ToolStripButton printButton = (ToolStripButton)printToolStripButton.GetValue(this);
Bitmap bitmap = new Bitmap(MyBmpImage);
printButton.Image = bitmap;
Is toolStrip1 name working always indenpendently of the Windows version?