473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Font - Dispose question.

Hello,

If I create a font on my inherited form (sample code below) do I have
to "Dispose" this font.

Thanks,
Rob

Class MyTest
Inherits System.Windows.Forms.Form

Private _font as As System.Drawing.Font

Public Sub New()

Me.InitializeComponent()

Me._font = New System.Drawing.Font(Me.Font.FontFamily, 10,
Drawing.FontStyle.Bold)

End Sub

End Class

Mar 5 '07 #1
4 1907
Rob Panosh wrote:
Hello,

If I create a font on my inherited form (sample code below) do I have
to "Dispose" this font.

Thanks,
Rob

Class MyTest
Inherits System.Windows.Forms.Form

Private _font as As System.Drawing.Font

Public Sub New()

Me.InitializeComponent()

Me._font = New System.Drawing.Font(Me.Font.FontFamily, 10,
Drawing.FontStyle.Bold)

End Sub

End Class
No. As you assign the font to a control, the control will take care of that.

--
Göran Andersson
_____
http://www.guffa.com
Mar 5 '07 #2
Goran,

What if I'm using the font on a tree node? That that make any
difference.

Sample:
-----------
Dim newNode as System.Window.Forms.TreeNode =
me.TreeView1.Nodes.Add("myTest")
newNode.Font = me._font
Thanks,
Rob

Mar 6 '07 #3
Rob Panosh wrote:
Goran,

What if I'm using the font on a tree node? That that make any
difference.

Sample:
-----------
Dim newNode as System.Window.Forms.TreeNode =
me.TreeView1.Nodes.Add("myTest")
newNode.Font = me._font
Thanks,
Rob
The TreeNode class doesn't have a Font property.

--
Göran Andersson
_____
http://www.guffa.com
Mar 6 '07 #4
Sorry I had a typo. The Node does have a font property "NodeFont".

newNode.NodeFont = me._font

Rob

On Mar 6, 10:36 am, Göran Andersson <g...@guffa.comwrote:
Rob Panosh wrote:
Goran,
What if I'm using the font on a tree node? That that make any
difference.
Sample:
-----------
Dim newNode as System.Window.Forms.TreeNode =
me.TreeView1.Nodes.Add("myTest")
newNode.Font = me._font
Thanks,
Rob

The TreeNode class doesn't have a Font property.

--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -

- Show quoted text -

Mar 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Barry Anderberg | last post by:
I'm using the .NET Memory Profiler by Sci Tech and I wrote a little test application to verify something odd I observed and it appears that System.Drawing.Font fails to dispose of its FontFamily. ...
4
by: Eric Eggermann | last post by:
Hello all, I'm building an app that lays out and prints flash cards. Now the card might be any size, but when the user is working on the card, I draw the preview isotropically, as large as...
2
by: Amith | last post by:
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...
0
by: Martin Streller | last post by:
Hello, The code below represents a simple ownerdrawn, Listview class in C#. Its purpose is to avoid the flicker of the MS ListView. So I can't fall back to their one. Does anybody know why I...
2
by: Stuart Norris | last post by:
Dear Group, I am new to c# and windows form designer - coming from a Motif background. I am attempting to develop an application for a touch screen and I need to have a menu system with a...
5
by: localhost | last post by:
I have a custom TrueType .ttf font in the filesystem (not installed) on the web server. I want to take the letter "A" from this font, render it as an image, and return that as a byte stream in...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
156
by: Dennis | last post by:
Ok, I'm trying to dispose of every object that I create that has a dispose method based on advice from this newsgroup. However, I'm not sure how to dispose of the following object that was created...
3
by: al jones | last post by:
Okay, last go 'round for today. I'm looking at the msdn for private font collections. If I add a font to work with - let's presume I'm printing a single line in a particular font and won't use it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.