|
You're on the right step with your translate code, so that you rotate around the centre. I'm not sure how to calculate the required size of the new image, but obviously you need to know it when you create newImage, so you can create an image of the right size. I would imagine you could work out some triangles that are formed by the outline of the old image and the new one, and use trig to work out the length of the new sides, and thus work out the size of your new image.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hello,
Well, instead of doing the hard work I used another program to rotate 10 degrees and it resized appropritately (at least visually). From this I gathered the new dimensions of what the resized picture should be.
Still, armed with this it does now good to set the size of the new image using g.drawImage() because the image within graphics object is already chopped up. So all setting the new image with the larger widthXheight known values does is create a bigger 'chopped up' pic. ;-]
It's strange, I thought perhaps setting the variable newImage = bitmap() with the known values, but that just make the initial picture bigger and therefore the result (g.drawimage()) equally bigger (compared to original image dimension), but still it's chopped up.
What the problem is, i think, is that the Graphics object somehow needs to be enlarrged before I call the rotate function... well, that's sort of what I've narrowed it down to. It's funny, moments ago I even found a really good exmpale of roating a Graphics...but, still, they didn't account for the resizing issue.
|
|
|
|
|
FrankeyJames wrote: is that the Graphics object somehow needs to be enlarrged before I call the rotate function...
Yeah, if you rotate the original image, which is too small, then it's obviously going to get chopped ont he side. As I said, you can't resize a grpahics object.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Yeah...
I think I got it now. I think I figured out what is wrong. Now I just need to do this math calculation so it's automated....
If and when I get a godo solutiong working I'll post it here.
|
|
|
|
|
Hi again,
As you figured out, it is easiest to translate things such that the origin is at the center.
These are the equations that rotate a point (x1,y1) around the origin over an angle alpha, whose cosine and sine are cosa and sina:
x2 = x1 * cosa + y1 * sina
y2 = -x1 * sina + y1 * cosa
If you apply that to the rightmost top and bottom points (W1/2,H1/2) and (W1/2, -H1/2) where W1 and H1 are original width and height, you get two new points one of which will have the extreme X value (hence half of the new width) the other the extreme Y value (half of the new height).
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hi,
I have a system web page (c#) that is running within the company there is one process in the system that needs approval from vendor/supplier within the company (separate office). The request is that thay just want to receive email notification for approval using MS outlook and then there are 2 buttons (approved/reject) either of the two should execute the SQL statement that will update the flag of the record table.
Any suggestions on how to do it?
My solution:
I created a web page where all the updates for approve/reject was there. I can send outlook message to the users with 2 buttons. Once he click either of the two it will run the web page and should execute the SQL statement. Unfortunately, nothing happen. At the same time the web page should close automatically.
Regards
Dabsukol
|
|
|
|
|
Your client is making stuff up. Real developers step in and tell people why they can't have anything they like.
In this world, Outlook limits what it will display/allow because of all the viruses out there. I would not be surprised if what they want, won't work.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi
how can i build FTP client for copy files from the server to other computers
and terminal ?
thank's in advance
|
|
|
|
|
This is not the place for asking anything related to basic networking or whatever. We only solve programming problems, that too only if the code is provided for rectification. Got it?
|
|
|
|
|
|
Hi
I am copying file using SafeFileHandle but if source folder contains any hidden file it also get copy but in destination it is not a hidden file. I want that after copy the attributes remain the same.
Please Help
Thanks in Advance.
|
|
|
|
|
Just read all file attributes before copying, then set the attributes after copying.
|
|
|
|
|
Hi there,
I am creating a removable tool for a particular worm, which copies itself to C:/System32 directory as the root. Then it tries to spread via the SMTP or whatever like that protocol. However, when I delete the root copy of the worm from the C:/System32 directory, it agains get created in that location. Therefore, I have written a C# console application to kill this worm. I have written the following one line code to delete this worm whenever it copies itself to C:/System32 folder as deletion:
//This is in spontaneous loop
System.IO.File.Delete(@"C:/System32/Loveu(worm).exe");
However, since loop is implemented here, the black screen becomes very visible and just remains in a visible mode. Therefore, my question is, how will I hide a console application process during its runtime(incase the process is too long)?
Your help will be really appreciaed,
Rajdeep.NET
|
|
|
|
|
Haven't tried this.....
Jus got some time back while googling....
Try it out and post a reply if it works...
using System.Runtime.InteropServices;
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName,string lpWindowName);
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
caption depending on the system you are running under.
IntPtr hWnd = FindWindow(null, "Your console windows caption");
if(hWnd != IntPtr.Zero)
{
ShowWindow(hWnd, 0);
}
if(hWnd != IntPtr.Zero)
{
ShowWindow(hWnd, 1);
}
Have a Happy Coding.....
|
|
|
|
|
That makes the window minimised to the task bar, it does not hide the process.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi...
Just now checked the code myself....
It hides the console window named "CHECK".....
Check this code and leave a reply....
using System;
using System.Runtime.InteropServices;
namespace Loading
{
class loading
{
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
static void Main(string[] args)
{
Console.Title = "check";
Console.Write("Hello World");
IntPtr hWnd = FindWindow(null, "check");
if(hWnd != IntPtr.Zero)
{
ShowWindow(hWnd, 0);
}
Console.ReadLine();
if(hWnd != IntPtr.Zero)
{
ShowWindow(hWnd, 1);
}
Console.ReadLine();
}
}
}
Have a Happy Coding.....
|
|
|
|
|
Sorry, actually I wanted to just hide the processing Window, not the process. I know thats it impossible to hide a process. Thanx for pointing out my mistake.
|
|
|
|
|
You can't 'hide' a process. You want to hide the window. In that case, the answer you got is correct. Or just make it a windows app and make it run minimised.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
ofcourse you cant.....
Eventhough the caption is wrongly given as Hiding the process, the question demands only to hide the window....
Have a Happy Coding.....
|
|
|
|
|
Just make your application as a service. Your application run in background without a window.
|
|
|
|
|
Hi,
I have three listview controls list view one i filled on loading and listview two i filled by selecting name and moved them in listview two now i am in problem i need to show all ID of listview two values for this i am trying by loop but i couldn't make it
I am trying to fill this by for loop but i couldn't make it.
Kindly do replay.
Thanxxxxx
|
|
|
|
|
I'm sorry, but this is a nonsense. You need to post code to show us what you're doing wrong.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
you will never find a fruitful answer unless you clearly explain your question.
Am assuming that,
you hve a 3 ListView controls LV1, LV2 LV3...
LV1 fields are filled while loading your form.. and you gotta select items from LV1 to fill out LV2....
And now you need to get IDs of LV2...
Is it that you want....?????
Have a Happy Coding.....
|
|
|
|
|
.I have 2 Labels in my asp.net page.The text Property of labels will be null.there will be a dropdown menu (Eg.Arabic,English).i want to pass dropdown menu value to class file and inside class file i should define labels.Label text property should be fetched from resource file(eg.ResourceEng,ResourceArab.resx)and pass text value to Labels in asp.net page.
modified on Monday, April 6, 2009 1:54 AM
|
|
|
|
|
There is a separate forum dedicated to ASP.Net is available....
You may give a try there...
Have a Happy Coding.....
|
|
|
|