|
I need to be able to display AOL .ART format files as well as the usual JPEG, GIF, etc. The VS.NET PictureBox does not support this format.
Does anyone have a suggest how this can be achieved?
Many thanks
Chris
|
|
|
|
|
Actually, GDI nor GDI+ (around which System.Drawing is built) does not natively support that format. You need a decoder that supports the .ART extension. I remember that IE a long time ago had this, but I'm not sure about it now.
If there's any hope for help, it would help to have an example. Could you post a .ART file up somewhere where I can take a look?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Heath,
Thanks for replying to my post (again!!).
IE does indeed support AOL ART files, I played around with it some time ago (but can't find the code now!). It worked but I could only get it to work with a file as it's source. The code I have resizes images on the fly without writing out to a file - I couldn't work out how to get IE to accept anything other than a file.
Unfortunately any .art files I have are at work, and I am now at home for the weekend (Doh!). I'm scouting around the net to see if I can locate some, but putting .art into google gets the whole world back!
Chris
|
|
|
|
|
I found one in the first result with "AOL art image file". I'll need some time to take a look at how it is supported. GDI appears to support it but GDI+ doesn't "out of the box".
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks for taking the time to look at this Heath.
|
|
|
|
|
Heath,
Did you ever get a chance to look at this? I put it on the 'back burner' to concentrate on other work, but have started looking at this again - any help would be appreciated, I can assure you it is in a good cause!
Chris
|
|
|
|
|
I did some originally but didn't find any answers. The best I can tell you is to go to http://lab.msdn.microsoft.com/vs2005[^] and request support for it in GDI+.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Oh well, worth a try...
Thanks for your efforts!
If anyone else has any bright ideas for displaying .art files it would be appreciated.
|
|
|
|
|
I am trying to override the WM_PAINT message and I am continuously getting WM_PAINT messages. The basic code snippet is:
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_PAINT)
{
Trace.WriteLine(" WM_PAINT event");
m.Result = IntPtr.Zero;
}
else
{
base.WndProc(ref m);
}
}
As I am planning to do all the drawing I don't want to call the base message processing for the WM_PAINT messages. Any ideas?
|
|
|
|
|
your code looks fine to me, could you be more specific about your problem?
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
I probablly should have mentioned that this is for a toolbar control that only contains buttons.. It seems that when I call the base message processing I only get the one WM_PAINT message (for instance when the cursor is dragged over a button). If I don't call the base message processing I constantly get WM_PAINT messages.
|
|
|
|
|
WM_PAINT methods are handled differently than other messages by Windows. A WM_PAINT message is automatically sent if there are any outstanding invalid regions in your window. Windows knows that have painted your window, and thus stop sending WM_PAINT, after an application calls the Win32 functions BeginPaint\EndPaint. The easiest way to accomplish this in your case is by calling the base class OnPaint, which handles it for you.
|
|
|
|
|
WM_PAINT is sent for many reasons, and the best way to optimize your code is to honor the PaintEventArgs.ClipBounds property passed to OnPaint . Only draw what's necessary.
Overriding WndProc to handle painting is almost never the right way to handle user painting. Instead, you call SetStyle in the constructor and override OnPaint like so:
public MyControl()
{
SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint,
true);
}
protected override void OnPaint(PaintEventArgs e)
{
} Control.WndProc already handles the WM_PAINT messages and wraps the arguments necessary for painting in the PaintEventArgs and disposes the Graphics object when OnPaint returns.
If you want double-buffering for your custom drawing code, also OR the ControlStyles.DoubleBuffer enumeration with SetStyle in the example source above.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello all,
I need a program in C#.NET that can do compression and decompression of text files.
Will be much thankful, if u cud help me in getting the same.
Regards,
Manivannan.P
|
|
|
|
|
If depends what compression you want. The most popular is the ZIP format (LZH compression). The most popular ZIP library for .NET is #ziplib[^].
Note that .NET 2.0 will support LZH compression, as well as provide abstract stream classes for other stream compression algorithms.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
ok, so I made a tic tac toe game. But it's really of no use because you have to play against someone else and I don't even know how to have it tell if someone won. Basically I have flat buttons and every time one is clicked, it becomes read only and it it puts an X, and then the next button clicked has the text property of O and so on. I need help creating the code that enables the user to play against the computer. I think this is done using a two-dimensional array, but my skills in c-sharp are quite limited. So any help with the code and tactics the computer would use (in the form of code) would be very helpful. I realize this is kind of a big request, but if you have time, it would be awesome if you could help. You could even publish an article somewhere on the website, that many people would use.(just let me where you publish it if you do)
thank you so much,
Stephen
|
|
|
|
|
If you google for "tic tac toe bot", you'll find lots of discussions and examples in many different languages.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Anyone have any ideea how to host other application in .net ? I start the word/notepad/cmd using process but i want my app to host it not the windows, something like mdi forms; when i minimize the hosted app i wanna go at base in my form not in windows.
Thanks in advance .
|
|
|
|
|
Don't know about notepda but ther are a lot of com components that you can use inside your own forms e.g. Windows media player.
If you are using visual studios then right click on the toolbar and select customize toolbar and you will get tons of com and .net components.
|
|
|
|
|
There's no way for you to "host" the app in your application. You simply cannot redirect where your hosted application's drawing code is going to paint its window. You would have to completely rewrite the Window Manager subsystem of Windows and essentially make your application the new Desktop.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Those are separate applications with their own top-leve windows; you cannot host them. You can only host controls. In the case of Office applications like Word, you can host the Active Document container (pretty much everything) and - if you go to a massive amount of work - even get information to host the toolbars.
This is not supported in .NET, however, not until 2.0 at least (which adds the ActiveDocument control. You can write your own, though, but you must have a good understanding of COM and interoperability with .NET; otherwise, you should try googling the net for examples that already do this.
Also note that you can host the Word OCW control which was designed to be hosted in a web page (OCW == "Office Components for the Web"). That's as easy as customizing your Toolbox in Visual Studio and dragging "Word" onto your form. Now you can host Word documents. You do the same with Windows Media Player as someone else suggested.
Note all applications support this, however: only ActiveX controls are supported.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I have a c# console app and all i want to do is write to a log file when the program ends.
I put my code in the destructor but it doesn't write to the log file. Any ideas why this is happening or how i can solve this?
|
|
|
|
|
|
ok this is my destructor -
~TiffConverterClass()
{
Logger l = new Logger(@"c:\testLog.txt");
l.writeLine(Logger.logType.Info ,"Application has been disposed");
l.Dispose();
}
i have a class variable in TiffConverterClass i.e private Logger log but i figured that maybe when I close the program it gets disposed before it gets to this destructor - thats why i declare it again in the destructor. This destructor is in the same class as the main method.
|
|
|
|
|
The destructor (properly called a finalizer in .NET) should not be used for this kind of thing because it is non-deterministic and when your application ends it is obviously just not being called at all. (I'm not actually sure if it should have been called or not - I simply don't use finalizers. They aren't recommended anyway)
gavinJeffrey wrote:
This destructor is in the same class as the main method
The Main method is static, it doesn't require an instance of the class to operate, so you would never get a finalizer called if that is all you were using.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|