|
The default painting is what is causing this, so owner-drawing your ListView is exactly what you need. Even if you override ListView.OnSelectedIndexChanged (doing what your doing is not soon enough in the event chain) you still have to take care of all these color changes. To implement this form of owner-drawing, however, you'll probably have to override WndProc and having the LVN_* and NM_* notifications of Win32. You could try doing this in OnSelectedIndexChanged , but that won't give you the border you want.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
There are a couple of reasons why it might not work :
- the view style must be "report" : this.View = ListView.View.Report;
- the view must be properly activated : this.Activation = ListView.Activation.(OneClick | Standard | TwoClick);
- the custom styles must be really set as used : your items must have the "UseItemStyleForSubItems" property set to true.
That said, it is not possible to add a border without really ownerdrawing the listview, ie override WndProc.
PS : the funny thing about the owner drawn capabilities of ListView is that the CustomDraw implementation is really exactly the same than the WIN32 NMCUSTOMDRAW handling (NMLVCUSTOMDRAW struct, item stages, ...).
|
|
|
|
|
I am writing C# application that needs to do some job with Excel 2000. I add Microsoft Excel 9.0 Object Library to the project and in code I try to create an Excel object:
private Excel.ApplicationClass ExcelApp = new Excel.ApplicationClass();
OK, object is created, but when I try to access its properties I always get an error: Old format or invalid type library!!
Does anyone have an idea what am I doing wrong?
MarixmaN
|
|
|
|
|
My recommendation is to download Office PIAs[^].
|
|
|
|
|
I already tried that way but still does not work! Bay the way I am using Win 2000 professional. I tried my application on Win XP and everything worked properly. But msdn says it should work on both platforms.
|
|
|
|
|
Ok, then try to upgrade your Office 2000 install and install the latest service pack.
|
|
|
|
|
|
Because you have Office 2000. PIAs work only with Office XP.
Alexandre Kojevnikov
MCP (SQL2K)
Leuven, Belgium
|
|
|
|
|
Looks like data in the registry went out of sync with your Office 2000 type libraries. As .S.Rod already suggested, try re-installing Office 2000, and applying the latest service packs.
Alexandre Kojevnikov
MCP (SQL2K)
Leuven, Belgium
|
|
|
|
|
I just reinstalled office2000, installed SP3, and I am still getting this error ("Old format or invalid type library..."). Maybe there are other updates or SP that I should install? I get this error on all computers where I tried to run my application. What is about that data in registry and Office2000 type libraries, how to sync them?
|
|
|
|
|
I've spent all night looking on the net and havent been able to really find any examples of TAPI programming in C#. Does .Net have its own library for handling telephoney? thanks
|
|
|
|
|
The easiest way of calling TAPI from .NET is to use COM interop. You can either use the existing TAPI 3 com interface or roll your own COM interface around TAPI 2.
Michael
Wonder Woman, Wonder Woman.
All the world's waiting for you,
and the power you possess.
In your satin tights,
Fighting for your rights
And the old Red, White and Blue.
|
|
|
|
|
|
Hi,All
I am writting UserControl ,which has property that returns my own collection.
Property looks like this
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),Description("Get/Set Properties of each Cell")]
public ColumnsCollection AddColumns
{
get{ return clmCollection;}
set{ clmCollection = value;}
}
ColumnsCollection class is derived from CollectionBase(contains collection of ChbColumns objects) which looks like:
public class ColumnsCollection : System.Collections.CollectionBase
{
public ChbColumns this[int index]
{
get{return (ChbColumns)this.InnerList[index];}
set{this.InnerList[index] = value;}
}
public ColumnsCollection()
{
}
public int Add(ChbColumns info)
{
this.InnerList.Add(info);
}
}
ChbColumns class is simple class which contains bool value:
public class ChbColumns
{
private bool m_ShowCheckBox;
public ChbColumns()
{
m_ShowCheckBox = false;
}
public bool ShowCheckBox
{
get{return m_ShowCheckBox;}
set{m_ShowCheckBox = value;}
}
}
Now at design time when i click AddColumns property Collection Editor opens when i add values in it and say ok it doesn't go in set part!(at run time it works)
where should i collect the changes made to this collection(From Collection Editor) at design time?
Thanks and Regards
Tushar.
|
|
|
|
|
Hello to all,
Can you guys help me out i'm a complitly newbie but i want to try and make something with C#.
For now i was undering if you guys could explain if its possible to have a windows form controling a command line program,
what i'm trying to says is i have a prog.exe that only show information that is always printing in the cmd constatly, and i want to be able to see that info in a windows form and possible minimize it to tray, and make him capable of give commands to that console.
Thanks and sorry for the bad english.
|
|
|
|
|
for command line args at start up try something with Enviroment.GetCommandLineArgs();
something like :
<br />
foreach(string jr2 in Environment.GetCommandLineArgs()){ <br />
count++;<br />
string ComandArgs = jr2.ToLower();<br />
byte[] jr = new byte[]{1};<br />
try{<br />
if(count !=1){
switch(jr2.Replace("-",null)){<br />
case "commandarg1":<br />
break;<br />
)
}
)
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
Sorry but has i sad i'm a newbie i didn't understand could you point me to a tutorial.
Thanks
|
|
|
|
|
want me to send you my code ? (program)
The Code Project Is Your Friend...
|
|
|
|
|
Sure, cereal@vizzavi.pt
|
|
|
|
|
i noticed that the default size for des is 8 char's is it possible for me to change this to be anything between 8 and 16 charcters ?
i have tryed just sending a password more then 8 char's and i get a error stating that the password is not a valid size for this algorthim
Jesse M.
The Code Project Is Your Friend...
|
|
|
|
|
The DES algorithm supports only 64 bit (actually, 56 bit but that's a whole other story) keys. If you're wanting stronger encryption look at some of the other crypto providers in the .Net framework:
RC2 supports 128 bit keys
Triple DES supports 192 bit keys (actually not 192 bit..)
Rijndael supports 128, 192 and 256 bit keys.
The reality is that DES is so easy to break you may as well not encrypt your data at all - I would never suggest using it.
Refer to my post in the next thread re: generating a key from a string password if you're not sure on how to do this.
|
|
|
|
|
i implemented it the way that you said..and it works fine but when ever i make the password anything over 8 (including 16) char's i get a IV.Key not valid for block size exception.... code is
DESCryptoServiceProvider des = new DESCryptoServiceProvider(); <br />
byte[] prndKey = new byte[KeySecretString.Length];<br />
PasswordDeriveBytes db = new PasswordDeriveBytes(KeySecretString,prndKey);<br />
byte[] f= db.GetBytes(16);
The Code Project Is Your Friend...
|
|
|
|
|
The idea is to generate a key that's the correct length for the crypto provider -the length of the key has nothing to do with the length of your password string.
Here's some sample code to get you up and running:
SymmetricAlgorithm sa = new DESCryptoServiceProvider();<br />
PasswordDeriveBytes pdb = new PasswordDeriveBytes(pwd, saltBytes);<br />
sa.Key = pdb.GetBytes(sa.LegalKeySizes[0].MaxSize / 8);
SaltBytes is a byte[] array you must supply first. the Salt bytes must be the same for encryption as well as decryption, and are used to help strengthen weak passwords. You may want to a simple fixed array:
byte[] saltBytes = new byte[]{0x00, 0x74, 0xBa etc etc.. };
Or, ideally you would use the RNG service provider the create a random salt for every enceryption, and store the salt value somewhere in the encrypted stream so it could be read when decrypting.
Perhaps I should put together and article on proper cryptography in .Net?
|
|
|
|
|
yeah i think you should i would deffinitly like to read it.
The Code Project Is Your Friend...
|
|
|
|
|
I'm looking at writing an app for storing passwords for the different mailing lists i'm on, with the data encrypted and stored in an xml file. I was wondering if there is a way (in c#) to get a password from a user, and use that as the key to decrypt the data.
I've looked (briefly) through the System.Security.Cryptography namespace but it seems to mostly deal with keys (seperate files), but I would much prefer to input a password and use that as the decryption key - is this possible?
|
|
|
|