|
I like how all the replies say the same thing
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
I had a chance to learn WPF for a little while and found a useful feature which I want to create in WinForm, but not sure how to do so. I was wonder if there's a way to create an expander (just like how it work in WPF) in WinForm? Thanks...!
tant tant
|
|
|
|
|
You mean create a way for your form to expand or contract ? It won't work as smooth, but just run a timer, and inside it, set the size of your form, or your controls, or whatever.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes, In my WinForm, I want to create a function where i can expand and collapse each sections. Right now I have it by using UserControl and Panel, then each time a user hit the button it hides the Panel. However, the way I have it does not work so well because I'll then have to create a user control for each sections and one form and run to 10 sections. Please advice.
|
|
|
|
|
Is this[^] what you are looking for?
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Well, I just want an expander function like how WPF have it, but not sure how to create that in WinForm?
|
|
|
|
|
Hi,
I am looking for any help or tutorials on creating a program that is trial until user activates to their system hardware, or using a serial number, either is required.
Thanks, Andrew.
|
|
|
|
|
You can see HASP hardware keys. But if you develop .NET application, it can't help you very much, because, as I know, it's easy to decompile application and switch off security system.
|
|
|
|
|
Hi Andrew,
Try taking a look at this article[^].
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
hello , im having a problem with the DataGridViewButtonColumn/DataGridViewButtonCell
i am trying to apend a button cloumn to my datagridview so everytime the user is clicking on one of the buttons in the grid an event will fire ,
i have noticed there is no access to events in the DataGridViewButtonColumn but there is an onClick protected method which fires when the user clicks the button, so i made my own class which drives from it and added my own event here is the code:
<br />
public delegate void buttonClickHandler(DataGridViewCellEventArgs e);<br />
class DataGridViewButton : DataGridViewButtonCell<br />
{<br />
public event buttonClickHandler buttonClick;<br />
<br />
protected override void OnClick(DataGridViewCellEventArgs e)<br />
{<br />
if (buttonClick != null)<br />
{<br />
buttonClick(e);<br />
this.DataGridView.InvalidateCell(this);<br />
}<br />
else<br />
{<br />
Console.WriteLine("button event was set to null");<br />
}<br />
base.OnClick(e);<br />
}<br />
<br />
<br />
}<br />
i used this DataGridViewButtonCell in my program like that:
<br />
.<br />
.<br />
.<br />
DataGridViewButtonColumn dgvBC = new DataGridViewButtonColumn();<br />
<br />
DataGridViewButton bc = new DataGridViewButton();<br />
bc.buttonClick += new buttonClickHandler(dgv_button_click);<br />
<br />
dgvBC.CellTemplate = bc;<br />
<br />
dataGridView1.Columns.Add(dgvBC); <br />
.<br />
.<br />
. <br />
The Problem:
each time the buttonClick Event fires when the user clicks on one the buttons in the datagridview
the event is for some reason is null , what did i do wrong?
is there any better way to do this? , any advice will be more than welcome , thanks!
Net
|
|
|
|
|
I am currently working on an app that requires large volumes of processing. The long story short, it was determined that threads would be the best way to split it up and increase performance of the application. Heres the catch: I have to use STA as the com objects used are registered as STA objects. Fun!
I ran a quick test with one STA/thread and two STA/threads both running the same code and the results show that the single thread was actually faster than using two threads. I figure this is due to the nature of the message queue and sequential processing. So my question is this, is there any way to have an STA that can process simultaneously without a performance decrease? My code is fairly simple:
<br />
ParameterizedThreadStart workerThread = new ParameterizedThreadStart(EditFeatureClass);<br />
Thread protoThread = new Thread(new ThreadStart(ItterateFeatureClass)); <br />
protoThread = new Thread(workerThread);<br />
protoThread.SetApartmentState(ApartmentState.STA); <br />
protoThread.Name = featureName;<br />
protoThread.Priority = ThreadPriority.Highest;<br />
protoThread.IsBackground = true;<br />
protoThread.Start((object)featureName);<br />
<br />
}
Any suggestions and comments would be appreciated (And no, I am stuck with STA).
I have posted a copy of the unedited document I have been working on in regards to this if it helps. It should be the second link - Thread Performance Testing.[^]
-- modified at 18:25 Thursday 4th October, 2007
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
Aaron VanWieren wrote: it was determined
what do you mean "determined"? Does that mean "assumed"? I suggest Advanced Windows by Richter, it might be able to shine some light on your subject.
|
|
|
|
|
It was the direction my boss said to go. Read some Richter, will look into that one.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
Hi,
you did not tell us much about ItterateFeatureClass. If all it does is call your COM
object, I am afraid the only way to get it really multi-threading is by providing multiple
identical COM objects, one per thread, assuming the functionality allows that.
The alternative of course would be putting the multithreading right inside the COM object
itself, but I guess that is not what you hope for.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
IterateFeatureClass() is just a test class for right now that performs a number of editing operations, which are set up through the COM objects. I would have included that code but it includes allot of third party library stuff that is registered as STA. I ran a test with two threads and my time doubled compared to my single thread test. I made sure to time the performance for just the iterations as well as the setup and tear down.
Basically my test code is creating a workspace(think database connection) and retrieving a featureclass(think table). From this feature class it creates an object and adds a feature(think row) then modifies a field(think column) and finally it stores it in the workspace. I am trying to explain this without getting too much into the library as it is different terminology. But I have ensured that all the COM Components are generated withing the STA thread.
Luc Pattyn wrote: The alternative of course would be putting the multithreading right inside the COM object
itself, but I guess that is not what you hope for.
As this is a library I cannot modify I cannot do this.
The interesting this is that a colleague of mine attempted this and just through it together with MTA threads. In my testing I discovered this was the worst thing to do performance wise as it took the MTA thread 8 mins to do what an STA thread was doing in 4!
Hope this helped a little bit more.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
Hi Aaron,
if your CPU load is sufficiently low right now on both client and server (assuming DB on
separate machine here), the only thing I can think of that could improve overall elapsed time
is using multiple processes, each with one STA thread, again assuming the job can be split
in independent parts, that just share data at the database level. This would basically
cost additional CPU cycles to perform the remoting, but it would increase parallelism on
the DB operations.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I have a main form with menu options to open child forms within this main form window.
Problem I am seeing is that I get scroll bars when I do this. if I move around with the scroll bars they disappear and give me what I wanted.
Now if I make the menu invisible the child form opens correctly. But I need the menu bar so other child forms can be opened.
The goals is the following for every child form opened;
• Without scroll bars
• Without control box
• With the main menu bar still visible
• Child window docked nicely.
Does anyone have ideas as to why I am getting this behavior and how I can get the behavior I want?
Sample of the current code to open the child form from the main form.
private void menuBornEntry_Click(object sender, System.EventArgs e)
{
/// Performing Born Entry activity . . .
frmBornEntry dlgBornEntry = new frmBornEntry () ;
dlgBornEntry.MdiParent = this ;
dlgBornEntry.Activated += new EventHandler(ChildWindow_Opened);
dlgBornEntry.Closed += new EventHandler(ChildWindow_Closed);
dlgBornEntry.Dock = DockStyle.Fill ;
dlgBornEntry.Show () ;
}
Thanks
Rich
|
|
|
|
|
try resizing your forms in design time.
think that could help... i dont see anything wrong in the posted code.
Greetings
|
|
|
|
|
I tried resizing the child form but it ended up being too small in the main form window which is not the desired goal. no matter how I resized it I would have the child form either too small and get the scroll bars.
Thanks
|
|
|
|
|
Set the WindowState of the child form to Maximized. This means that the child window will show maximized in the MDI frame - which will put the close/minimize/maximize buttons in the MDI frame window.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi guys
I wanna know how I could make the following function more generic and stop writing tedious code...
My current example function:
<br />
public SqlCommand SetupCommand()<br />
{<br />
SqlCommand cmd = new SqlCommand();<br />
cmd.CommandText = "SELECT * FROM Test";<br />
cmd.CommandTimeout = 180;<br />
<br />
return cmd;<br />
}<br />
The above snippet of code will return a SqlCommand object. However there is cases where I would like this very same method but this time around returning a OleDbCommand object.
Is there a way to make this method more generic to be able to return any Command types e.g SqlCommand, OleDbCommand without having to re-write code all the time.
I guess I'm searching for something similar to IDataReader that can return either SqlDataReader or OleDbDataReader.
Thanks in advance.
R.
|
|
|
|
|
Wouldn't the easiest way be:
<br />
public DbCommand SetupCommand(bool isSql)<br />
{<br />
if(isSql)<br />
{<br />
}<br />
else<br />
{<br />
}<br />
return cmd;<br />
}<br />
There is no knowledge that is not power. - Mortal Kombat
|
|
|
|
|
|
|
If you are using .NET 2, take a look at the DB Provider classes that were introduced. These classes, such as DbCommand[^] are intended to provide you with a relatively database agnostic way of working with your data. You can get more detailed information here[^].
Deja View - the feeling that you've seen this post before.
|
|
|
|