|
Does anyone know any API to install fonts to windows folder?
On XP I used to just copy those to windows/fonts folder, but it does not work on vista.
There is windows API AddFontResource, but it only installs font until user reboots computer.
Thanks.
|
|
|
|
|
You can add fonts to your setup & deployment project and then register it as font..
|
|
|
|
|
I need to do it programmatically.
|
|
|
|
|
I did not need to register the new font. I copied the new font file into the directory during the install. XP and Vista found it and listed it in the font selection dialog with no problems.
did not know that i had to register the font in anyway
|
|
|
|
|
I think i have the same problem. I want to copy the a font file by using my program, but the only thing i managed until now is to register the font file vie AddFontResoucre so openoffice can use it until my pc reboots. I tried to get write permissions by using FileIoPermission for the font-Directory but when my program actually copies the file to the directory it says i dont have the permission to do so.
My code looks like this:
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Write, "C:\\Windows\\Fonts\\");
f2.AddPathList(FileIOPermissionAccess.Read, fontPath);
try
{
f2.Demand();
System.IO.File.Copy(fontPath, destination);
}
catch (SecurityException se)
{
MessageBox.Show(se.ToString());
}
catch (UnauthorizedAccessException ex)
{
MessageBox.Show(ex.ToString());
}
<pre>
|
|
|
|
|
hi Frnds
I want to call the .dll file created by c#.net. in one of my vb application
after creating the dll ,i am giving the reference of this Dll in my vb application ,but i am not able call the methods of this dll.
Please help me , or give me some good tutorial Link
Thanks in advance
«·´`·.(*·.¸(`·.* *.·´)¸.·*).·´`·» ©
*.¸¸.·´¨` »*Vicky*«´¨`·.¸¸ .*
«·´`·.(*.·´(¸.·* *·.¸)`·.*).·´`·»
|
|
|
|
|
What errors are being returned? Also, why don't you use VB.NET?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
i am not getting any error.
i am not able to call the functions of that Dll
«·´`·.(*·.¸(`·.* *.·´)¸.·*).·´`·» ©
*.¸¸.·´¨` »*Vicky*«´¨`·.¸¸ .*
«·´`·.(*.·´(¸.·* *·.¸)`·.*).·´`·»
|
|
|
|
|
Did you add a reference to the dll?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
The only way you can use newer technology like C# via obsolete technology like VB6, is to use something that VB6 knows about. In this case, this means you need to create a COM DLL in C#, and then VB6 can call it via COM.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i am able to take the reference of that dll.
i am not able to rectify either the problem with the dll creation or taking ref.
i have a c#.net project .i am creaing the dll using this.
the procss i am following:
1)tlbexp (to create typelib)
tlbexp ComInteropExample.DLL /out:ComInteropExample.tlb
2)regasm
regasm ComInteropExample.DLL /tlb: ComInteropExample.tlb
after this i m taking the ref of the .tlb file in my vb project.
i am not able to call the function inside.
Plz help
«·´`·.(*·.¸(`·.* *.·´)¸.·*).·´`·» ©
*.¸¸.·´¨` »*Vicky*«´¨`·.¸¸ .*
«·´`·.(*.·´(¸.·* *·.¸)`·.*).·´`·»
|
|
|
|
|
Hi All,
If you have a control (such as a textbox) which is placed inside any type of panel that has it's AutoSize property set to true, and the AutoSizeMode set to grow and shrink,
then when you ErrorProvider.SetError on it, the panel does not grow and as a result, the error icon is clipped.
Does anyone know a solution to this? it's driving me up the wall!
Thanks
Jon
|
|
|
|
|
I'm Looking for a control similar to ListBox, but it would be a little different. You would see the options that you can choose from on one side (preferably left), and then you would see what you've selected in the list on the box on the right hand side of control. You would be able to move the items back and forth by double clicking on them, or clicking on arrows that would move them. I've seen this type of control used multiple times, and so I figure it must be in the .Net framework, but I can't think of what it's called to find it.
Thanks for the help.
|
|
|
|
|
No, it doesn't exist. This control, as you describe it, is made of 2 listboxes and 2 buttons, one for move left to right and one for move right to left.
You can of course create your own custom control and render in it 2 listboxes and 2 buttons.
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"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."
--Rich Cook
|
|
|
|
|
You could use the standard listbox control for this. Just create 2 list boxes, and place them side by side. have 2 buttons in the middle "->" and "<-". In the button mousedown control, check to see if something is selected in the list box. If there is, get the item in the list box, and add it to the other side. All the "magic" here is done by the buttons.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Erhm, I think that selecting kind of thing is a misterious kind of cooperation between controls, events and code! You can even try this at home!!
Right click your projects and choose Add > User Control
Drag two listboxes on the newly create control which you named whatever you want...
Place one listbox in the left, the other one aligns right, make sure to leave some space in between the boxes for some buttons...
name the left listbox lstOptions, the right listbox we name lstSelection...
Now place four buttons aboce eachother between those lists
name the first one btnAddAll
The second one btnAdd
the third one btnRemove
and the last one btnClearSelection
Now create a function which will add a listitem to a listbox
private void AddItem(ListItem Item, ListBox Box)
{
// Your code
}
then doubleclick the btnAddAll and enter the following code :
<br />
foreach (ListItem itm in lstOptions)<br />
{<br />
lstOptions.Items.Remove(itm);<br />
lstSelection.Items.Add(itm);<br />
}<br />
Then add quite similar code behind the other buttons... You've just create your own control!!!
|
|
|
|
|
I want to write a methode where i can deliver named parameter like this
<code>private void MethodeName( aVar = 10, bVar = "20", cVar = 30, <PropertyName> = <value>, ... ){}</code>
where aVar, bVar and cVar are properties of the class.
I saw know that at Attributes....and i hope there is a way to achieve this with normal methods. If not then i need to know how can i do something similar.
thx
|
|
|
|
|
Standard CLR languages do not support this, but nothing can stop you from
creating a new language and a compiler for it.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I don't think you can write that in C#. Attributes are a special case I suppose.
Why would you need such a method anyway?
MarkPhB wrote: where aVar, bVar and cVar are properties of the class.
Do you mean properties as in get-set or just fields. In the first case, you could just use the properties as they were designed to be used: myClass.aVar = 10, etc...It's a good practice in this case to capitalize the first letter of the property name. In the second case, you could encapsulate the field in a property get-set and use it as described in the first case.
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"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."
--Rich Cook
|
|
|
|
|
Based on your example code, you are showing that you want to provide default values to the function parameters when you define the method. To do this you need to provide different overloads to the function.
Based on your explanation, you want to call a method and pass property initializers to it. You can do something close, but you will need to wait until the .NET Framework v3.5 is released (or use the Beta 2 release). The reason I say "close" is that you can only do this on object creation.
For example, if you have a class
public class UserProfile
{
public int UserId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
pubic UserProfile() { }
} You can create a new instance like this
UserProfile profile = new UserProfile
{
UserId = 123
FirstName = "John"
LastName = "Smith"
};
|
|
|
|
|
However you can create a method with an undefined number of arguments :
private void MyBike(string one, params object[] BikeParts)<br />
{<br />
foreach (Object BikePart in BikeParts)<br />
{<br />
}<br />
}
however you cannot assign names to them and they must be of the same type
|
|
|
|
|
This does not look like acceptable syntax. In C# you always should specify the parameter type in the declaration. C# does not support default parameters. If you intend your sample to mean a method call, private void are irrelevant qualifiers. I don't thing C# supports method calls with this syntax.
Rudolf Heijink
|
|
|
|
|
I'm trying to re-order items in a listbox using Drag-Drop. However, the mouse coordinates I get from the method arguments (e.DragEventArgs) are never right, and the indexFromPoint method is forever returning -1. I've tried to correct the mouse coordinates using PointToClient, they still seem to be incorrect however. Any help with this would be appreciated. Thanks a bunch!
|
|
|
|
|
Yes you would need PointToClient; you can verify the coordinates by looking at them,
e.g. with Console.WriteLine while running in debug mode. You can also get current
mouse position from Cursor.Position
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks for the pointers, I'll continue to poke at it with a large stick. Eventually it will cave.
|
|
|
|