|
Also the SpecialForm is just a form that fades in and fades out when creating and closed. Also has to two methods, one for changing the text in a label and the other for updating a graphic in a pictureBox. It works fine when I get rid of the Thread.Sleep(5000) and the infoBox.Close() and put the infoBox.Close in another button. But of coarse that is manually closing it I need it to close itself after a certain amount of time.
|
|
|
|
|
You need to call BeginInvoke if you accessing the form from a different thread. See this[^] article to know more about BeginInvoke . The code to do what you want will look like
private void ThreadFunc()
{
Thread.Sleep(5000);
infoBox.BeginInvoke(new MethodInvoker(infoBox.Close(), null);
}
This will Close on the UI thread after 5 seconds. Hopefully that'll solve your problem.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Use a Timer object, and on the Tick event, close the form. Enable the timer in the constructor, and set its interval to 5000 ms.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi,
I would like to know how I can use document variables in C#.
I want to create a variable and store a string in it, then open the word document and retrieve the value of that variable.
Can anyone help me?
Thanks!
|
|
|
|
|
Hi ever body,
My question is how we can pass a string variable from c# project to a DLL using a matlab application. i shearched in Mx library and Mat libraries but i didn't found .
Thank u for ur help
|
|
|
|
|
I do it all the time. Just use the EngMATLib. Actually it's on this site!
1..2..3 ways of integrating MATLAB with the .NET[^]
I can pass a string like this to make a 3x3 matrix in matlab...
using (EngMATAccess mat = new EngMATAccess())
{
mat.Evaluate("A = [ 1 2 3; 3 5 6]"));
}
/\ |_ E X E GG
|
|
|
|
|
How we can do it in using DLL to call a matlab application?
|
|
|
|
|
Hi Guys , i want one help Regarding OPSEC SDK.
Open Platform for Security SDK is provided by Check point server which contains API's written in C also it contains many header files dlls etc..
I am new to C language and donot know how can i use the functions etc.. in C# with the matching datatypes....
Can anybody help me for writting the warpper class for it
Thanks and Regards,
Nitin.
|
|
|
|
|
|
Hi,
I've a problem with my image.
I use a function which take a .tif image with 128 colors input.
But I don't know how convert an image in 128 colors.
Do u have any ideas?
Thx for replies
Have a nice day
bibax en fait un max!
|
|
|
|
|
Hi,
I found how convert my image in 128 colors (2^7)
This is my code :
ImageCodecInfo myImageCodecInfo;
Encoder myEncoder;
EncoderParameter myEncoderParameter;
EncoderParameters myEncoderParameters;
//chnage the filename to obtain a tif file
Console.WriteLine(rasterFileName);
int index = rasterFileName.IndexOf(".");
string rasterFileNameTif = rasterFileName.Substring(0,index);
rasterFileNameTif = rasterFileNameTif.Insert(index, ".tif");
Console.WriteLine(rasterFileNameTif);
try
{
// Get an ImageCodecInfo object that represents the TIFF codec.
myImageCodecInfo = GetEncoderInfo("image/tiff");
// Create an Encoder object based on the GUID
// for the ColorDepth parameter category.
myEncoder = Encoder.ColorDepth;
// Create an EncoderParameters object.
// An EncoderParameters object has an array of EncoderParameter
// objects. In this case, there is only one
// EncoderParameter object in the array.
myEncoderParameters = new EncoderParameters(1);
// Save the image with a color depth of 7 bits per pixel (128 colors).
myEncoderParameter = new EncoderParameter(myEncoder, 24L);
myEncoderParameters.Param[0] = myEncoderParameter;
Console.WriteLine(myEncoder);
picChart.Image.Save(rasterFileNameTif,myImageCodecInfo,myEncoderParameters);
It works with all formats input
But when I have a tif file input (I want also tif output but in 128 colors), I have an exception :
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at displayRaster.displayRaster.ChangeRasterFormat() in c:\documents and settings\franck\mes documents\visual studio projects\displayraster\displayraster.cs:line 178
Do u know why?
Thx for replies.
Have a nice day
bibax en fait un max!
|
|
|
|
|
Hi,
I have a windows service in C# (.NET framework 1.1) running on Windows XP
PRO SP2. This service essentiallt starts a printjob watcher. Please see the code
snippet below.
queryInterval = ((SchedulerData)obj).Interval/1000;
//queryInterval=1;
this.printEventWatcher = new System.Management.ManagementEventWatcher();
this.printEventWatcher.Query = new System.Management.EventQuery("SELECT *
FROM __InstanceCreationEvent WITHIN "+queryInterval+" WHERE TargetInstance
ISA \"Win32_PrintJob\"");
string hostName = Dns.GetHostName();
this.printEventWatcher.Scope = new
System.Management.ManagementScope("\\\\"+hostName+"\\root\\CIMV2");
printEventWatcher.EventArrived+=new EventArrivedEventHandler(this.Arrived);
printEventWatcher.Start();
This service fires the EventArrived event when running as my login account.
i.e When the service is run as MaxBici and I login as MaxBici and print
documents, I see the events being fired.
But, when the service is run as NT AUTHORITY\SYSTEM (Local System account),
and I login as MaxBici and print documents the EventArrived event is not
fired.
The query interval was set to 1 second in both the above cases.
Could anyone help me with this?
What does the scope in the event watcher signify?
Isn't the data in the WMI tables visible to all users in a PC?
Thanks in advance.
Max
|
|
|
|
|
could u tell me about Integrated Security=SSPI, what is the role in database connection
|
|
|
|
|
|
|
hi guys, could you tell me how i can add uninstallation way to the setup project, i want to able the users of my project to uninstall it from the program menu not from add remove programs from the control panel ... how i can add it to my setup project ... thanks alot
Thanks alot
Hamody
|
|
|
|
|
Is it possible to open a printer directly connected to the "Lpt:" port on a Windows XP system? I have a form that must be set up exactly on an old dot-matrix printer, and then printed after filling in some values. I would like to open the printer and send ASCII characters to the device.
Is this possible???
Thanks
XamIam
max@maxpcsupport.com
|
|
|
|
|
Hi.
---------
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.Arguments = @"C:\file.txt";
p.StartInfo.FileName = "print ";
p.StartInfo.CreateNoWindow = true;
p.Start();
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
Serdar YILMAZ
Senior Developer
|
|
|
|
|
Thanks Serdar,
This looks like the file is printed through the spooler. Is this the best I'll be able to do with Windows XP? Write to a file and print via the spooler.
Thanks again for your help,
--max
XamIam
max@maxpcsupport.com
|
|
|
|
|
Dear friend, need a help
I have a mdi form and i want to open child form into tabcontrol so i can use that form simutenously by clicking on tab pages.
if its possible please help me soon
thnx
|
|
|
|
|
Can anyone tell me through code in C#,i have drawn roads in form of spline curves using paint brush,now i want to load this bitmap image in C# windows application and then
by reading the pixels of each line in bitmap image to store the piece wise spline curves equations in linked list,as a copy and erasing all the lines after storing these lines in linked list,so that if i click near the line in bitmap image ,that particular line will display .
I will be very thankfull to you.
|
|
|
|
|
Anyone know how to reboot the pc that the application is running on using code?
Cheers
Kev
|
|
|
|
|
|
That should do the trick:
clickedy
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
That's great, i can get the pc to log the user off no problems but im still having problems rebooting it. I know why, i dont know how to set the privileges for the current process.
The calling process must have the SE_SHUTDOWN_NAME privilege
I'm reading through the MSDN docs trying to figure it out but the only one i've found so far is written using C++ code, and the classes are not the same in C#. If you could help me set the privileges that would be great!
Cheers
Kev
|
|
|
|