|
Provided you have the window handle, you could use IsWindowEnabled[^] to get the state of the window.
|
|
|
|
|
Thank's for your help, I think that's what I looking for
|
|
|
|
|
i want to enable one of the security setting in Custum Level of Trusted Site zone in IE.How can we do it programatically.
|
|
|
|
|
i want to resize my form that is only to increase its size but not to decrease or if i decrease the size also the width and height should not be decreased than its actual width and height. In the resize event i used an if else statement to check whether its current height and width are less than the actual one, but the problem is once i stop the resize my form size is the one i want but while i am resizing a vertical blue line is visible due to the width is less than actual width of the form so i want to avoid that line or my resize event should not work when the form width is less than the actual width.
help me..
thanks in advance.
|
|
|
|
|
|
thanks Senthil with that i am able to avoid the appearance of the blue line.
|
|
|
|
|
hello,
can i somehow add to a datagridview cell other controls?
i know that i can set the type of the column(combobox, checkbox, ...)
my proplem is to show a datetimecontrol in a cell (or in the cells of a column)
and so i asked me if there is a general solution to create such a column or cell which contains any control
thnx
|
|
|
|
|
i think you have to derive your own datagrid column class from the ones already available and add the control you want.
I think there are plenty of tutorials around to show how to achieve this with a combobox.
|
|
|
|
|
How to hide drives under My Computer tree in OpenFileDialog box using C#
bsk
|
|
|
|
|
I have a few winforms that are occationally being populated with data-intensive charts. I am experiencing problems with slow respons, and I think the root cause is a slow screen update that is handled outside my code.
While other windows paint almost instantaneous, my windows form may need up to 3 seconds before it's back in shape when I toggle between this form and for instance Internet Explorer.
I figure it has something to do with how .net redraws the form, because no code is running in my application when the subject winform is being refreshed. It may seem like .NET, CRL or whatever is rebuilding the form from scratch every time I have visited another window.
In the same "spirit" the form has a similar response time when I am unchecking one of 15 charts.
Needless to say this is a killer for user ergonomy. Are there any knobs to turn that can improve the situation?
Thanks
|
|
|
|
|
sounds like you need to thread the data retreival and update the form as you get the data.
Also you can cache the data after you get it and only retreive it periodically, however, this won't be required once threading is implemented.
btw, google 'cross thread exception' or similar so you don't end up getting these exceptions when threading is implemented.
kind regards,
g00fy
|
|
|
|
|
thanks for the reply g00fy,
My understanding of .NET and CRL is limited.
I have a form, and the form has been painted. It took some time to do this job, which is ok. But it seems like .NET insists on building and painting the form from scratch every time I have visited another window. And if I press a checkbox it rebuilds everything too. Or so it seems.
Why doesn't it just show the painting? Will multithreading affect how .NET treats the form in this regard?
|
|
|
|
|
It sounds like your logic is not right.
If you have a form, and on it you have a datagrid with 1000 rows, and a checkbox.
If you check the checkbox (which is initially unchecked) then the form will only repaint the checkbox, not the datagrid, as the state of the datagrid did not change.
Therefore, are you persisting changes when the checkbox state changes and re-retreiving the data for the datagrid?
regards,
g00fy
|
|
|
|
|
I do not have a datagrid. I have charts. But no databinding. I populate the charts "manually" by code. No even-driven painting. No overload painting action.
When I uncheck a series, it is programmed to be hidden, so at least a part of the chart has to be repainted.
But the response between toggling windows and checking/unchecking a series is very similar, so it seems to me like more or less everything is repainted.
Thx for asking,
|
|
|
|
|
I've just tried the following code for decompressing a .zip file, but get the following error message:
"The magic number in GZip header is not correct. Make sure you are passing in a GZip stream."
The error is on line 27: "int bytesRead = compressedZipStream.Read(smallBuffer, 0, 100);"
My code is as follows:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.IO.Compression;
namespace GZipText_decompression
{
class decompressionTest
{
static void Main(string[] args)
{
FileStream inputFile= null;
GZipStream compressedZipStream = null;
try
{
//determine the uncompressed size of the file
inputFile = new FileStream("c:\\translated_catalog.zip", FileMode.Open, FileAccess.Read, FileShare.Read);
compressedZipStream = new GZipStream(inputFile, CompressionMode.Decompress);
int offSet = 0;
int totalBytes = 0;
byte[] smallBuffer = new byte[100];
while (true)
{
int bytesRead = compressedZipStream.Read(smallBuffer, 0, 100);
if (bytesRead == 0)
{
break;
}
offSet += bytesRead;
totalBytes += bytesRead;
}
compressedZipStream.Close();
//open and read contents of the file no that the uncompressed size is known
inputFile = new FileStream("c:\\translated_catalog.zip", FileMode.Open, FileAccess.Read, FileShare.Read);
//Decompress the file contents
compressedZipStream = new GZipStream(inputFile, CompressionMode.Decompress);
byte[] buffer = new byte[totalBytes];
compressedZipStream.Read(buffer, 0, totalBytes);
//Display decompression information
Console.WriteLine(Encoding.UTF7.GetString(buffer));
Console.WriteLine("Compressed size is {0} and decompressed size is {1} ", inputFile.Length, buffer.Length);
compressedZipStream.Close();
Console.ReadLine();
}
finally
{
if (inputFile != null)
{
inputFile.Close();
}
if (compressedZipStream != null)
{
compressedZipStream.Close();
}
}
}
}
}
The file that I'm decompressing is a .zip file.
Any ideas?
|
|
|
|
|
I write a software with a setup an copy it to Cd
i want when cd run for first time, Autorun of cd run the setup and for another times run the exe of software (Inestallsed in first time )
how can i do it ?
is there any sample code?
MHD
|
|
|
|
|
try this[^]. its free too
regards,
g00fy
|
|
|
|
|
it is good
but it dosn't do the work that i want
MHF
|
|
|
|
|
I want to copy data from datagrid and save or open in excel\word\csv\html format.
how to do.
plz helpme. it's urgent
|
|
|
|
|
Hi
i am new in c#.Please can u tell me how cal i used UI wizard in c#
if c# has no inbuilt wizard.Then how can i use the wizard plz tell the simplest answer
Parshant
|
|
|
|
|
you can add a tabcontrol to a form, dock fill it and hide the tabs, then each tabpage you add is a step in the wizard.
as you step through keep instance or store the information in a file or dataset or something, then each 'Next' click goes to the next *hidden* tabpage.
or check this [^]for a full tutorial.
regards,
g00fy
|
|
|
|
|
Hi
I want to check whether a software is installed or not in the client system where i am going to install a windows application.
Can we use the condition option in the setup creation? we can means pls help me with how to do it?
OR Pls give me some good suggestions to do this....
Thanks in ADVANCE.....
|
|
|
|
|
Hi,
in my project i use .Net 2.0 Xml serialization, ie something like that :
<br />
XmlSerializer xmls = new XmlSerializer(typeof(Class1));<br />
StreamWriter sw = new StreamWriter(path, false, Encoding.UTF8);<br />
xmls.Serialize(sw, c1);<br />
sw.Close();<br />
It works perfectly, but i need to implement a zip compression after the xml serialization. So i decided to create an XmlZipSerializer, which implements Serialize and Deserialize methods, but with Gzip compression. So i did something like this :
<br />
public class XmlGZipSerializer : XmlSerializer<br />
{<br />
public new void Serialize(Stream s, object o)<br />
{<br />
GZipStream gzs = new GZipStream(s, CompressionMode.Compress);<br />
StreamWriter first = new StreamWriter(gzs, Encoding.UTF8);<br />
base.Serialize(first, o);<br />
}<br />
public new object Deserialize(Stream s)<br />
{<br />
GZipStream gzs = new GZipStream(s, CompressionMode.Decompress);<br />
StreamReader second = new StreamReader(gzs, Encoding.UTF8);<br />
object o = base.Deserialize(second);<br />
return o;<br />
}<br />
...<br />
}<br />
And use it like this :
<br />
XmlGZipSerializer xmls = new XmlGZipSerializer(typeof(Class1));<br />
using (StreamWriter sw = new StreamWriter(path+".gz", false))<br />
{<br />
xmls.Serialize(sw, c1);<br />
}<br />
But there's a problem (cause if there wasn't i wouldn't have posted ) :
when doing this i get a problem when unzipping (manually with winzip or when deserializing), saying that the XML document is not well formed. Example :
<br />
<Class1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Valeur="132" Nom="test" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t" 5t"<br />
instead of :
<br />
<Class1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Valeur="132" Nom="test" /><br />
But if in the Serialize method i add 'gzs.Close()' after 'base.Serialize(first, o);', the document is well formed. But i can't use this solution with 'using', cause when getting out of the using block i get an exception like : cant close a file already closed.
The thing is i really need to use using blocks in my project, plus closing the stream in the serialize method is not "good".
I tried to use the Flush() methods on my streams but no way, i can't get a well formed xml document when unzipping.
If anyone knows how i could get out of this mess, i would be grateful !
|
|
|
|
|
What will be the syntax for writing a file in C# in which i can write some functions (I want to use these functions in multiple classes). The file must not be a class and i can able to access functions in that file by using syntax like:
namespace.functionName();
I don't want to create any instance of that file (unlike a class). So is there any way to do so? or i am going to some wrong direction?
sAqIb
|
|
|
|
|
public class Utils
{
public static SomeFunc1() { ... }
public static SomeFunc2() { ... }
}
You can call the methods like Utils.SomeFunc1() , no instance is required, because the functions are static . In .NET 2.0 you can also make the class static: public static class Utils
regards
modified 12-Sep-18 21:01pm.
|
|
|
|