|
Hi Guffa I posted the Rotation matrix link of which I wanted to use to rotate a rectangle drawn using the graphics abstract class and wanted to implement that in C# but I dont have a clue how to do it
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi,
all this inside a Form:
declare class members "float angle=0.0f", "int w=300" and "int h=300";
put a Control (say Panel) with size=new Size(2*w, 2*h);
wire a Paint handler for it, which includes:
Graphics g=e.Graphics;
g.TranslateTransform(w,h);
g.RotateTransform(angle);
... now draw whatever you like in the x-range (-w,+w) and y-range (-h,+h)
now add a Forms.Timer that takes care of animantion; in its Tick handler vary angle,
e.g. angle+=10.0f; // add 10 degrees
[Edit: dont forget to also invalidate the panel]
That's all.
-- modified at 5:57 Wednesday 18th July, 2007
|
|
|
|
|
Thanks Luc, I should give it a try tonight, sorry for the late replay as I'm out of my town lately.. Thanks again my friend
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi
What is the possibility to Build my C# Windows application by using another C# application. If so how to do it,
http://www.codeproject.com/csharp/cscompiler.asp[^]
This one says how to comiple few lines of code, the same way i have to excute and create EXE for whole application, by setting up path.
Thanks
|
|
|
|
|
Hello everyone,
I am a developer from C++ COM to C# COM. I feel confused about the entry point function for a C# COM object.
In C++, we always initialize object through GetClassObject or DLLGetClassObject, but it seems C# does not need these functions?
Here is a sample from MSDN.
http://msdn2.microsoft.com/en-us/library/aa645738(VS.71).aspx
So, in C# do we need to implement the required functions like GetClassObject? If no need, which function is the entry point for C# COM object -- I want to find the entry point function so that I can verify that my C# COM object can begin to talk with other COM clients.
thanks in advance,
George
|
|
|
|
|
The framework implements the class factory object itself, inside the COM Callable Wrapper. It also implements DllGetClassObject itself. In fact, if you look at the registry for your object, you will see that your DLL isn't actually recorded in the InprocServer32 key; instead, mscoree.dll is registered. To run your object, COM runs mscoree.dll 's DllGetClassObject function, which in turn loads the appropriate version of the CLR (the highest installed that is listed in supportedRuntime elements in the application's .exe.config file, if present, or if none are present, the highest version installed), then uses the Assembly and Class registry values (with the assistance of Codebase , if present) to locate the assembly containing your class and the appropriate class to load.
If you want to influence construction, you can do so only using the class's static constructor or instance constructor.
Be aware that all public classes with no constructors, or a constructor that takes no arguments, are registered when you use the regasm tool, except where marked [ComVisible(false)] . Consider using the ComVisible attribute at assembly level to hide all types except those you explicitly mark as being visible.
|
|
|
|
|
Thanks Mike,
I have made some practices using regasm and following your comments. C# COM development is really defferent from C++ development from entry point.
I am using MSDN sample COM server,
http://msdn2.microsoft.com/en-us/library/t9yw5271(VS.80).aspx[^]
Then regasm will generate the following statements,
REGEDIT4<br />
<br />
[HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]<br />
@="CSharpServer.InterfaceImplementation"<br />
<br />
[HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]<br />
@="{C6659361-1625-4746-931C-36014B146679}"<br />
<br />
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]<br />
@="CSharpServer.InterfaceImplementation"<br />
<br />
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]<br />
@="mscoree.dll"<br />
"ThreadingModel"="Both"<br />
"Class"="CSharpServer.InterfaceImplementation"<br />
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"<br />
"RuntimeVersion"="v2.0.50727"<br />
<br />
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]<br />
"Class"="CSharpServer.InterfaceImplementation"<br />
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"<br />
"RuntimeVersion"="v2.0.50727"<br />
<br />
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]<br />
@="CSharpServer.InterfaceImplementation"<br />
<br />
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]<br />
I find only public class InterfaceImplementation is in the reg file, but public interface IManagedInterface is not in reg file. I think the reason is -- just as you mentioned -- only public public classes with no constructors, or a constructor that takes no arguments are in reg file. Is it correct?
I do not know why regasm only cares about public classes with no constructors, or a constructor that takes no arguments -- why interface is not in reg file?
regards,
George
|
|
|
|
|
Are there any Free Libraries available with C# binding for Playing Audio Video Content? As of now my options are Windows MCI and Direct X which I dont really want to use. Besides being able to play the multimedia content I'd like to have some control on the Audio Stream so that I can modify it (Equalizer Settings).
Thanks...
|
|
|
|
|
.NET 3.0 has capabilities for Audio/Video/3D
.NET 2.0 has capabilities for Audio/Less Video Capability than .NET 3.0
DirectX a video/audio standard for Windows
Windows Media Player ActiveX control has capabilities of both video/audio
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi
I have a problem working with MS Word interop.I create an instance of Word Application and I want to use it as a singleton object ( so I don't have to create another word application as long as a user is working with my application)
But if user opens a word document it will be opened using the word app instance that I've created and when he/she quits the word the word instance is gone thus I have a reference to a rpc server that is not available anymore and if i try to do somthing with it a RPC server is unavalilable exception will be thrown.
How can I check to see if a particular RPC server is still available?
Thanks alot
-- modified at 4:01 Saturday 14th July, 2007
|
|
|
|
|
The only way to check whether a cross-process object still works is to make a call to that object.
I'm not sure if Word offers a way for you to request that it should keep running even if the user closes the last frame window. I actually thought applications were supposed to keep running while there were still outstanding references - ensure you're not calling Marshal.ReleaseComObject anywhere.
|
|
|
|
|
Thank you.
I don't use Marshal.ReleaseComObject and I don't release the app reference that I've got either but It happens.
|
|
|
|
|
hi,
i have to play sound when user enter the mouse on toolstrip button,i have written followin code but it is not working.plzz help me out where is the problem
private void button5_Click(object sender, EventArgs e)
{
System.Media.SoundPlayer player = new SoundPlayer();
b=1
if (a == 1)
{
player.SoundLocation = "C:\\WINDOWS\\Media\\tada.wav";
player.Play();
}
}
private void tsbutton_MouseEnter(object sender,EventArgs e)
{
System.Media.SoundPlayer player = new SoundPlayer();
a = 1;
if (b == 1)
{
player.SoundLocation = "C:\\WINDOWS\\Media\\tada.wav";
player.Play();
}
}
thanks
-- modified at 4:33 Saturday 14th July, 2007
|
|
|
|
|
<br />
private void tsbutton_MouseEnter(object sender,EventArgs e)<br />
{<br />
System.Media.SoundPlayer player = new SoundPlayer();<br />
a = 1;<br />
if (b == 1)<br />
{<br />
player.SoundLocation = "C:\\WINDOWS\\Media\\tada.wav";<br />
player.Play();<br />
}<br />
}<br />
<br />
<br />
In this
<br />
a = 1;<br />
if (b == 1)<br />
{<br />
When your b will become 1 ? Is this is hiccup?
|
|
|
|
|
now plz check this out
private void button5_Click(object sender, EventArgs e)
{
System.Media.SoundPlayer player = new SoundPlayer();
b=1
if (a == 1)
{
player.SoundLocation = "C:\\WINDOWS\\Media\\tada.wav";
player.Play();
}
}
private void tsbutton_MouseEnter(object sender,EventArgs e)
{
System.Media.SoundPlayer player = new SoundPlayer();
a = 1;
if (b == 1)
{
player.SoundLocation = "C:\\WINDOWS\\Media\\tada.wav";
player.Play();
}
}
|
|
|
|
|
Hi,
some suggestions:
1. have only one SoundPlayer, make it a class member
2. dont use variable names such as a and b, no one understands them (including yourself)
3. have a bool "soundEnabled" which gets set/cleared by button5 and ...
4. have a bool "alreadyPlaying" to prevent multiple concurrent sounds
5. is MouseEnter handler first check soundEnabled, if false, dont do anything;
check alreadyPlaying, if false, set it true and start sound asynchronously
6. biggest problem will be how to clear alreadyPlaying since there is no event for end of
sound. Maybe a Forms.Timer is the way to go.
|
|
|
|
|
Hey,
I want to bring up multiple layout for my windows application. That is same application need have multiple view as same like our IDE, Center of the page we have text editor, bottom side compiler result, right side solution view etc., the same look and feel is possible in C# windows application? I have plyed around lot in VC++, now i would like to get the same in C#.
Can you please help out to me?
Thanks !
|
|
|
|
|
You want a sample which look like the Visual Studio IDE? You can try to look at SharpDevelop IDE. You can read their code to check how they wrote the multiple layout for C# windows application...
|
|
|
|
|
Is that code written in C#, since i want to build it using C#.
|
|
|
|
|
Yeah. It's in C#. Here is the URL.
But only one thing. there are too much of coding in it..
|
|
|
|
|
I do not see any URL, please send me again.
|
|
|
|
|
Did you move your mouse over the word "here"
Okay anyways.. here goes http://www.icsharpcode.net/OpenSource/SD/
|
|
|
|
|
My C# winforms app allows users to create documents. Embedded in a document is any author meta-data the author wanted to share, such as their website URL. Then, other users who open their document can click the URL entered by the author to have their browser opened to that page. My concern is that a malicious user, instead of entering his homepage into the URL field, will enter some kind of crazy URL that includes scripting code or some other internet exploit, which will do something bad to an unsuspecting user who clicks on that URL (sorry I'm not being more technical, but I don't really know how all these exploits work).
My question is this: Are there any specific characters or other junk that my C# app should filter out from a URL before sending it to the browser?
Thanks for the help!
|
|
|
|
|
You can regular expression for checking whether it's valid URL or not in your C# application.
here is the one that I google for you..
|
|
|
|
|
There's not really any point in trying to protect users from code in the url, as long as you are letting them link to a page of their own. They can put anything on the page they are linking to, and you can't check it. Of course you can check the url, but don't fool yourself (and your visitors) that it's safe just because the url itself doesn't contain anything harmful.
If you are afraid of malicious users, you should warn anyone that is clicking on a link that you don't have full control over, that they are moving to a page that might contain something harmful (or offensive, or illegal...).
---
single minded; short sighted; long gone;
|
|
|
|