|
when i press enter i want to select the whole row in datagrid so i added
....
this.dataGrid1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.DataGrid1KeyPress);
....
void DataGrid1KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter) dataGrid1.Select(dataGrid1.CurrentCell.RowNumber);
}
..and i overrided onkeypress in mydatagrid with
protected override void OnKeyPress(KeyPressEventArgs e)
{
base.OnKeyPress (e);
}
but not working...what is missing??
|
|
|
|
|
Is there any ways to read directly and rapidly from a stream to an unmanaged buffer ( IntPtr or byte* ) without having to do a convertion from the byte[] to the IntPtr through Marshal.Copy method ?
More clearly, I want to avoid this Marshal.Copy :
byte[] b = new byte[1024];<br />
int size = theStream.Read(b, 0, 1024);<br />
IntPtr bufferPtr = Marshal.AllocHGlobal(size);<br />
Marshal.Copy(b, 0, bufferPtr, size);
Apparently there is a UnmanagedMemoryStream class coming along with winFx doing the job, but I'm looking for something usable with the framework 1.1
Thanks a lot,
Julien.
|
|
|
|
|
Here is an example of how I load a memory font from resources:
PrivateFontCollection col = new PrivateFontCollection();<br />
Stream fontStream = GetType().Assembly.GetManifestResourceStream("somefont.ttf");<br />
<br />
byte[] fontdata = new byte[fontStream.Length];<br />
fontStream.Read(fontdata,0,(int)fontStream.Length);<br />
fontStream.Close();<br />
<br />
GCHandle gc = GCHandle.Alloc(fontdata, GCHandleType.Pinned);<br />
<br />
col.AddMemoryFont(gc.AddrOfPinnedObject(),fontdata.Length);<br />
gc.Free();
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
That's interesting. Do you know what is actually GCHandle.AddrOfPinnedObject doing behind ? Because I'm not sure C# arrays are contiguous like C/C++ arrays are. And I profit to ask you; have you compared both methods efficiency ( GCHandle / standard Marshal.Copy ) ?
Thanks for the hint anyway
Julien
|
|
|
|
|
|
Hello,
I have written C# dlls, but not executable wrappers. I would like to wrap an executable and make it a *service*. Can anyone recommend an article or approach?
Many thanks,
dotBomb
|
|
|
|
|
I want to free up the network while the user is logged in to the machine.
Basically I will be running azurues on a machine that my family uses. They have all different logins to the machine. Mum, Dad, Sister, etc.
When I have azureus running under my account they can't browse the web becuase I am chewing up all the network. User fast switching allows my account to continue downloading through azureus ... while someone else logs in to browse the web and check their emails etc
I don't want to give them access to my account to pause/stop azurues.
I can build a small app that can talk azurues by using azurus xml over HTTP plugin. This is not a problem. But I don't want to have to have them manually stop/start azurues with this app as they may forget to restart it.
I wanted to make the whole process automated. So I was going to write a NT service that will pause azurues when a user logs in and resume download when they log off.
But I am not sure where to start looking to get the logon and logoff event.
It would be good if I could get the user id that is logging on and off So that I can select which accounts will pause azureus and which will allow it to continue running (ie my logon account).
|
|
|
|
|
Hello everyone!
This is my first post here!
OK, I made some kind of music player that plays the music in a different thread... When the user clicks the "Stop" button, the thread stops, but then I can't restart the thread when the user clicks "Play" because I get a ThreadAbortException! What can I do? Thank you very much!
Darth_Sulfur (Sulfurik)
http://www.SulfurSoft.tk
ftp://tsfc.homeftp.net
hotline://tsfc.ath.cx
|
|
|
|
|
It's not possible to reuse aborted threads. What you can do is simply stop and wait instead of aborting the thread. Something like
void ThreadFunc()
{
while(true)
{
if (isStopped)
{
startEvent.WaitOne();
}
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
No, just name the thread when you make it, then stop it, then use this trick:
[code]Thread.FreeNamedDataSlot(string name);[/code]
And then you can restart it!
Thanks for your help though!
|
|
|
|
|
hello
I have a question about the static class that is auto generated when you create strongly typed resources. The question is how do i make the class and properties stay public in shared resource-only assemblies, when i need to update the resources, becasue the code is auto generated when you update the resource. So the class and properties change back to internal is there a work around ????
thanks in advance
kered
|
|
|
|
|
It's rarely a good idea to modify tool-generated code. Why not just make a public class that exposes the verious resources as public?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuals for Christ, Yeah!
Judah Himango
|
|
|
|
|
have you got any samples of how to do this or links it is very hard to find much on this subject.
thnaks for the reply
|
|
|
|
|
Just make a static class that exposes all your properties publicly.
static class PublicResources
{
public string SomeStr
{
get { return Resources.SomeStr;
}
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Homosexuals for Christ, Yeah!
Judah Himango
|
|
|
|
|
Thanks for that bit of code that does work for the main app assembly, but how do i get it work for resource only assemblies, which are updated outside the project. I cant access the class because it is internal below is a web pag that tells me the following:
Listing 1: A static class is generated for all strongly-typed resources.
This class and its properties must be made public in shared, resource-only assemblies, in order for them to be accessible to other components as shown in Figure 2.
http://www.theserverside.net/articles/showarticle.tss?id=LocalizationPractices
this does not make sense because if you up date your resources the class and its properties change back to internal with the auto generated code tool.
Hope you can help in some way
|
|
|
|
|
How do I read output from another shell program (e.g. netstat --or-- dd) so I can input it into my program?
The current code I have is:
/********************
* Get the list of devices from dd.exe
********************/
System.Diagnostics.Process process1;
process1 = new System.Diagnostics.Process();
process1.EnableRaisingEvents = false;
string strCmdLine;
strCmdLine = "/C dd.exe --list > list.txt";
System.Diagnostics.Process.Start("CMD.exe",strCmdLine);
process1.Close();
My goal is to read a list of devices that it's capable of and provide a list. This program is jsut going to be a wrapper to the shell program.
Any suggestions?
|
|
|
|
|
Look at the ProcessStartInfo class. It has a RedirectStandardOutput property, which lets you read from the StandardOutput streamreader of the process. Then you don't have to bother with cleaning up temporary files when you are done.
|
|
|
|
|
That was exactly what I was looking for, thanks!
|
|
|
|
|
Is there a way to display writeln, write, or any output from the program
in the debuger output window.
Because, I had to create an additional testForm with the richTextBox in it so I can see my print statements.
Thank you
|
|
|
|
|
|
I'm looking for a way to make an authentication form to my windows form based app. I want this form to be left in front of the parent main form, until user succeccfuly authenticate. If he press cancel it close the parent form. No other from may be load in front if this authentication form.
TIA,
Ronen
Ronen
|
|
|
|
|
You may use the ShowDialog() method to wait for a response and cast its return with DialogResult class.
Or in the Deactivate event of this login form write:
Activate().
|
|
|
|
|
I'm looking for a way to make an authentication form to my windows form based app. I want this form to be left in front of the parent main form, until user succeccfuly authenticate. If he press cancel it close the parent form. No other from may be load in front if this authentication form.
TIA,
Ronen
Ronen
|
|
|
|
|
Make it modal.
When you load you're authentification form, call
theAuthForm.ShowDialog(parentForm); and that's probably enought but if you are looking to have the dialog abolutely on the top of all the others application windows , try the property theAuthForm.TopMost=true.
I hope I've correctly understood your question.
Julien
|
|
|
|
|
I have Form1 (main form) containing menues, and etc...
Then by clicking on the menu options in Form1, I invoke the children of Form1 :
private void menuNew_Click(object sender, System.EventArgs e)
{
string a = "New_Click";
Form2 fNew = new Form2(a);
fNew.MdiParent = this;
this.menuNew.Enabled = false;
fNew.Show();
}
something like that.
When I am ready to close fNew form, how do I set menuNew back to enabled.
I know you can do it prety easily using ShowDialog, but I have to do it with MdiParent settings.
Thank you
|
|
|
|