Hi Everyone,
I am working in C#, windows forms.My question is this. All my button dynamic
controls properties are present and accounted for except for the"FlatStyle"
properties. I can't seem to figure out, if there is a way of using
polymorphic way (if that is a word) of doing this particular property. A
sample of my code is as follows:
DynamicControls .ButtonControl( this,btnSearchB yName, new Point(5, 75), new
Size(95, 20), "Name",1,"" ); << Calling
this.btnSearchB yName.FlatStyle = System.Windows. Forms.FlatStyle .Popup;
<<<Had to manually input this property here
public static void ButtonControl(C ontrol parent, Control aControl, Point
Location, Size Size, String strText, int TabIndex, string strName)
{
aControl.Locati on = Location;
aControl.Size = Size;
aControl.TabInd ex = TabIndex;
aControl.Text = strText;
aControl.Name = strName;
aControl.Cursor = System.Windows. Forms.Cursors.H and;
aControl.Font = new System.Drawing. Font("Microsoft Sans Serif", 8.25F,
System.Drawing. FontStyle.Regul ar, System.Drawing. GraphicsUnit.Po int,
((System.Byte)( 0)));
aControl.TabSto p = true;
aControl.Enable d = true;
parent.Controls .Add(aControl);
}
What I would like to do is to add this property with in my ButtonControl
function instead of manually adding this below each & every call. Is there a
way of doing this. Also the FlatStyle does not appear in the Intellisense
after "aControl." If there is a way, perhaps someone could provide a quick
simple sample.
Thank you all in advance and have a good weekend.
MikeY
I am working in C#, windows forms.My question is this. All my button dynamic
controls properties are present and accounted for except for the"FlatStyle"
properties. I can't seem to figure out, if there is a way of using
polymorphic way (if that is a word) of doing this particular property. A
sample of my code is as follows:
DynamicControls .ButtonControl( this,btnSearchB yName, new Point(5, 75), new
Size(95, 20), "Name",1,"" ); << Calling
this.btnSearchB yName.FlatStyle = System.Windows. Forms.FlatStyle .Popup;
<<<Had to manually input this property here
public static void ButtonControl(C ontrol parent, Control aControl, Point
Location, Size Size, String strText, int TabIndex, string strName)
{
aControl.Locati on = Location;
aControl.Size = Size;
aControl.TabInd ex = TabIndex;
aControl.Text = strText;
aControl.Name = strName;
aControl.Cursor = System.Windows. Forms.Cursors.H and;
aControl.Font = new System.Drawing. Font("Microsoft Sans Serif", 8.25F,
System.Drawing. FontStyle.Regul ar, System.Drawing. GraphicsUnit.Po int,
((System.Byte)( 0)));
aControl.TabSto p = true;
aControl.Enable d = true;
parent.Controls .Add(aControl);
}
What I would like to do is to add this property with in my ButtonControl
function instead of manually adding this below each & every call. Is there a
way of doing this. Also the FlatStyle does not appear in the Intellisense
after "aControl." If there is a way, perhaps someone could provide a quick
simple sample.
Thank you all in advance and have a good weekend.
MikeY
Comment