M
MikeY
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,btnSearchByName, new Point(5, 75), new
Size(95, 20), "Name",1,""); << Calling
this.btnSearchByName.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
<<<Had to manually input this property here
public static void ButtonControl(Control parent, Control aControl, Point
Location, Size Size, String strText, int TabIndex, string strName)
{
aControl.Location = Location;
aControl.Size = Size;
aControl.TabIndex = TabIndex;
aControl.Text = strText;
aControl.Name = strName;
aControl.Cursor = System.Windows.Forms.Cursors.Hand;
aControl.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
aControl.TabStop = true;
aControl.Enabled = 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,btnSearchByName, new Point(5, 75), new
Size(95, 20), "Name",1,""); << Calling
this.btnSearchByName.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
<<<Had to manually input this property here
public static void ButtonControl(Control parent, Control aControl, Point
Location, Size Size, String strText, int TabIndex, string strName)
{
aControl.Location = Location;
aControl.Size = Size;
aControl.TabIndex = TabIndex;
aControl.Text = strText;
aControl.Name = strName;
aControl.Cursor = System.Windows.Forms.Cursors.Hand;
aControl.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
aControl.TabStop = true;
aControl.Enabled = 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