[dba-VB] use a font in a class

jwcolby jwcolby at colbyconsulting.com
Sat Dec 4 17:25:25 CST 2010


Yes, to set the font for a specific column.

 > Note that you have

 > new Font(Font,

Yes, I know.  I didn't write the code, but if I try to mod that part (for ecample lowercase the 
first letter) it won't compile.

John W. Colby
www.ColbyConsulting.com

On 12/4/2010 5:52 PM, Shamil Salakhetdinov wrote:
> Hi John --
>
> What is that for:
>
>        Font bold = new Font(Font, FontStyle.Bold);     //to make the font
> bold
>
> ?
>
> Note that you have
>
> new Font(Font, ...
>
>
> 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
>
> _______________________________________________
> 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