|
The ImageList in Common Controls 6.0 (Windows XP and newer) supports alpha channels in the ImageList . In order to support the alpha channel, CC 6.0 must be present (which means it won't work on earlier platforms) and you must include an application manifest that redirects the common control bindings to 6.0 (the ImageList class in .NET encapsulates the ImageList common control; this is true of most controls and many other classes in the .NET FCL).
See my article, Windows XP Visual Styles for Windows Forms[^] for an example of the manifest you should include (you can include it as a separate file called MyApp.exe.manifest, though).
Otherwise, you'll have to draw the images yourself like leppie mentioned. If you store the images in a ImageList , the alpha channel, IIRC, is lost (it's screwed-up when it goes into the image list). I could be mistaken. This is a known problem and you could google for the problem, i.e. when the alpha channel is actually lost: before insertion into the ImageList or when drawn by the ImageList .
If I'm right, you'll need to just use a collection to store your image and draw them yourself. It's not hard, though. The Graphics class has an overloaded DrawImage method you can use.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I placed a .manifest-file in the directory of the .exe and all my controls now have the XP style.
The alpha channel seems to work, but there's again a problem: There's a blue "halo" around the image!
What can I do?
Here's a picture:
http://mitglied.lycos.de/fxlabs/terrain_ico.jpg
|
|
|
|
|
If you don't want your controls (those that support it) to have the visual themes applied, just set the FlatStyle property to something other than FlatStyle.System .
Are you sure the halo isn't in your original image? Also keep in mind that if your image originally had a background color that set in the ImageList.TransparentColor , the alpha blending won't affect the anti-aliased pixels, which is most likely what those are. Make sure that if you use an alpha channel for your images, you don't use a background color that would be masked. With anti-aliasing, it won't be masked appropriately.
Again, remember that the manifest only affects Windows XP and newer. Make sure you don't have any problems on older Windows OSes; otherwise, you'll have to draw the images yourself.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I set the FlatStyle property.
The image has no background color at all, it's transparent.
I've taken a screenshot from Photoshop:
http://mitglied.lycos.de/fxlabs/terrain_ps.jpg
|
|
|
|
|
I'm not really sure. I've never had that problem. You could try to google[^] for any similar problems.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Can anyone give me a project where those alpha-blended toolbar icons work?
It's very annoying that such a basic thing doesn't really work!
|
|
|
|
|
|
Will this bug with the "blue halo" be fixed?
I searched in the google newsgroups: there are many(!!) coders, who have similar problems. But the workarounds often don't work or arent statisfactory.
We should start a petition!
(Did Microsoft announce that this bug will be fixed in .NET 2.0?)
|
|
|
|
|
BaShOr wrote:
Will this bug with the "blue halo" be fixed?
I dunno, there's a whole host of Image problems that have not been addressed.
top secret xacc-ide 0.0.1
|
|
|
|
|
Hi,
How can i make a compound file in C#. What classes are usd please give me some idea.
Thanks,
ilmian
|
|
|
|
|
What do you mean by "compound file"?
If you mean an archive of multiple files stored as one, I would suggest using a well known format like zip, since you don't have to write any code by using some of the available 3'd party libraries.
Regards,
Björn Morén
Stockholm, Sweden
|
|
|
|
|
|
|
A "compound file" is an ActiveX document that serializes separate objects and distinct instances. Word, Excel, and PowerPoint are good examples. Compound documents are hosted in an ActiveX container that - if written correct - can aggregate toolbars and menus from the ActiveX document.
Technically, a compound document doesn't have to expose the necessary OLE interfaces for this, though. It's really just a hierarchical collection of objects serialized to a developer-defined format; I just mentioned what I did above because most modern compound documents to expose such interfaces.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
There is no help for creating compound documents using the .NET Framework Class Library, or FCL (C# is just one language that uses the .NET FCL and compiled to Intermediate Language, or IL).
You would have to redeclare all the necessary interfaces (a few are already declared in the System.Runtime.InteropServices namespace, like UCOMIPersistFile ) and P/Invoke any functions you need.
I do have plans to start on such a project when time allows, but it could be a while. I've worked a lot with compound documents and thought it would be fun.
One thing to keep in mind: while the underlying file system in Windows "Longhorn" (T.B.R. 2006...hopefully) will accept any file, WinFS (a database layer on top of NTFS) will take over storing the various distinct properties exposed in Office compound documents and I would imagine that Microsoft would recommend that other compound document formats would do so as well so the documents could be easily searched. This would only apply to properties exposed from the compound document, however, through interfaces like IPropertySetStorage and IPropertyStorage .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
In MSDN if i search for any interface which are used to make a compound file in VC, it says "Import and use the methods found in Ole32.dll.". can u please tell me the procedure in details how can i import Ole32.dll.
if i use "DllImport" attribute then how can i define the attribues of "StgCreateDocfile" method which is used to create a compound files in VC.
because it takes four parameters. the last parameter is "IStorage** ppstgOpen"
which i donot know how to write in C#.
Thanks for your answer
|
|
|
|
|
Read Interoperating with Unmanaged Code[^], especially the topics dealing with P/Invoke and marshaling.
An IStorage** would be declared as ref IStorage . IStorage is an interface which is a reference type, which is basically a managed pointer. Using ref (or out ) is like a pointer to that reference type. You would have to declare a managed equivalent of IStorage however, since you can't simply include it from the C/C++ headers. There are articles about portions of what you want here on CodeProject, but if you read through those sections and have a good understanding of COM programming and marshaling data types (like an unmanaged long is actually an int , or System.Int32 , in .NET/C#).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi, there an interface "IPersistFile interface" in C#, What do you think can i use that interface to make a coumpound file. because i think i cannot write an interface that provides me the functionality of IStorage interface unless i completely understand the code in IStorage. is there any other way.
Thanks for your answer
|
|
|
|
|
Sorry, but you need to understand compound documents and the interfaces used to access and create them, like IStorage or IPersistStorage .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
A compound file is a file that contains multiple streams. There is no native support for them in the .NET BCL, but there are open source projects that implement this kind of functionality. Try this project on SourceForge[^] for an example.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Interesting. I never tried searching for an existing project, but I wanted to do this myself anyway using most of the interfaces already present for the best interoperability with existing applications, namely current ActiveX document containers like Word and Excel.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I wanna know if a C# Application can add options to others apps, like MSN. I run a C# App and when i run MSN, appears a new option, for example.
Thanks.
|
|
|
|
|
Yes, if the other application exposes hooks to do so. You'll seen to see documentation for the other application though and I know nothing about MSN Messanger so I don't know if it does or not.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
MSN, for example, uses COM plugins. You could write a component in C# (gets compiled to IL in an assembly module) that exposes a COM-Callable Wrapper, or CCW. See Nick's article, Creating a CCW for COM-enabled, non-.NET Applications[^]. You register this appropriately, which is defined in the MSN Messenger SDK on the MSN Messenger web site (if you can find the SDK - they moved it some time back).
Since regasm.exe that ships with the .NET Framework SDK only registers the necessary keys and you need to register additional keys so that you can register as an MSN plugin, you'll need to read about the ComRegisterFunctionAttribute and ComUnregisterFunctionAttribute in the .NET Framework SDK.
For some applications, creating a CCW is the only way. You can also use P/Invoke to call native functions and pass them data. You could hook an application that exports the necessary hook functions as well.
There's lots of ways - provided that the application/library allows for it - and you can learn more by reading through the .NET Framework SDK, especially the section, Interoperating with Unmanaged Code[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am writing the chat program in LAN that is similar to the mIRC. When the user connect to server, it will activate the chat form that connected to server in port 9999, and when the user want to chat private, it will active the private chat form that connected to server in port 9998. In my program, I use the "privatechatform.ShowDialog()" to activate the private chat form, but it does not allow to chat in multi-users. but if I use the "privatechatform.Show()", my program is crashed. Please! Help me!!
|
|
|
|