[dba-VB] use a font in a class

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Sat Dec 4 16:55:34 CST 2010


John  --

You can use:

 Font font = new Font(this.Font, FontStyle.Bold);    

Ignore my prev. posting in this thread.

Thank you.

--
Shamil
 
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: 5 ??????? 2010 ?. 1:27
To: VBA
Subject: [dba-VB] use a font in a class

I am defining a system for displaying a status on a form.  We have a
listview object, in which we create three columns, then push stuff into the
list using the following coed:

private void UpdateStage1Status(StatusEventArgs stEvArgs) {
      Font bold = new Font(Font, FontStyle.Bold);     //to make the font
bold
      ListViewItem item;
      item = lstvStatus.Items.Add("",stEvArgs.pImageIndex);       //The
image to display for the row
      //item.BackColor = stEvArgs.pColor;
      item.UseItemStyleForSubItems = false;       //need to set this to
allow changing font color
      item.SubItems.Add(stEvArgs.pDte.ToString());        //date
      item.SubItems.Add(stEvArgs.pObjectPath);            //object path
      item.SubItems.Add(stEvArgs.pStatus, Color.Black, Color.White, bold);
//status text
         }

Now I want to wrap the list and this code in a class so that I do not have
to have all this (and
other) stuff in the form.

The problem is that the line

     Font bold = new Font(Font, FontStyle.Bold);     //to make the font bold

won't compile in a class.  It complains that

Font bold = new Font(Font

That last class is bad (can't be inherited).  AFAICT (just a guess) that
Font reference only works in a form.

Is there any way other than passing the font in to this method to us the
code as written (in a class)?

--
John W. Colby
www.ColbyConsulting.com
_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list