Window Size of CStatic Control

Using the dialog editor I created a static text object 100 wide and 10 deep. 
Then I attached it to a CStatic member of my CDialog class using 
DDX_Control(). Now, when I call GetClientRect() from my CStatic member, the 
windo rectangle is 150 wide and 15 deep. What controls the conversion? 
0
AVee (83)
10/9/2006 11:21:01 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
762 Views

Similar Articles

[PageSpeed] 6

AVee wrote:
> Using the dialog editor I created a static text object 100 wide and 10 deep. 
> Then I attached it to a CStatic member of my CDialog class using 
> DDX_Control(). Now, when I call GetClientRect() from my CStatic member, the 
> windo rectangle is 150 wide and 15 deep. What controls the conversion? 

Dialogs and controls are designed in "dialog units" in the resource 
editor.  Conversion to pixel sizes is done at runtime and is dependent 
on the system font size (DPI setting in control panel), and screen 
resolution.  I.e. people with bigger fonts selected get bigger buttons.

For more info look up GetDialogBaseUnits and MapDialogRect.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
10/10/2006 1:16:17 AM
> Using the dialog editor I created a static text object 100 wide and 10 deep.
> Then I attached it to a CStatic member of my CDialog class using
> DDX_Control(). Now, when I call GetClientRect() from my CStatic member, the
> windo rectangle is 150 wide and 15 deep. What controls the conversion?

In addition to Scott's suggestion, you can use SetWindowPos to change
its size at runtime. Typically you will set the size in resource editor
because you can see the text as it appears in resource editor.

---
Ajay

0
ajaykalra (6842)
10/10/2006 2:23:38 AM
Thank you, Scott. This is exactly the information that I needed.

"Scott McPhillips [MVP]" wrote:

> AVee wrote:
> > Using the dialog editor I created a static text object 100 wide and 10 deep. 
> > Then I attached it to a CStatic member of my CDialog class using 
> > DDX_Control(). Now, when I call GetClientRect() from my CStatic member, the 
> > windo rectangle is 150 wide and 15 deep. What controls the conversion? 
> 
> Dialogs and controls are designed in "dialog units" in the resource 
> editor.  Conversion to pixel sizes is done at runtime and is dependent 
> on the system font size (DPI setting in control panel), and screen 
> resolution.  I.e. people with bigger fonts selected get bigger buttons.
> 
> For more info look up GetDialogBaseUnits and MapDialogRect.
> 
> -- 
> Scott McPhillips [VC++ MVP]
> 
> 
0
AVee (83)
10/10/2006 4:38:02 PM
Thank you, Ajay. This is also helpful.

"Ajay Kalra" wrote:

> > Using the dialog editor I created a static text object 100 wide and 10 deep.
> > Then I attached it to a CStatic member of my CDialog class using
> > DDX_Control(). Now, when I call GetClientRect() from my CStatic member, the
> > windo rectangle is 150 wide and 15 deep. What controls the conversion?
> 
> In addition to Scott's suggestion, you can use SetWindowPos to change
> its size at runtime. Typically you will set the size in resource editor
> because you can see the text as it appears in resource editor.
> 
> ---
> Ajay
> 
> 
0
AVee (83)
10/10/2006 4:39:01 PM
Reply:

Similar Artilces:

control charts #2
Might some direct me to some good examples of control charts and or directions for creating. I have been asked to get up to speed on them and this is somehting new for me. Thanks Jon Peltier has information on creating them in EXCEL, http://www.peltiertech.com/Excel/Charts/statscharts.html I'd suggest you do some reading on control charts from other sites. There should be something here that could help you. http://www.isixsigma.com/st/control_charts/ "Todd F." wrote: > Might some direct me to some good examples of control charts and or > directions for creatin...

Checkbox event to control other checkbox selections
I have been working for a couple of hours now trying different ways to solve this problem and I'm out of ideas (or tired). :-/ Here's what I'm trying to do: On a form I have a section with six checkboxes that represent 6 different mailing lists an organization can subscribe to: MailList01, MailList02, etc. I have a seventh checkbox named MailListOmit for orgs that want to opt out of mailings. If MailListOmit is checked, when the user attempts to click any one of the MailList checkboxes, I want to return a dialog box that says, "This organization has chosen to not receive ma...

attachment/email size limits
This is somewhat of a poll for the admins out there. In general, for those who admin exchange servers with multiple clients, (and or sites). Do you limit email size or attachment sizes? And if so, what is your limit set to? (I'm not refering to inbox or account size limits, I'm referring to the size of individual emails). Currently our company has no limit on what can be sent or received. Although most of our outside recipients that we email with on a regular basis do have limits. Most range from the 3 to 5 meg range. 40MB for incoming, 15MB for outgoing. Jayjay wrote: ...

80070490 Error: Windows update encountered an unknown error 03-04-10
3 security updates will not complete (now 4). Error Code 80070490 02-Mar-10 I am unable to do these three security updates: KB970238(release date 6/9/09), KB97451(release date 10/13/09), KB954155(release date 10/13/09), & KB975517(release date 10/13/09). The last succesful update was KB9937286 on 2/27/2010 I have a Compaq Presario PC: SR5214X. OS Name Microsoft® Windows Vista™ Home Basic Version 6.0.6002 Service Pack 2 Build 6002 OS Manufacturer Microsoft Corporation System Manufacturer Compaq-Presario System Model GV441AA-ABA SR5214X System Type X86-based PC ...

ActiveX control
I have a ActiveX control that I got which prints barcodes, but I am unsure exactly how to use an ActiveX control from my MFC program. I inserted it onto my may main form, created a member variable, but for some reason I am unable to get to the Value property that it is supposed to have. I have never really used an activeX control before and I was wondering if someone could tell me how to include it in my program. Roger Nevermind, I figured out how to use the SetValue property. Roger "R.H." <rogerh40@mindspring.com> wrote in message news:%23y%238fFZWDHA.2272@TK2...

limit create window/control max count?
Hi all. I am testing a create control. But I want create many control (more 10000) in dialog. I test dynamic create CButton. It's created about 9800. I want work. 1. have a two dialog.(A, B) 2. A dialog has 40 controls(Button, Spin, static). 3. B dialog has contain A dialog. A dialog is more than 200. 4. create A dialog dynamic.(Using A->Create(IDD, this)) and attach B dialog. A dialog is modaless. 5. But not create about 190. dialog create function return 0. thank for read. Have a nice day. You need to redesign your system, IMO. -- - Mark Randall http://zetech.swehli.com...

Money 2007 H & B + Windows Vista
Hello, I have read a lot about problems with installing and using Money (2007) on machines running Windows Vista. Is there some kind of "manual" how to go about the install procedure? A manual that describes where to have the program installed installed and where to keep the data? And a manual that describes how to keep the rights as an administrator as you would normally have under windows XP? And maybe there are some other issues that I haven't thought about. Thanks, Eric "Eric" <nomail@hotmail.com> wrote in message news:468fe69d$0$37724$5fc3050@dre...

Bug with controls location and scrollbars in a Windows Form
Hi, I've noticed a bug with WinForm and scrollbars, and I would like to know if there is a workaround ... Bug description : ------------------------ 1) create a win form, and add 3 buttons : * FirstButton : upper left corner of the winform * SecondButton : location = (0 ; 600) * ThirdButton : location = (100, 600) 2) Set : ThirdButton.Visible = false 3) Set the Form size to 100 x 100 ... and set : AutoScroll = true 4) Add the following event handler to the Click event of FirstButton and SecondButton ... private vo...

Custom Controls 10-16-04
Hi, I would like to create a custom control .ascx and I'd like to konow how can I put it on a standard CRM form (for example Accounts) Thanks in advance Zsolt There is not a supported way to do this on the standard forms themselves. The closest supported method wuld be to add a new Tab on the left of the page via teh ISV.Confi and have that display your control. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On Sat, 16 Oct 2004 01:19:06 -0700, Zsolt Z�mbik <zombikzs@titanium-consulting.net> wrote: Hi, I would ...

Wrap to Window
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) In draft view, I'd like the text to wrap to the window size rather than the document's margins. Is this feature part of Word for Mac? It's easily done in the PC version. Thanks, Robin Hi Robin - Word> Preferences> View - check the box for Wrap text to window. HTH |:>) Bob Jones [MVP] Office:Mac On 4/12/08 10:20 AM, in article ee98414.-1@webcrossing.caR9absDaxw, "Robin@officeformac.com" <Robin@officeformac.com> wrote: > Version: 2008 > Operating System: Mac OS X 10.5 (Leopard) > &g...

close all windows
is there any way to get access to close all the open windows usingVBA, without having to define all the open windows. many thanks michael Dim frm as FormFor each frm in Forms Docmd.Closenext frmOn Mar 20, 10:15 am, Wayne-I-M <Wayn...@discussions.microsoft.com>wrote:> DoCmd.Quit>> --> Wayne> Manchester, England.>>>> "michael goodall" wrote:> > is there any way to get access to close all the open windows using> > VBA, without having to define all the open windows. many thanks michael- Hide quoted text ->> - Show quoted text -...

text size in reading pane
Where is the font selection / text size control for the Outlook 2003 reading pane (incoming emails)? I just bought a brand new dell with windows xp and all and I can't even increase the text size of incoming emails as I could with older versions of Outlook Express. I have been trying to figure this out for around 15 hours now and have come up empty. What kind of progress is this anyway???? A program rendered unable to accomplish such a simple practical thing like that!! Im very upset. My vision is poor. Unless I get an answer soon, I am considering a return of this unit to dell...

Calling a checkbox control with VB
Hi Is there a way I can reference a checkbox item that I can manipulate in VBA. For instance... I have a series of check boxes that I would like to change the properties of with a loop So my checkboxes are called: CheckBox1 CheckBox2 CheckBox3 etc and I want to be able to reference them like so: For i = 1 to 20 "CheckBox" & i.Value = true next i Any ideas? By the format of the name, I assume that they are control toolbox checkboxes. Dim oOLE As Object For Each oOLE In ActiveSheet.OLEObjects If TypeName(oOLE.Object) = "CheckBox" Then ...

priv1.edb has suddenly grown double size?
Hello, hope you can help. Yesterday our exchange 2003 suddenly broke down. I looked in the eventviewer and it told that the database has reached its maximum size 16Gb. This couldn't be true? I have 70 users and their maximum mailbox size are 150Mb each. This could maximum be 10,5Gb. I ofte check the database size and recently it was 7Gb. But - yes the priv1.edb was 15Gb and there was 1800 .log files, which together was 10Gb. WHAT has gone wrong? I called MS tech support, and they advised me to apply Exchange SP2. I did and then it was possible to mount the IS again. Thats great...

Client Size
Hello folks. When called from CDialogBar::OnCreate(), GetClientRect() is not returning the size of the CDialogBar as it would when called from CDialogBar::OnEraseBkgnd(CDC* pDC) with pDC->GetClipBox(); Why and how to get the full width and height of the CDialogBar upon creation ? The CDialogBar is actually a class I inherited from CDialogBar. In its OnCreate() I'm attempting to create a CTabCtrl which takes the whole width of the bar, but it doesn't work because of the wrong RECT size. The code looks like this: afx_msg int Toolbar::OnCreate(LPCREATESTRUCT lpCs) { if(-1 == TOOLBA...

window client area...
Hi, After getting a pointer to the main window by using AfxGetMainWnd(), how to get the window's client area? I try CalcWindowRect() but it returns huge numbers that don't make sense. Please help. Thanks. Tony Try GetClientRect() -- Cheers Check Abdoul [VC++ MVP] ----------------------------------- "May Young" <tony@srac.com> wrote in message news:3FD6826E.1030603@srac.com... > Hi, > > After getting a pointer to the main window by using AfxGetMainWnd(), how > to get the window's client area? I try CalcWindowRect() but it returns >...

Control toolbox objects
I have created a template that has combo boxes and radio buttons on most rows. When I try and delete the bottom row, the row deletes, but the combo and radio remain. I have tried cutting them and deleting them or moving them, but nothing helps. I have tried in Excel 2003 and 2002. Help. That is because they are not on the worksheet but 'above' it. Select them individually and delete them. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Dan" <anonymous@discussions.microsoft....

PST size #4
I know there's an upper limit on PST size and have been thinking of starting to make my PST files a yearly thing so I'd have 2005.pst at the end of this year and start on 2006.pst next year. Now the thought occurs to me that, maybe, my plan won't work if, in fact, the limit is for the total pst files. So, the question is, is the size limited to the total number of pst files one has or for each pst file individually? On Sun, 18 Sep 2005 14:10:02 -0300, "Tim Scott Mathews" <nospam@nospam.ca> wrote: >I know there's an upper limit on PST size and have ...

how can i present a JPG in a window having cell with the path?
I build a catalog for coins collection with Excel. each row represents a coin (record). in two cells (fields) i have a path to both sides of the coin scanned as a JPG files in the specific directory. i would like the following scenario: when i stand on a specific row (any cell), the relevant images are presented in 2 big windows. when i move to another row, the image automatically changes etc. i would like also to control the size of the window. would appreciate your help, thanks, sam Hi Sam See if this gets you started: Insert an Image1 from the activex coltrols toolbox. S...

Migrating from Novell to Windows 2000 server causes issues with .PST on Win95/98
All: Hopefully someone has seen this before and can provide a clue. We are currently migrating all of our user home directories from Novell 5 servers to Windows 2000 servers. The majority of our clients are XP and Windows 2000 workstations using Outlook 2000. However, there are still a number of clients using Windows 95/98 and Outlook 98. After copying .PST files from the Novell home directory to the Windows 2000 home directory using a Windows XP workstation, users using the Windows 95/98 workstations get an 'access denied error' when attempting to open their .PST folder from the ...

Moving Outlook account to another Windows log-in user account
I currently use 2 different Windows log-in User accounts, and have an email account I access on each of them, 1 for work and 1 for home. I did this because my work environment is wireless. I'm sick of switching back and forth between Windows user accounts to check work email vs. personal email. How do I transfer one Outlook email account to another Windows user account on the same computer. I'm sure I could just add an email account on one or the other, and delete it from the existing User Account, but I'd like to retain all of my existing folders and content. Then I...

Web hyperlinks: default browser and resulting browser window size?
Hi, Am using Excel 97 (I know it is old but I like it!) with Windows XP Pro (SP2). Have a series of web hyperlinks in a worksheet, that load the current chart for a specified chart, from Yahoo Finance. For example: http://chart.finance.yahoo.com/c/1y/c/tls.ax will load the chart for the Australian telco "Telstra". All the links work just fine but have two questions: 1) My default internet browser is Firefox but the links always open Internet Explorer. Is there a way to ensure that Firefox is used? 2) The loaded chart appears in a maximised IE window. Which is a bit silly as t...

skin window
hi, I create a skinnable window. But I have no way to make its menu visible. How do I fix it? thanks hi alan.... how did you make skinnable window? I create a region on a bitmap that is almost a rectangle, then use SetWindowRgn to attach the window. When handling the WM_ERASEBKGND, I bitblt the bitmap to the DC. That's my way. "zek" <zekixx@hotmail.com> wrote in message news:eyt6D0NXDHA.2424@TK2MSFTNGP12.phx.gbl... > hi alan.... > > how did you make skinnable window? > > thanks alan.. "Alan Li" <activeperson@sina.com> wrote in ...

Excel VBA Controls
Since appling Service Pack 3 for Office XP, exisitng spreadsheets and templates do not display Command Buttons or Check Box controls. The controls are there but are not visible. I didn't have that problem after SP3. As a shot in the dark, you might make sure that "hide all" is not selected for Objects under Tools, Options, View. -- Jim Rech Excel MVP "Iain Black" <anonymous@discussions.microsoft.com> wrote in message news:16d9c01c44873$cd307380$a401280a@phx.gbl... | Since appling Service Pack 3 for Office XP, exisitng | spreadsheets and templates do not d...

How do I STOP outlook from opening a New Explorer window on every
When I click on a Link to a Web Page it always opens a New Explorer Everytime. How do I Stop this ?? This is Very annoying & a Pain to keep closing them I agree with Ken. Is there a way to do right click on a link and select "Copy Shortcut" instead of clicking the link to open a new window? Thanks, Ruf Ken in AB <Ken in AB@discussions.microsoft.com> wrote: > When I click on a Link to a Web Page it always opens a New Explorer > Everytime. How do I Stop this ?? > > This is Very annoying & a Pain to keep closing them In IE, click Tools>Internet Optio...