473,404 Members | 2,213 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,404 software developers and data experts.

Column Width for MSFlexGrid

I develop the application which contains MSFlexGrid to display data. When I
try to fill the grid with the text data, I want to adjust the column width
so that the width is adjusted to the maximum pixel width of the column text
data. I have a function to measure the pixel width of the string data,
however, I found that the parameter of the Set_ColWidth() function in
MSFlexGrid is not in pixel unit. How can I convert the pixel unit to the
unit which is using in MSFlexGrid?
Jan 18 '06 #1
1 5074
"Steven" <a@a.com> schrieb:
I develop the application which contains MSFlexGrid to display data. When I
try to fill the grid with the text data, I want to adjust the column width
so that the width is adjusted to the maximum pixel width of the column text
data. I have a function to measure the pixel width of the string data,
however, I found that the parameter of the Set_ColWidth() function in
MSFlexGrid is not in pixel unit. How can I convert the pixel unit to the
unit which is using in MSFlexGrid?


MSFlexGrid uses twips, but .NET uses pixels. You can use the code below to
convert pixels to twips:

\\\
Private m_TwipsPerPixelX As Integer
Private m_TwipsPerPixelY As Integer
....
Using g As Graphics = Me.CreateGraphics()
m_TwipsPerPixelX = 1440 / g.DpiX
m_TwipsPerPixelY = 1440 / g.DpiY
End Using
....
Me.MSFlexGrid1.ColWidth = 100 * m_TwipsPerPixelX
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 18 '06 #2

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

Similar topics

1
by: Gord | last post by:
Hello, Anybody know how to detect when a user drags between columns in a MSHFlexGrid when resizing column width? (Short of setting up a timer event that continuously monitors column width.)...
1
by: Sandy | last post by:
Can someone help me out in setting the Column width. I am using MSFlexgrid ActiveXcontrol in my dialog box and i have declared some set of columns specifying the width but when i scroll my...
1
by: PVS | last post by:
Hi, I am new to VC++ 7.0. I want to use MSFlexGrid in my dialog based MFC project in VC++ 7.0 (in VS ..NET IDE). I added the MSFlexGrid control into my resource editor toolbox and I dragged and...
0
by: Martin K | last post by:
Hello all..thanks for everyone's advice regarding my SHBrowseForFolder API problem, I was able to put together a public class that runs great! But I have another migration headache regarding the...
1
by: schapopa | last post by:
Hi, I have a MSFlexGrid control on the SSTab and now I am trying to make it editable. I got some example on the net that explains how to achive that. So I have a text box that appears over the...
1
by: zoneal | last post by:
Hi, I am involved in the process of migrating vb(6.0) application to vb.net. My application contains only vb controls namely MSFLEXGRID. I want to migrate my application to vb.net completely...
1
by: bashir3180 | last post by:
Hi, all How can I widening MSFlexgrid coloumn so as it display data properly in coloumn. i.e AutoFit option to adjust coloumn text.
5
by: Ishmael | last post by:
Hi Is Been a 3 Yrs Now (I Still trying to do this) Please help me to do this with Visual Basic 6.0 using Msflexgrid Let say you are the Principal . You have 10 educators and 5 class (Grades)...
1
by: MiziaQ | last post by:
How can I sort an MSFlexGrid table by strings by the 10th column in the table ? The table size is increasing as new entries are added. Could you please show some example code ? Thanks
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.