I've been working on my own run of the PDF to JPG/PNG/GIF conversion from an article featured on this site. I have all of the conversions and filepaths working fine right now my problem is some of the JPG's need rotated before they're finished. So I built a seperate form that displays the JPG after it has been converted but before it has been saved. So the rotation can be done manually at run time since some need rotated others dont and theres no way to tell without looking at them.
When I used
ImagePreview previewImage = new ImagePreview(pdfBitmap);<br />
It just opens every single image in the process in its own form.
So I changed it to
ImagePreview previewImage = new ImagePreview(pdfBitmap);<br />
and this at least keeps stops the code while the first image is open.
The problem I'm having now is my "Rotate" Button of my ImagePreview form will not rotate the passed (pdfBitmap) however if I move the rotate code into the ImagePreview_Load
The rotation occurs when the form loads so I know the rotation code works. pbPreview.Image.RotateFlip(RotateFlipType.Rotate180FlipNone);
But why wont the button rotate the image?
Also to test that I had the correct "click" event I placed a label control on the form and set the text with the "Rotate" buttons click and it works fine.
Any help would be greatly appreciated sorry if this is long winded.
Put a break point in your Click event handler for the "Rotate" Button and see if it even gets called. It's possible that the event may not be hooked-up. If you copied and pasted the button, for example, all properties are retained but the event handlers are not (though the event handler implementation remains - it's just not hooked-up to the event again).
Also, Show and ShowDialog are both documented well. Show just sets the Visible property to true, while ShowDialog is a blocking call that starts a new message pump for the dialog. You should also dispose of this form when finished like so:
using (MyForm form = new MyForm())
This is only necessary when calling ShowDialog. Even if the variable falls out of scope, the native resources (i.e., resources having to do with the modal dialog) are not freed. If you don't dispose them, you'll find your memory consumption continually increasing, even after forcing garbage collection (rarely a good idea to do anyway).
Thanks for the advice on the "using" statement I was about to do that the hard way not even thinking about it.
I placed the break point in the click event for rotating the image and it(the breakpoint) worked. the rotation still didnt happen. Also I did that the hard way by setting a text property for a label on Click. So Im confident the event is firing.
But did you actually step through your code? Obviously something is happening where the image isn't rotated. Were any exceptions thrown? Were you returning prematurely? These are the types of things you need to do to debug your application. Since you didn't provide any sample source code (like your event handler that is supposed to rotate the image), it's impossible to help you any further.
I have four quadrents (sp?) on a form in which can be populated with child forms. I want the user to be able to move these forms to a different quadrent, but only if the quadrent does not already contain a form. The problem that I am having is I do not get a mouse up event when they are done with the move. Any Suggestions?
Why not just handle the LocationChanged event for your forms. For a Form, the Location property returns the screen coordinates of the form. Just keep track of the previous coordinates and if you don't want the user to move to a quadrant, move the form back to it's original location. There are a few other ways to implement this as well without handling the mouse events.
As far as moving the form, you really should override WndProc in your child classes (or use an IMessageFilter implementation for global control) and handle the WM_NCMOUSEMOVE and other non-client area messages that apply to the non-client portion of the Form (i.e., the window frame).
Thanks for the response. The LocationChanged seems to work the same as form move. They come in constantly and I do not know when they are done. I want them to be able to basically move the form close to a quadrent and when they let up on the mouse it will snap into that corner. If they let up and there is already a form there, then it will snap back.
I put an override of WndProc and waited for a WM_NCLBUTTONUP (0x00A2) so I could see when it was finished, but it never gets there. I am not that familiar with WndProc so is there something I am doing wrong?
protected override void WndProc(ref Message m)
if (m.Msg == WM_NCLBUTTONUP)
//put a breakpoint here
private const int WM_NCLBUTTONUP = 0x00A2;
Yeah, forget about the message. As far as the LocationChanged event, you could use this in tandem with the mouse events (rather than moving the form yourself, since Windows already does that for you). That still comes back to your original problem, though.
In your form, are you handling the event or overriding the respective OnEventName? The latter is better when you derive from a class and want to handle the events. In this case, however, make sure you call base.OnEventName with the EventArgs (or derivative) you were passed (with or without making changes to it).
I developed a user control, that creates a little form (X) and positions that form relative to the control.
The control is placed on a windows form to test it.
The idea is that when the windows main form is moved, the control is also moved (anchoring), but form X should move along.
So what I do is catch the LocationChanged event of the ParentForm of the control, and in that event I reposition form X. This works ok.
However, now I'm in the situation that the control is placed on something that has no ParentForm.
Question: how can I detect if a control's screen coordinates are changing? So the position of the control inside its parent remains the same, but the screen coordinates change because the parent is moved. Can I detect such movement?
AppPaths is used for something entirely different. You really should read the Platform SDK.
What I'm suggesting you do is keep a knowledge base of known executable and product names. For example, you know that devenv.exe is the executable for the Microsoft Visual Studio .NET product. Store those as a key/value pair in a database, XML file, or some other data store. If you only want to track specific products as you mentioned before, this is the fastest way.
I repeat - for the third time - querying MSI packages is far too slow and ambiquous and querying other installations is most likely not possible (I know for sure that several proprietary installers don't support this). It's just not possible. You must understand that.
Keeping a knowledge base of executables and packages is the only way you'll be able to acheive what you're after - and it's unspeakably more efficient than what you wanted to do in the first place.
Yeah, and what's the error? Also, see the defs for the parameter types to determine exactly what they are, like what's the difference between uLongf and uLong. If they don't have any API documentation, then you probably shouldn't use it if you don't know what you're doing.
Besides, there are plenty of project already that let you ZIP files in .NET. See SharpZipLib[^]. ZIP is a standard (until recently, but that's only in the realm of encrypting contents which WinZip and PKZip can't agree on).
I would like to invoke query builder application in my program or build a query builder wizard in C#. Can some one help me in graphically displaying the tables in the query builder wizard?
I want to display all tables, their attributes , and foreign key relations between tables using arrows. How can I do this??