|
|
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 />
previewImage.Show();<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 />
previewImage.ShowDialog();
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())
form.ShowDialog(); 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).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
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.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi all,
i have built a upnp device. This is an application in C# with two method. An example is:
public void SetTarget(Boolean NewTargetValue)
I want expose this method as web services and then I have two interfaces.
Is there some suugestion?
yu
|
|
|
|
|
Whats your problem now? Ypu don't know how to right a web service? So you can go to webservice part of this site. there are some tutorial about how to begin.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
The problem isn't expose this method as web services. I have a console application of the method and i want expose as web services! How can I start?
|
|
|
|
|
Any one there have any info about syncfusion grid and how good they are?
I am new to it and having many problems.
Thanks
DotNetNew
|
|
|
|
|
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).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
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
}
base.WndProc(ref m);
}
private const int WM_NCLBUTTONUP = 0x00A2;
Thanks
|
|
|
|
|
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).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
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?
|
|
|
|
|
If the control is placed in a container besides a form, then recurse up through the containers to get to the form, like so:
private Form GetContainerForm(Control c)
{
if (c == null) return null;
if (c is Form) return (Form)c;
else return GetContainerForm(c.Parent);
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to determine the total size of some folder including its contents.
Don't forget, that's Persian Gulf not Arabian gulf!
Murphy: Click Here![^] I'm thirsty like sun, more landless than wind...
|
|
|
|
|
You would have to walk the directory tree from the folder your want, adding up all the file sizes inside the folder and subfolders.
RageInTheMachine9532
|
|
|
|
|
|
|
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.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
from http://www.gzip.org/zlib/,i download a Zlib.dll.
i try to use the functions in the DLL,but i dont know how to
use them.
such as this original one:
int compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
in C# i declare it as:
[DllImport]
int extern compress( out byte[] dest, out uint destlen,byte[] src, uint srclen);
but it reports error.
|
|
|
|
|
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).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
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??
Karteek
|
|
|
|
|
You could use SQLDMO, it will return all the info you need.
There are quite a few articles on SQLDMO here on CP, here is the Google search result.
regards,
Paul Watson
Bluegrass
South Africa
Chris Maunder wrote:
"I'd rather cover myself in honey and lie on an ant's nest than commit myself to it publicly."
Jon Sagara replied:
"I think we've all been in that situation before."
Crikey! ain't life grand?
|
|
|
|
|
I have a IComponent (like DataSet) on the ComponentTray of a Form. Having only this IComponent , how can i get a reference to the Form?
Thanks.
|
|
|
|