By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,662 Members | 929 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,662 IT Pros & Developers. It's quick & easy.

Help! Font property read only in VS.NET?

P: n/a
Hi,

I am using an ActiveX created using delphi. It has a font property exposed.
The font property is of type IFontDisp in the server(delphi). The font
properties like Size, Bold, Underline etc has both 'Set' and 'Get' methods
when using the activex in a VS6 app.

But when using the activeX in a VS.NET app, the font properties are read
only. The only way that i can set the font properties is by:

MyActiveX.Font = new Font("Arial", 10, FontStyle.Bold)

Subsequently if i need to turn off Bold, i need to again make use of font
constructor like:

MyActiveX.Font = new Font("Arial", 10, FontStyle.Regular)

If the font properties are writable, i can set its properties by:

MyActiveX.Font.Bold = True
MyActiveX.Font.Italics = True

How can i acheive this? i.e. the font property that is exposed from my
activex server (written in delphi) should be both read and write in my
VS.NET client.

Please help!

Thanks in advance.
Amith.


Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Amith,

Technically, the font property is both read and write. Its the
properties on the IFontDisp interface that are not read and write. Can you
show what the declaration of the IFontDisp interface is (it has to be in an
interop assembly of some kind). Perhaps the definition is incorrect.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Amith" <am***@gnostice.com> wrote in message
news:uZ*************@TK2MSFTNGP12.phx.gbl...
Hi,

I am using an ActiveX created using delphi. It has a font property exposed. The font property is of type IFontDisp in the server(delphi). The font
properties like Size, Bold, Underline etc has both 'Set' and 'Get' methods
when using the activex in a VS6 app.

But when using the activeX in a VS.NET app, the font properties are read
only. The only way that i can set the font properties is by:

MyActiveX.Font = new Font("Arial", 10, FontStyle.Bold)

Subsequently if i need to turn off Bold, i need to again make use of font
constructor like:

MyActiveX.Font = new Font("Arial", 10, FontStyle.Regular)

If the font properties are writable, i can set its properties by:

MyActiveX.Font.Bold = True
MyActiveX.Font.Italics = True

How can i acheive this? i.e. the font property that is exposed from my
activex server (written in delphi) should be both read and write in my
VS.NET client.

Please help!

Thanks in advance.
Amith.

Nov 15 '05 #2

P: n/a
I am trying a technique that I got from another website. (It supposedly
referenced this thread, but I can't see the posts.)

The technique to set the bold property works like this:
TreeNode newNode = new TreeNode("Nodename");

Font oldFont = TreeView.Nodes[0].NodeFont; // <---Error occurs here

newNode.NodeFont = new Font(oldFont, System.Drawing.FontStyle.Bold);

oldFont.Dispose();

But it doesn't work because TreeView.Nodes[0].NodeFont always throws an
"Object reference not set to an instance of an object." error. In
QuickWatch the NodeFont shows an <undefined error>.

What's the secret handshake to get this to work?

Thanks in advance

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:e6****************@TK2MSFTNGP12.phx.gbl...
Amith,

Technically, the font property is both read and write. Its the
properties on the IFontDisp interface that are not read and write. Can you show what the declaration of the IFontDisp interface is (it has to be in an interop assembly of some kind). Perhaps the definition is incorrect.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Amith" <am***@gnostice.com> wrote in message
news:uZ*************@TK2MSFTNGP12.phx.gbl...
Hi,

I am using an ActiveX created using delphi. It has a font property

exposed.
The font property is of type IFontDisp in the server(delphi). The font
properties like Size, Bold, Underline etc has both 'Set' and 'Get' methods when using the activex in a VS6 app.

But when using the activeX in a VS.NET app, the font properties are read
only. The only way that i can set the font properties is by:

MyActiveX.Font = new Font("Arial", 10, FontStyle.Bold)

Subsequently if i need to turn off Bold, i need to again make use of font constructor like:

MyActiveX.Font = new Font("Arial", 10, FontStyle.Regular)

If the font properties are writable, i can set its properties by:

MyActiveX.Font.Bold = True
MyActiveX.Font.Italics = True

How can i acheive this? i.e. the font property that is exposed from my
activex server (written in delphi) should be both read and write in my
VS.NET client.

Please help!

Thanks in advance.
Amith.


Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.