|
whoops. sorry. i meant to do that last post. a message box just pops up in DotNetAppHost which says, 'no source code available for this location.'
|
|
|
|
|
No source code? Unless your using a CodeDomProvider to compile source at run-time, this is not an error you should see. What exactly are you trying to do?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
If you write a C# windows forms app, there are two ways in which you can give it the XP themed look :-
(1) is to have the manifest file in the same directory as the exe – this is not very satisfactory and it sucks to have to distribute an extra file with the exe
(2) is to add the manifest as resource to the exe and set its type to RT_MANIFEST and ID to 1 – the problem with 2 is that you have to do this after every re-compilation which sucks
Isn’t there some simple way by which I can tell VS.NET that this resource I added has to be put into the exe as an RT_MANIFEST type resource with ID=1?
I have added the manifest file to the project and changed its Build Action to “Embedded Resource” but there doesn’t seem a way by which I can set the resource type to RT_MANIFEST or ID to 1
Nish
Now with my own blog - void Nish(char* szBlog);
My MVP tips, tricks and essays web site - www.voidnish.com
Request - Could everyone who have in the past, posted on my personal forum on CP, be kind enough to delete all your posts please? I intend to start a personal non-technical blog there, now that it is RSSd and would very much like to empty the forum before I do so - because the posts that are there as of now are mostly test posts and posts that were made before we all knew it was a blog
|
|
|
|
|
An embedded resources is embedded in the assembly and referenced by the assembly MANIFEST (like a Java JAR manifest). This is not the same as a resources in the .rsrc section of a PE/COFF executed.
For now, you have to do either of the two things you're doing now. In VS.NET 2005, IIRC, the ability to add the .manifest file to the Win32 executables resources does exist using the IDE.
Without using the IDE, there is another way. You can use the /win32res:<file> switch on the C# compiler (csc.exe, of course) to specify the .res file. The only problem with this is that if you use any automatic versioning (using an asterisk (*) in your AssemblyVersionAttribute - not usually a good idea anyway since versions matter with .NET assemblies) you have to keep this up to date.
If you use a build tool like NAnt, you should be able to use a more complex build script and still use the equivalent of the /win32res switch.
FYI, if you embed your manifest after the assembly is compiled and you signed it (a good idea anyway for many reasons) you'll need to resign it. It's also a good idea to set AssemblyDelaySignAttribute to false and us sn.exe -Vr yourassembly.(dll|exe) to skip verification so you can test it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the info, Heath - it was very useful to me.
Nish
Now with my own blog - void Nish(char* szBlog);
My MVP tips, tricks and essays web site - www.voidnish.com
Request - Could everyone who have in the past, posted on my personal forum on CP, be kind enough to delete all your posts please? I intend to start a personal non-technical blog there, now that it is RSSd and would very much like to empty the forum before I do so - because the posts that are there as of now are mostly test posts and posts that were made before we all knew it was a blog
|
|
|
|
|
Hi,
does anybody know the equation fo finding a point with in a cirlce(ellipse) given the degree of the point and the diameter?
Thanks!
|
|
|
|
|
This should do it:
a = angle
r = radius
x = cos a * r
y = sin a * r
|
|
|
|
|
This is not even vaguely c#, but I'll reward bad behavior anyway:
For a circle:
d=diameter
theta = angle
x = (d/2) * cos (theta)
y = (d/2) * sin (theta)
Elipse is more complex...best bet: use the above to find the equation of the line through the origin at angle theta, then find the intersection of the line with the ellipse. Not hard...just a little algebra (hard enough that I don't feel like doing it for you though )
Bill
|
|
|
|
|
Not sure if this is what you are looking for, but I'm using this to do something similar in a project currently:
public static PointF CircleLineIntersect(float startX, float startY, float angle, float circRadius)
{
double rad =0;
float xx =0;
float yy=0;
float nx=0;
float ny=0;
rad = 6.28 / 360;
//offset angle. 0 deg is top center
angle=angle+90;
double d = Convert.ToDouble(angle * rad);
xx =(float)( Math.Cos(d) * circRadius);
yy =(float)( Math.Sin(d) * circRadius);
nx = (float)(startX - xx);
ny = (float)( startY - yy);
return new PointF(nx,ny);
}
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards "It'll be a cold day in Hell when I do VB.NET...", Chris Maunder
|
|
|
|
|
Ok, I should explain my problem, I have a piechart(circle or ellipse), and I want to find the middle point of each pie where the percentage text goes. and given the middle point degree of each pie and diameter.
Example piechart[^]
Can you guys come up with a solution for me please.
Thanks!!
|
|
|
|
|
I'm doing something very similar and used the function I posted.
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards "It'll be a cold day in Hell when I do VB.NET...", Chris Maunder
|
|
|
|
|
can you explain this "rad = 6.28 / 360;"
Thank you!
|
|
|
|
|
It's a unit conversion. Math.Sin and Math.Cos take the angle in radians, not degrees. 360 degrees = 2*pi (or ~6.28) radians. rad is used in the call to these methods to convert the user supplies angle (in degrees) to the right units (radians).
|
|
|
|
|
Hi Bill, thanks for the message! Finally I sloved my problem
|
|
|
|
|
I have a question about SetForegroundWindow:
My C# Project uses
PS = Process.Start("gsview32.exe", openFileDialog.FileName);
to open GhostView,
then I write
SetForegroundWindow(this.Handle);
to turn focus back to my program,
But I find my program doesn't really activate,
it is in the foregroundWindow,
but I still need to click it to activate,
I try to add this.Activate(); ,
but still doesn't work...
Can anyone do me a favor...?? thanks a lot !!
|
|
|
|
|
Maybe you could use the API-method ShowWindow , which sets the specified window's show state. The most interesting state for you should be SW_RESTORE respectively 9.
<br />
[System.Runtime.InteropServices.DllImport["user32.dll")] <br />
public static extern bool ShowWindow(int wndHandle, int nCmdShow);<br />
<br />
ShowWindow(wndHandle, 9);<br />
For other states take a look at Winuser.h or Windows.h (don't remember which exactly it was).
|
|
|
|
|
I need to make Windows Forms LinkLabel that will on click open same Outlook's "New message" dialog that comes when in Web Forms you link HyperLink with "mailto:bla@bla.com?subject=BLA". I guess I should do something extrelmy easy but still can't find a way to do this e-mail bidding...
tnx in advance...
|
|
|
|
|
Set the LinkLabel.Text to whatever you want, and in the Click event handler add code like so (easiest way - uses default MAPI client):
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "mailto:bla@bla.com?subject=BLA";
psi.UseShellExecute = true;
Process.Start(psi);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
That does same thing as followin code or there is some difference?
<br />
System.Diagnostics.Process p = new System.Diagnostics.Process();<br />
p = System.Diagnostics.Process.Start("mailto:pele@beotel.yu?subject=Gasi!");<br />
Thanks for your response Heath
|
|
|
|
|
It should.
A few things, though - don't instantiate a new Process because you're assigning the process that gets created to the variable. This is a complete waste. Also, unless you plan on doing something with that process, you don't need to store it. Just call Process.Start("mailto:..."); .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Can a jpeg image be converted into bitmap image programatically.Any suuggestions,please help
mughalali
|
|
|
|
|
// pciturePath is path to your JPG picture (this procedure will overwrite it with BMP version)
protected void PlayWithPicABit(string picturePath)
{
System.Drawing.Image image = System.Drawing.Image.FromFile(picturePath);
float x = image.Width;
float y = image.Height;
float desiredSize = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["width"]);
float percent = (desiredSize/x);
System.Drawing.Image.GetThumbnailImageAbort dummyCallBack = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
System.Drawing.Image littleIMG = image.GetThumbnailImage((int)(x*percent), (int)(y*percent), dummyCallBack, IntPtr.Zero);
image.Dispose();
littleIMG.Save(picturePath, System.Drawing.Imaging.ImageFormat.Bmp);
littleIMG.Dispose();
}
//this function is reqd for thumbnail creation
public bool ThumbnailCallback()
{
return false;
}
|
|
|
|
|
pekica, the code u written to me is not working.i have a file Bluehills.jpg(Come with windowsXP for wallpapers).suppose this file is in E:\\temp.then picturePath="E:\\temp\\Bluehills.jpg".
u says that this procedure will overwrite the file,but it is not doing so.the file remains in jpg format.Also what is the purpose of public bool ThumbnailCallback().u simply return false.Is some code is inserted here.because i have no idea about Thumbnail.please help me.
mughalali
|
|
|
|
|
Yes it overwrites it but new picture is in BMP format. Just change this line
<br />
littleIMG.Save(picturePath, System.Drawing.Imaging.ImageFormat.Bmp);<br />
into... I don't know... something like this and you'll have brand new image:
<br />
littleIMG.Save(picturePath+".bmp", System.Drawing.Imaging.ImageFormat.Bmp);<br />
ThumbnailCallback() is procedure needed by .NET Framework for creating different sized picture... don't know why because I didn't care. As far as you need it you could do only this:
<br />
System.Drawing.Image image = System.Drawing.Image.FromFile(picturePath);<br />
image.Save(picturePath+".bmp", System.Drawing.Imaging.ImageFormat.Bmp);<br />
If you have any extra question drop me an e-mail (pele@zig-zag.net), it's easier that way.
c-ya
|
|
|
|
|
Can anybody tell me how can i set or get mouse clicks programatically.
In my application i have mouse co-ordinates(x,y),i want to single click or double click at it.
|
|
|
|