473,668 Members | 2,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to get minimum width of a column in a DBGrid

Hi,

If you doubleclick on a dbgrid title separator the column automticly resize
to his minumum width. How to do this in code ?

--
rgds, Wilfried
http://www.mestdagh.biz
Nov 17 '05 #1
1 1598
Wilfried Mestdagh schrieb:
Hi,

If you doubleclick on a dbgrid title separator the column automticly resize
to his minumum width. How to do this in code ?


Hi,

what would you like to do in code? Double-click on column or resize
column? If you want to resize the col. to its minimum, you can go
through all values in this col. and use the Graphics.Measur eString
method to determin the size of the current string in col and get the
minimum of all values. This is the min. size of the col. The "size" of
the string depends on the used font. So you need also to get the used
font of the col.

string measureString = "Measure String";
Font stringFont = new Font("Arial", 16);

SizeF stringSize = new SizeF();
stringSize = e.Graphics.Meas ureString(measu reString,
stringFont);
With regards,

Andy
Nov 17 '05 #2

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

Similar topics

2
2323
by: Hennie de Nooijer | last post by:
Because of an error in google or underlying site i can reply on my own issue. Therefore i copied the former entered message in this message. -------------------------------------REPY---------------------------------- Hi Maybe i wasn't clear. I want to dynamically check whether what the lowest date and the highest date is in the calendar table. The presented solutions has fixed dates and i don't want that. If i could store a global...
4
6147
by: Alex Meier | last post by:
I have the following problem: I need a simple, tabular layout in a webshop. - left column: navigation column with approx. 170px width - right column: content area the goal: the left column should contain a few "boxes" (these are HTML- tables) which should be all of the same width. So, I attributed the left column with 'width="170"' and assigned the attribute 'width="100%"' to all contained <table>s. This should
4
1956
by: Ramtin | last post by:
Hi I have a DBGrid which returns some Arabic data .The charset of web page is utf-8 and anything on page is OK except DBGrid header titles . I set these titles through DBGrid Property Builder , but on web page they can not be readable. What is problem? Thanks K.Ramtin
0
1409
by: Ramtin | last post by:
Hi I have a DBGrid which returns some Arabic data .The charset of web page is utf-8 and anything on page is OK except DBGrid header titles . I set these titles through DBGrid Property Builder , but on web page they can not be readable. What is problem? Thanks K.Ramtin
0
1474
by: basha | last post by:
hi friends, I am usieng Dbgrid in my asp.net project, my requirement is in dbgrid i am displaying 10 records per page and i place one button on a webform for each record i am generating one checkbox, that i place in template of dbgrid, when the user select checkboxs of rows all the rows should be deleted (I am displaying date in dbgrid from oracle database) for that i am not getting code, pls can u help me i have dead line now i am...
1
972
by: Vincent | last post by:
Hi, I want to know how to set the width of columns in edit mode. since the width of columns(integer) increase from 50 px to 200 px automatically in edit mode and it is not user friendly. vincent
3
2896
by: nano9 | last post by:
Hola gente quisiera que alguien me pudiera ayudar con un problemilla que tengo, resulta que estoy programando en ASP con C# y estoy usando un cadbgrid que se comporta parecido a un datagrid o dbgrid pero tiene otras peculiaridades ahi que facilitan muchas tareas. Si alguno ha usado este control talvez me podria ayudar. El asunto esta asi, estoy queriendo agregar un mensaje en una etiqueta debajo del grid para indicar la cantidad de items...
2
1587
by: nano9 | last post by:
Hi. Maybe someone can help me with a small problem. I am programming in ASP using C# and I am using a cadbgrid which acts similar to a datagrid or dbgrid but it has some peculiarities that make for a lot of work. If anyone has used this control maybe you can help me. The problem is this: I want to put together a message below the grid to indicate the number of items shown on a page, the item totals and the page number. The message...
2
3924
by: cshaw | last post by:
Hello Everyone, I am having problems with a listbox control. I have a page with a couple of labels and drop-down lists at the top, and then below there is a table with two columns, the first column contains a listbox and the second column contains some buttons. I am trying to display it such that if the listbox is empty it will be at least 100px wide, but if there is content in the box I want it to expand dynamically such that if the...
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8791
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8653
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7398
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2786
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.