Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Colwidth and Characters


Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2003, 06:49 AM
VeRiTo's Avatar
VeRiTo VeRiTo is offline
Contributor
 
Join Date: Nov 2003
Location: Buenos Aires
Posts: 614
Question Colwidth and Characters


Hi people! I have a mshflexgrid control and i want to know how to relate colwidth with amount of characters that fit there! Any idea? Thank´s!
__________________
.:.VeRiTo.:.
Reply With Quote
  #2  
Old 11-27-2003, 07:08 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,884
Default

Use the TextWidth() method of the current Form.

For more sizing examples have a look at the FlexGrid Functions in the Code Library
Reply With Quote
  #3  
Old 11-27-2003, 07:32 AM
VeRiTo's Avatar
VeRiTo VeRiTo is offline
Contributor
 
Join Date: Nov 2003
Location: Buenos Aires
Posts: 614
Default

Thanks FlyGuy!!!
But i have another problem, textWidth depends on the font size. I use always the same font but i have to use textwidth function in a class (in a dll), what can i do?
__________________
.:.VeRiTo.:.
Reply With Quote
  #4  
Old 11-27-2003, 07:42 AM
Volte's Avatar
Volte Volte is offline
Ultimate Contributor

Retired Leader
* Guru *
 
Join Date: Aug 2001
Posts: 5,343
Default

Use the GetTextExtentPoint32 API. If you want to be able to specify the font and whatnot, look also at the following APIs:

CreateCompatibleDC
CreateFont
SelectObject
DeleteObject (this one is very very important)

There's probably an example out there (maybe PlanetSourceCode.com) of using this API, so take a look around.
Reply With Quote
  #5  
Old 11-27-2003, 07:48 AM
VeRiTo's Avatar
VeRiTo VeRiTo is offline
Contributor
 
Join Date: Nov 2003
Location: Buenos Aires
Posts: 614
Default

I will check this out! Thank´s both!
__________________
.:.VeRiTo.:.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->