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 3 6783
Hi GCL
I've wired the event with my first line, control:
DynamicControls.ButtonControl(this,btnSearchByName , new Point(5, 75), new
Size(95, 20), "Name",1,"");
This control/object is being call in/from my frmMain and calls the function
"ButtonControl" with in a seperate .cs called "Dynamic Controls.cs" my
control does all the work of position (5,75), size(95,20) etc. Thank you for
your solution. But, (there always is, lol) your solution is presently what I
am already using, re: (my second line):
this.btnSearchByName.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
This way is working perfectly, but I was looking for more of a polymorphic
way of doing this instead of everytime that I'm writing an control/event I
have to write a "FlatStyle" property after it. I was looking for a way of
adding this to my function "ButtonControl" just like "aControl.Font", but I
can't seem to find the solution myself. hmmm It seems like I'm always coming
up with these querky questions while trying to learn C#, lol. Anyhow, thank
you again GCL. I'll still look for the solution and I'm sure it is one of
those simple things that I've just overlooked.
MikeY
"gcl" <ln*******@comcast.net> wrote in message
news:0a****************************@phx.gbl... cast it.. For example,
((System.Windows.Forms.Button) (aControl)).FlatStyle = System.Windows.Forms.FlatStyle.Flat;
Now I got a question for you.. How are you going to wire the events for these dynamic controls?
Thanks..
-----Original Message----- Hi Everyone,
I am working in C#, windows forms.My question is this. All my button dynamiccontrols properties are present and accounted for except for the"FlatStyle"properties. I can't seem to figure out, if there is a way of usingpolymorphic way (if that is a word) of doing this particular property. Asample of my code is as follows:
DynamicControls.ButtonControl(this,btnSearchByNam e, new Point(5, 75), newSize(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, PointLocation, 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 ButtonControlfunction instead of manually adding this below each & every call. Is there away of doing this. Also the FlatStyle does not appear in the Intellisenseafter "aControl." If there is a way, perhaps someone could provide a quicksimple sample.
Thank you all in advance and have a good weekend.
MikeY
.
Well,
in that function you can check what type of control is
that and check if the control have the FlatStyle
property and if it does, then your
can cast it to button control and set its property
From your message, I still don't see where u wired
to control's events. I was talking about, like for
example,
500 buttons controls, and when the user click
on one of the control, it will trigger the delegate
Anyway, I done them in different way..
Thanks. -----Original Message----- Hi GCL
I've wired the event with my first line, control:
DynamicControls.ButtonControl(this,btnSearchByNam e, new
Point(5, 75), newSize(95, 20), "Name",1,"");
This control/object is being call in/from my frmMain and
calls the function"ButtonControl" with in a seperate .cs called "Dynamic
Controls.cs" mycontrol does all the work of position (5,75), size
(95,20) etc. Thank you foryour solution. But, (there always is, lol) your solution
is presently what Iam already using, re: (my second line):
this.btnSearchByName.FlatStyle =
System.Windows.Forms.FlatStyle.Popup; This way is working perfectly, but I was looking for
more of a polymorphicway of doing this instead of everytime that I'm writing
an control/event Ihave to write a "FlatStyle" property after it. I was
looking for a way ofadding this to my function "ButtonControl" just
like "aControl.Font", but Ican't seem to find the solution myself. hmmm It seems
like I'm always comingup with these querky questions while trying to learn C#,
lol. Anyhow, thankyou again GCL. I'll still look for the solution and I'm
sure it is one ofthose simple things that I've just overlooked.
MikeY "gcl" <ln*******@comcast.net> wrote in message news:0a****************************@phx.gbl... cast it.. For example,
((System.Windows.Forms.Button) (aControl)).FlatStyle = System.Windows.Forms.FlatStyle.Flat;
Now I got a question for you.. How are you going to wire the events for these dynamic controls?
Thanks..
>-----Original Message----- >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,btnSearchByNam e,
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 > > >. >
.
Aaaaaaaaah, I've misunderstood you, sorry bro.
I wire the event like this:
btnSearchByName.Click += new System.EventHandler(SearchBoxArea);
You can just treat the "btnSearchByName" just like anyother button, Label,
TextBox, Gridbox etc ie txtBoxFName.text
I do enjoy using Dynamic controls, but sometimes like this & especially
being that I'm still learning the ropes, it can be head scratching, lol.
Anyhow have a great weekend.
Hey if you want a small samply on how I approach this please drop me a line.
MikeY
"gcl" <ln*******@comcast.net> wrote in message
news:04****************************@phx.gbl... Well,
in that function you can check what type of control is that and check if the control have the FlatStyle property and if it does, then your can cast it to button control and set its property
From your message, I still don't see where u wired to control's events. I was talking about, like for example, 500 buttons controls, and when the user click on one of the control, it will trigger the delegate
Anyway, I done them in different way..
Thanks.
-----Original Message----- Hi GCL
I've wired the event with my first line, control:
DynamicControls.ButtonControl(this,btnSearchByNam e, new Point(5, 75), newSize(95, 20), "Name",1,"");
This control/object is being call in/from my frmMain and calls the function"ButtonControl" with in a seperate .cs called "Dynamic Controls.cs" mycontrol does all the work of position (5,75), size (95,20) etc. Thank you foryour solution. But, (there always is, lol) your solution is presently what Iam already using, re: (my second line):
this.btnSearchByName.FlatStyle = System.Windows.Forms.FlatStyle.Popup; This way is working perfectly, but I was looking for
more of a polymorphicway of doing this instead of everytime that I'm writing an control/event Ihave to write a "FlatStyle" property after it. I was looking for a way ofadding this to my function "ButtonControl" just like "aControl.Font", but Ican't seem to find the solution myself. hmmm It seems like I'm always comingup with these querky questions while trying to learn C#, lol. Anyhow, thankyou again GCL. I'll still look for the solution and I'm sure it is one ofthose simple things that I've just overlooked.
MikeY "gcl" <ln*******@comcast.net> wrote in message news:0a****************************@phx.gbl... cast it.. For example,
((System.Windows.Forms.Button) (aControl)).FlatStyle = System.Windows.Forms.FlatStyle.Flat;
Now I got a question for you.. How are you going to wire the events for these dynamic controls?
Thanks..
>-----Original Message----- >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,btnSearchByNam e, 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 > > >. >
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: charliewest |
last post by:
I need to create textboxes in real-time, the actual number of which is
determine by a result from a database query. I have been able to create the
controls, and then add them to the ASPX page....
|
by: Assaf |
last post by:
Hi all.
In response to user selections, our app adds controls (buttons, image
buttons) dynamically to a page with Controls.Add(myNewButtonControl).
Now that we gotten on the page we want to...
|
by: RA |
last post by:
I have created a button dynamically; which has been added to a TableCell of
a TableRow of a Table control.
Is there a way to add onclick event which calls a procedure on the
Server-side itself....
|
by: Matt |
last post by:
Hi,
Can someone provide some information on how to create a control dynamically
based on the contents of another dynamic control.
In my experience, all dynamic controls must be created in the...
|
by: amirmira |
last post by:
I have a multithreaded application is ASP.NET that checks the status of a
process every 2 seconds. After the thread has completed, the values of
dynamically added controls need to be changed...
|
by: dawg1998 |
last post by:
I have a page that creates dynamic textboxes based on the number of
fields a user chooses to fill out.
This process worked great when the page was standalone. However, when I
move to a...
|
by: Larry Bud |
last post by:
A dynamic control (A dropdown) is created in PageLoad, but the value of
the dynamic control dictates where it's added (such as which cell in a
table) on a postback.
Seems like a catch-22. I...
|
by: brett |
last post by:
I load a dynamic control once a button is clicked. In the control is
another button. However, I can't get its click event to fire. Here's
the pattern:
Page1.aspx
---------...
|
by: imranabdulaziz |
last post by:
hi all ,
i am mess with the one situation.
i am using asp.net2.0 ,C# and sql server 2005.
I have checkboxlist and based on user selection i creates dynamic controls(which code is in...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |