|
In my PluginTest app.... yes...
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|
|
In which case i'd be very interested to see that, i started trying to implement it myself a few weeks ago and got bogged down in various bits of documentation.
|
|
|
|
|
Heh, ok....
Your the second person to ask me this maybe I'll type up an article with what I learned. There are some great examples here like:
http://www.codeproject.com/csharp/PluginsInCSharp.asp
But i'll send you what I made, the code is rough and hasn't been tweaked (Theres a lot I want to add to it) but its a proof of concept. But you can run method's ETC from an external DLL.
I will email it to you.
Matthew Hazlett
Windows 2000/2003 MCSE
Never got an MCSD, go figure...
|
|
|
|
|
Is there a way to measure single character?
Graphics.MeasureString seems to be off.
For example if I have character "i", and the particular font I'm using it's one pixel wide, I'd like to know that it's 1 pixel wide. MeasureString adds some extra space.
|
|
|
|
|
Look at the System.Drawing.Graphics.MeasureCharacterRanges method, it should be all you need. Be forewarned: that method won't measure more than 32 characters. Call it recursively if you need to measure more than 32 characters.
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
MeasureCharacterRanges makes things even worse.
What i'm doing is drawing text on a curve, so I need to draw each character seperately, because each character is at different x, y position and different rotation angle. The way measurestring (or measurecharacterranges) work is that it looks like it's done using fixed width font.
|
|
|
|
|
You should also make sure that the StringFormat you're using has the StringFormatFlags.MeasureTrailingSpaces excluded.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am converting a C++ control to a .NET control. In the C++ control in the OnDraw() method I tested for AmbientUserMode, and painted the background with a hashed brush if !AmbientUserMode, or if AmbientUserMode used the BackColor property. How can I test for AmbientUserMode in C# controls?
|
|
|
|
|
Use the protected DesignMode (boolean) property in your control to determine if the control is currently being designed.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
One other way if you want to separate your design code from the runtime code (common in the .NET FCL with the .Design assemblies), attribute your class with a Type string for a ControlDesigner[^] in a different assembly so that your Type string would look like "MyNamespace.Design.MyControlDesigner, MyAssembly.Design" (".Design" isn't necessary - just a common naming convention). The ControlDesigner lets you paint over your control (see ControlDesigner.OnPaintAdornments .
The designer classes and interfaces can be very powerful when used effectively, and most designer support is built right into the .NET FCL (some is provided by the development environment like VS.NET or SharpDevelop). For more information about extending components with design-time capabilities, see Enhancing Design-Time Support[^] on MSDN.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can i change the fileattributes of a file (or folder). I will change the Read-only, Hidden, archive,... tags but i can't find it somewhere.
It was no problem to change the creation, last access and last written time, but that class (FileInfo and DirectoryInfo) doesn't have anything to change the attributes of it.
Can you help me?
Jonathan Slenders
|
|
|
|
|
|
See FileInfo.Attributes (inherited form FileSystemInfo ). You can use bitwise operators to change the flags. For instance, to exclude the read-only, hidden, and archive flags, you could do something like this:
FileInfo info = new FileInfo("path");
info.Attributes &= ~(FileAttributes.ReadOnly | FileAttributes.Hidden
| FileAttributes.Archive);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to replace the System Clock ("Date & Time properties") in the sys tray with my own. Does anyone have any ideas on how I can get text to appear as the notify tray icon (just like the windows system clock) ?
|
|
|
|
|
Unless you can fit readable text into a 16x16 pixel icon, you can't. The system clock is not a systray icon and is handled specially by Windows.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I've gor the code to send SMS, but it gives an error message! Please any centilmen can help ? )
The code is as follows:
SMSC objSmsTool = new SMSC();
objSmsTool.PortID = 1;
objSmsTool.MessageText = "Hello, this is a test message";
objSmsTool.Recipient = "0624896641";
objSmsTool.ProviderDialString = "0,0653141414"; // The SMSC provider
Console.WriteLine("Sending message...");
objSmsTool.SendMessage(-1);// -1 means: through service provider
if( objSmsTool.LastError == 0 )
{
// YES, connection established.
Label2.Text = "ok";
Console.WriteLine("Message successfully delivered");
}
else
{
Label2.Text = "Message delivery failed, error: " + objSmsTool.LastError;
}
}
catch(Exception b)
{
Label2.Text = "exception";
}
|
|
|
|
|
Why don't you tell is what the exception is, and where it's occuring? Since this is not a .NET class provided by the Framework class library (FCL), it's difficult to know what you're doing wrong since this is a third-party control. You should always provide error information when asking for help on an error anyway.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi, thank you for your advices
Error is:
Server Error in '/my_p' Application.
--------------------------------------------------------------------------------
The specified module could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: The specified module could not be found.
jenny
|
|
|
|
|
It appears that the SMS assembly can't be found. You should put this either in the bin sub-directory of your web application or install it into the GAC by dragging into %windir%\assembly or using gacutil -i theAssembly.dll (only referencing the SMS assembly).
Anything beyond that, you should consult the web site for the SMS assembly you're using.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Aaand please check this link to understand what I'm dealing with...
best regards
jenny
|
|
|
|
|
https://www.exhedra.com/vb/scripts/ShowCode.asp?txtCodeId=1404&lngWId=10
ups sorry!
well, i am sleeping
i forgot to write the url
jenny
|
|
|
|
|
Hello !
I'm writing an application in C# that must be able to look for information in MSDev if at least one MSDev process is running.
Precisely, I'd like to get the list of the files that are currently opened in the MS-Dev editor.
I think I must add a Reference such as : COM / Visual C++ Text Editor
But I don't know how to use the component...
Does anybody know the right way to do that ?
Best regards,
- Éric -
|
|
|
|
|
Write click on Referenes in your project, select Add Reference then from COM tab browse your dll then simply you can add namespace and use it.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
Thanks Mazy, but that's what I've done and the problem is that I don't know how to use this dll/namespace so as to connect with an MS-Dev process running on the same computer and to get the list of the files which are opened in MS-Dev using COM.
- Éric -
|
|
|
|
|
If you're looking to write a plug-in, you can reference EnvDTE. You can find more information about this on MSDN, Manipulating the Development Environment[^]. More easily, just create a new add-in project in VS.NET. You can get access to the open files (the text editor itself won't help) from there.
If you're trying to do this external the development environment, I'm not sure how you could get a reference to the EnvDTE object or if it's even possible. I do know that devenv.exe does register open files in the running object table (ROT). You could P/Invoke GetrunningObjectTable to get a reference to the IRunningObjetTable (a COM interface, so you'll have to import it or re-define it in C#). You can then enumerate the objects using the EnumRunning method with an IEnumMoniker (forunately, .NET already exposes the UCOMIEnumMoniker interface so you don't have to define IEnumMoniker ). From there, you can get file monikers, filtering on devenv.exe to get the open documents. COM programming experience will be helpful.
Microsoft MVP, Visual C#
My Articles
|
|
|
|