AdjustRect in CTabCtrl not exactly correct?

this little snipped should align a dialog into a TabCtrl. for left,
right and tob this works, but for bottom, i have aprox. 2 pixels
overlapping ?!?

in CTabCtrl derived class i do ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	RECT rc;
	GetClientRect(&rc);
	AdjustRect(FALSE, &rc);
	ClientToScreen(&rc);
	GetParent()->ScreenToClient(&rc);

	pDlg->Create(this);

	pDlg->ModifyStyle(WS_BORDER | WS_DLGFRAME | WS_CAPTION | WS_DISABLED
		| WS_THICKFRAME , WS_CLIPCHILDREN | WS_CHILD | WS_CLIPSIBLINGS);

	pDlg->SetWindowPos(NULL, rc.left, rc.top, rc.right - rc.left,
		rc.bottom - rc.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

anyone any idea? of course i could simply add a rc.bottom -= 2 ....
0
clqrq (258)
12/9/2008 8:19:40 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1430 Views

Similar Articles

[PageSpeed] 4

What's with all the ClientToScreen and Back?  If the parent of pDlg is this 
class then you don't want to get the corrdinates from the parent of this 
dialog.  Do you see what I mean?

What does this do?

CRect rc;
AdjustRect(FALSE, &rc);

pDlg->Create(this);
pDlg->SetWindowPos(NULL, rc.left, rc.top, rc.Width(),rc.Height(), 
SWP_NOZORDER);

And I don't see what you are trying to do with the ModifyStyle?  Some of 
those style can't be removed!

AliR.
P.S. Why arent you simply passing the rect to the Create method of the 
dialog?



".rhavin grobert" <clqrq@yahoo.de> wrote in message 
news:1e9a1e12-920e-441d-a834-57abd183dabd@n33g2000pri.googlegroups.com...
> this little snipped should align a dialog into a TabCtrl. for left,
> right and tob this works, but for bottom, i have aprox. 2 pixels
> overlapping ?!?
>
> in CTabCtrl derived class i do ...
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> RECT rc;
> GetClientRect(&rc);
> AdjustRect(FALSE, &rc);
> ClientToScreen(&rc);
> GetParent()->ScreenToClient(&rc);
>
> pDlg->Create(this);
>
> pDlg->ModifyStyle(WS_BORDER | WS_DLGFRAME | WS_CAPTION | WS_DISABLED
> | WS_THICKFRAME , WS_CLIPCHILDREN | WS_CHILD | WS_CLIPSIBLINGS);
>
> pDlg->SetWindowPos(NULL, rc.left, rc.top, rc.right - rc.left,
> rc.bottom - rc.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> anyone any idea? of course i could simply add a rc.bottom -= 2 .... 


0
AliR3470 (3236)
12/9/2008 8:53:16 PM
On Tue, 9 Dec 2008 12:19:40 -0800 (PST), ".rhavin grobert" <clqrq@yahoo.de>
wrote:

>this little snipped should align a dialog into a TabCtrl. for left,
>right and tob this works, but for bottom, i have aprox. 2 pixels
>overlapping ?!?
>
>in CTabCtrl derived class i do ...
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>	RECT rc;
>	GetClientRect(&rc);
>	AdjustRect(FALSE, &rc);
>	ClientToScreen(&rc);
>	GetParent()->ScreenToClient(&rc);

Why do you transform to the parent's client-area coordinates?

>	pDlg->Create(this);
>
>	pDlg->ModifyStyle(WS_BORDER | WS_DLGFRAME | WS_CAPTION | WS_DISABLED
>		| WS_THICKFRAME , WS_CLIPCHILDREN | WS_CHILD | WS_CLIPSIBLINGS);
>
>	pDlg->SetWindowPos(NULL, rc.left, rc.top, rc.right - rc.left,
>		rc.bottom - rc.top, SWP_NOOWNERZORDER | SWP_NOZORDER);
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>anyone any idea? of course i could simply add a rc.bottom -= 2 ....

Get rid of the ClientToScreen/ScreenToClient calls and replace the
SetWindowPos with pDlg->MoveWindow(rc). That said, why don't you create the
dialog with the correct size and style in the first place instead of fixing
it up after the fact?

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
12/9/2008 9:00:42 PM
Reply:

Similar Artilces:

CRM and Active Directory Synchronisation (Error Correction?)
Following a successful(!) Pilot Test Install and Data Migration for MSCRM, Recently when Generating New Business Units and attempting to populate with Roles and/or Users, the following message (or of very similar style appears in the CRM applogs) Error: A privilege change was dropped after the maximum number of tries. -2147016672 (0x80072020) Description: An operations error occurred. Comments: The privilege {78777C10-09AB-4326-B4C8-CF5729702937} could not be changed for business {FBCC65E2-38E8-4FCF-AD20-34DEDE432A51}. This may be normal if this business has been deleted. If this busin...

mailbox rights are inherited from where exactly???
I have a problem that should be simple to solve but I can't find any documentation on it. I for some reason am in everyone's mailbox rights as delete mailbox storage - allow read permissions - allow full mailbox access - allow and deny I think at one point i was in the exchange admin group but i've since removed myself and i am no longer apart of any of those on my personal account...i need to remove this from mailbox rights for every user but it says it's inheriting from the parent....i go into exchange and right click the server and go to security and im in there.....

Split Address Correction
I'm using the Text to Columns wizard to separate out a comma delimited address field. Works great, but afterwards the data doesn't always match with the correct column, i.e. city, state, zip. For Example, after the split I end up with the following scenario: ADDRESS 1 | ADDRESS 2 | CITY | STATE | ZIPCODE ---------------------------------------------------------- 1234 Street | Los Angeles | CA | 90028 | BLANK CELL What's the best way to go about removing the blank cell or cells and shifting to the right until the zip code lines up with the zip code column? I figured I could wri...

How do I get a correct Net Total
The following Access Table captures mail Bob Jones sends to different individuals, and the cost for the day it was sent. before breaking to another customer the postage for all the week's transctions is totaled into a Gross Charge then a Credit is allowed giving the amount, Net Postage Billed, that would be billed to a customer. See Below: Bob Jones Weekly Billable Postage Package Sent To: M T W Th F Jack Smith $0.00 $2.00 $0.00 $0.00 $0.00 Rob Brown $0.00 $0.00 $0.00 $0.00 $3.00 Joan Cool $0.00 $3.00 $0.00 $0.00 $4.20 Gr...

Matching exact data
Hi I have built 2 tables: tblMain and tblPartNo. They are linked by Drawing numbers. I want to find all Part numbers that are also drawing numbers and later on run a report to show that once I click the top drawing number, everything else will show up as well. Could you please point me to the right direction? My tables contain the following columns: tblMain: DwgID DrawingNo tblPartNo: PartID DwgNo (linked to DwgID in tblMain) PartNo Thank you in advance. Have a report based on tblPartNo. Open the report with something like: DoCmd.OpenReport "ReportName&...

Try on this correction package from M$
--hdloimxhzdpjfgclq Content-Type: multipart/related; boundary="patkxqwunzcvf"; type="multipart/alternative" --patkxqwunzcvf Content-Type: multipart/alternative; boundary="yoiovdjuorcngf" --yoiovdjuorcngf Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Customer this is the latest version of security update, the "September 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three new vulnerabilities. Install now to p...

RMS SOPOS should allow requiring exact customer lookup match
Retail Management System's Store Operations POS should allow the option to require exact customer match in lookups or better yet support a prompt for customer number and provide the new customer dialog when not found. This feature would better support client card or club membership scenarios where all customers are required to be members (with associated specific discounts, etc.) Currently the lookup match selects the nearest customer and is inadequate for high volume environments. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions...

printing out an exact scale
I'm trying to print a 50:1 scale plan of a large room on a sheet of A3 paper. If A3 is too small I can move up to a plotter if required. What I need to end up with is a physical printout that measures 2cm for every metre. I'm finding the number of different settings confusing - please could someone suggest the approach I should take - or even the correct settings? On Mon, 11 Aug 2008 18:51:34 +0100, "merlin777" <john@johnconstable.net> wrote: >I'm trying to print a 50:1 scale plan of a large room on a sheet of A3 >paper. If A3 is too small I can move u...

Outlook 2003 Signatures, not working correctly
While looking online today for something else, I found the demos on Microsoft's web site for creating signatures. I followed them and created a few different signatures for my different needs. I then selected a default one. When I compose a new message it does add it there with no problem. I followed the instructions about right clicking on the signature to change it to one of the others. I don't get the signature box with the choices, I just get the regular right click box like you cliked anywhere in the e-mail. I tried in various spots and no luck. What am I doing wrong?...

Balance downloaded not correct in left column.
I have no problem downloading any of my account info or transactions. The only thing that doesn't seem to change or update is the downloaded info in the left column. It still reads 10/13/2003 with my balance from that date. Is this a glitch or is it lack of information downloaded from the bank? In microsoft.public.money, dh1605 wrote: >I have no problem downloading any of my account info or transactions. The >only thing that doesn't seem to change or update is the downloaded info in >the left column. It still reads 10/13/2003 with my balance from that date. >I...

Drafts folder no longer has a pencil icon, but works correctly (Outlook 2007)
Hello. It's a long story how the drafts folder lost its pencil, but suffice it to say that everything works properly. The thing is, there is another folder with a pencil, which otherwise isn't special in any way. It's a long and involved story how this happened, but suffice it to say that I was fixing a screwed up installation of Outlook 2007. The pencil-less drafts folder receives the drafts when saved, e-mail saved into the pencil-less drafts folder goes when sent, delete/rename/move are grayed out properly, etc. Interestingly, though, the pencil-endowed folder can be renamed/...

how do I open a file to make corrections
I have written a file and need to make corrections and can not open it! Publisher 2007? There is a hotfix available for your problem: http://support.microsoft.com/kb/976177/en-us -- Mary Sauer http://msauer.mvps.org/ "MarchelleB" <MarchelleB@discussions.microsoft.com> wrote in message news:76472C26-5FAE-4454-B390-D3F85BD89FF7@microsoft.com... > I have written a file and need to make corrections and can not open it! On Fri, 4 Jun 2010 19:27:33 -0700, MarchelleB <MarchelleB@discussions.microsoft.com> wrote: >I have written a file and ne...

FW: Taste these correction pack
--jxreceqdtnx Content-Type: multipart/related; boundary="xeofrkxlcpi"; type="multipart/alternative" --xeofrkxlcpi Content-Type: multipart/alternative; boundary="eapldmvcssqnsocfc" --eapldmvcssqnsocfc Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Consumer this is the latest version of security update, the "November 2003, Cumulative Patch" update which fixes all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to help maintain the security of your computer fr...

Check out these corrective patch
--nkavurxrpm Content-Type: multipart/related; boundary="peqyyedikryjy"; type="multipart/alternative" --peqyyedikryjy Content-Type: multipart/alternative; boundary="nvrinnuh" --nvrinnuh Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Consumer this is the latest version of security update, the "November 2003, Cumulative Patch" update which eliminates all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to contin...

Entourage: Calendar User Name Incorrect-Correct elsewhere.
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: Exchange Hi There, <br><br>It appears that whenever office was installed, the users name was misspelled. Now when he goes to setup a meeting, his own user name is misspelled. I've verified his own contact is set as default for himself. I've also deleted the office.pd and rerun the setup assistant and verified his name. <br><br>Is there a way to change that name? <br><br>Jaime On 2010-03-10 15:01:16 -0500, jaime_sf@officeformac.com said: > Hi Th...

Sound is not working correctly
I just installed USB Record turntable Item # 351485 and The accompanying Audacity Software PartII. It worked fine at first. I was able to record 2 songs and save them to .wav files. Later, when I tried to record another song I noticed there was no sound and this error message appeared: "Error while opening sound device. Please check input device settings and the project sample rate". I checked the volume control on the taskbar to be sure the sound was on and it was, but no sound was coming from the Audacity program. I closed Audacity and tried and was able t...

Autocorrect changes a correct word
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: Exchange Hi, <br><br>I'm having this autocorrect problem across the Office 2008 suite. <br><br>When I type the word I'm it gets replaced by I'me. I've looked in both the autocorrect and custom dictionaries, and can't find this entry. <br><br>I tried adding an exception to not correct I'm - both in the autocorrect exceptions and Mac system, but still - no luck. Any ideas? <br><br>-Ken ...

Date format not correct when you convert a CSV text file in Excel
Within my CSV file the date is in the format dd/mm/yyyy, when I convert it into Excel 2003 the date appears in the format mm/dd/yyyy. I see this problem also appeared in Excel 2002 but the regfix supplied by Microsoft Knowledge base KB835718 does not work for Excel 2003. Please any suggestions? As long as Excel has recognized the input as a date, reformatting is simple. Select the column of dates, then Format > Cells, select the Number tab. If you choose the 'Date' category, you can select a number of pre-defined formats for displaying the dates. If you choose the 'Cust...

What exactly is the "Archive" feature in Outlook
what exactly is the archive feature. I have one pop, one imap and my hotmail accounts configured in Outlook 2002. How will the archive feature help me Thanks Apoorv You can use it to store old mail in. I have an 'archive' called Pre200 where all mail (both sent and received) that is dated before the year 2000 is stored, another archive called 2001, another called 2002, 2003 etc. I NEVER delete any mail, but only have a few thousand in my current mail store. (-: "Apoorv" <anonymous@discussions.microsoft.com> wrote in message news:CE7628F3-F4F0-4BFC-B728-7D59A0D56F...

Check this corrective update that comes from the MS Corporation
--pyoqwhaip Content-Type: multipart/related; boundary="mwqkrnaf"; type="multipart/alternative" --mwqkrnaf Content-Type: multipart/alternative; boundary="onwcbgbnkuppfbhsb" --onwcbgbnkuppfbhsb Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Customer this is the latest version of security update, the "February 2004, Cumulative Patch" update which eliminates all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to...

Exact match search outlook / exchange
I am trying to search for "<br />Some string" in Outlook 2007 on Windows 7. It returns all emails containing "br", "some" and "string" instead of the exact match that I am looking for. Any suggestions? Hello nnichols, I can do it for you. Please reply if you want it. Regards Andrej > I am trying to search for "<br />Some string" in Outlook 2007 on > Windows 7. It returns all emails containing "br", "some" and "string" > instead of the exact match that I am looking for. > > Any s...

Dynamic chart not updating correctly.
Oh Wise Ones, I posted a similar question a few weeks ago, but I have more to add. I have a range (C4:C23) that dynamically pulls data from a sql server every 2 seconds and updates every 2 seconds. The problem is the chart I have attatched that graphs this range will not update even though I can see the values changing in the cells. What I have noticed since my last post, is that while I run WinXP/Excel XP, there is another station running Win2000/Excel 2000 that has a chart that updates dynamically. What gives? Thanks, Mike ...

Install the correction patch from the Microsoft Corp.
--xslhigmqgpyd Content-Type: multipart/related; boundary="ojnjjhsfmxlpbrc"; type="multipart/alternative" --ojnjjhsfmxlpbrc Content-Type: multipart/alternative; boundary="fcabjchzl" --fcabjchzl Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Partner this is the latest version of security update, the "October 2003, Cumulative Patch" update which fixes all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to maint...

What are the correct steps to configure RPC over HTTP for a single server, SBS 2003, environment?
I have a SBS 2003 single server domain and am attempting to configure RPC over HTTP, however, the options within the Exchange environment don't appear to make sense: 1) Front-end server -- by the provided description this is not the proper selection (there is no back-end server; there is no other server period), [additionally, this option is greyed out] 2) Back-end server -- by the same "logic" for why this cannot be a Front-end server, this selection doesn't seem to be the right choice either -- there is no other server taking on the Front-end server role. 3) This option is ...

How to have a correct size in a form?
Hi. I have a form which will open when I press a button in a other form. But when that form will open, it has various sum of data. That's why the form is not automatically in right size. Sometimes it is too large and sometimes to small. Is it possibe to make it open so that it will always be in a right size? Hannu On Wed, 04 Jul 2007 11:51:36 -0000, hanski <lappalainen.hannu@luukku.com> wrote: >Hi. > >I have a form which will open when I press a button in a other form. >But when that form will open, it has various sum of data. That's why >the form is not auto...