ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
GDI Problems with Win32 . . . (Sdk)
GDI Problems with Win32 . . . // Sdkandon13Dec 26, 1999, 7:22pm
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01BF4FBB.67A7EBC0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable void CAvatarMap::OnPaint()=20 { CPaintDC dc(this); // device context for painting CPaintDC Map(GetDlgItem(IDC_MapControl)); // device context for = painting =20 CRect rect; GetDlgItem(IDC_MapControl)->GetClientRect (&rect); CPoint Center; Center =3D rect.CenterPoint(); Map.SetMapMode(MM_ISOTROPIC); Map.SetViewportExt (rect.Width(), rect.Height()); Map.SetWindowExt (rect.Width(),rect.Height()); // Draws the Axis lines Map.MoveTo (Center.x,rect.top); Map.LineTo (Center.x,rect.bottom); Map.MoveTo (rect.left,Center.y); Map.LineTo (rect.right,Center.y); // Draws the Border Map.MoveTo (rect.left, rect.top); Map.LineTo (rect.left, rect.bottom); Map.MoveTo (rect.right, rect.top); Map.LineTo (rect.right, rect.bottom); Map.MoveTo (rect.left, rect.top); Map.LineTo (rect.right, rect.top); Map.MoveTo (rect.left, rect.bottom); Map.LineTo (rect.right, rect.bottom); // Draws the Avatar Blips POSITION pos; for( pos =3D list.GetHeadPosition(); pos !=3D NULL; ) { CString NextPerson =3D list.GetNext( pos ); char NAME[18]; sprintf(NAME,"%s",NextPerson); CString MyName; MyName.Format("[%s]",aw_string(AW_LOGIN_NAME)); if (NextPerson =3D=3D MyName) Map.SetViewportOrg (rect.Width() / 2, rect.Height() / 2); else { int NS =3D GetNS(NAME); int WE =3D GetWE(NAME); NS -=3D aw_int(AW_MY_X); WE -=3D aw_int(AW_MY_Z); NS *=3D .015; WE *=3D .015; NS *=3D .0001; WE *=3D .0001; if (NS < 0) NS =3D abs(NS); else NS /=3D 2; if (WE < 0) WE =3D abs(WE); else WE /=3D 2; CString Testing; // This = is my problem . . . Testing.Format("NS: %d, EW: %d",NS,WE); // According to this, the = output is alwyas the same MessageBox(Testing); // Is there = anything easily spotable that is wrong with my code above? Map.Ellipse(WE-5,NS-5,WE+5,NS+5); } } =20 CDialog::OnPaint(); } If this code isn't enough, I can send you the entire Visual C++ Project = .. . . I'm new to GDI, so don't laugh at my code :) Thanks, Andon M. Coleman Senior Programmer R&D Nothing, Inc. ------=_NextPart_000_0008_01BF4FBB.67A7EBC0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2722.2800" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial>void CAvatarMap::OnPaint() = <BR>{<BR> CPaintDC=20 dc(this); // device context for painting</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> CPaintDC Map(GetDlgItem(IDC_MapControl)); = // device=20 context for painting<BR> <BR> CRect=20 rect;<BR> GetDlgItem(IDC_MapControl)->GetClientRect=20 (&rect);</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> CPoint Center;<BR> Center =3D=20 rect.CenterPoint();</FONT></DIV> <DIV> </DIV> <DIV><FONT=20 face=3DArial> Map.SetMapMode(MM_ISOTROPIC);<BR> Map.SetViewport= Ext=20 (rect.Width(), rect.Height());<BR> Map.SetWindowExt=20 (rect.Width(),rect.Height());</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> // Draws the Axis = lines<BR> Map.MoveTo=20 (Center.x,rect.top);<BR> Map.LineTo=20 (Center.x,rect.bottom);<BR> Map.MoveTo=20 (rect.left,Center.y);<BR> Map.LineTo = (rect.right,Center.y);</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> // Draws the Border<BR> Map.MoveTo=20 (rect.left, rect.top);<BR> Map.LineTo (rect.left, =20 rect.bottom);<BR> Map.MoveTo (rect.right, = rect.top);<BR> Map.LineTo=20 (rect.right, rect.bottom);<BR> Map.MoveTo (rect.left, =20 rect.top);<BR> Map.LineTo (rect.right, = rect.top);<BR> Map.MoveTo=20 (rect.left, rect.bottom);<BR> Map.LineTo (rect.right,=20 rect.bottom);</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> // Draws the Avatar Blips</FONT></DIV> <DIV><FONT face=3DArial> POSITION pos;<BR> for( pos =3D=20 list.GetHeadPosition(); pos !=3D NULL; = )<BR> {<BR> CString=20 NextPerson =3D list.GetNext( pos );<BR> char=20 NAME[18];<BR> sprintf(NAME,"%s",NextPerson);</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> CString=20 MyName;<BR> MyName.Format("[%s]",aw_string(AW_LOGIN_NAME));</F= ONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> if (NextPerson =3D=3D=20 MyName)<BR> Map.SetViewportOrg (rect.Width() / 2, = rect.Height()=20 / 2);</FONT></DIV> <DIV> </DIV> <DIV><FONT = face=3DArial> else<BR> {<BR> int=20 NS =3D GetNS(NAME);<BR> int WE =3D=20 GetWE(NAME);<BR> NS -=3D = aw_int(AW_MY_X);<BR> WE=20 -=3D aw_int(AW_MY_Z);<BR> NS *=3D = ..015;<BR> WE *=3D=20 ..015;<BR> NS *=3D .0001;<BR> WE *=3D=20 ..0001;</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> if (NS <=20 0)<BR> NS =3D abs(NS);</FONT></DIV> <DIV> </DIV> <DIV><FONT = face=3DArial> else<BR> NS /=3D=20 2;</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> if (WE <=20 0)<BR> WE =3D abs(WE);</FONT></DIV> <DIV> </DIV> <DIV><FONT = face=3DArial> else<BR> WE /=3D=20 2;</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial> CString=20 Testing;  = ; = &= nbsp; //=20 This is my problem . . .<BR> Testing.Format("NS: = %d, EW:=20 %d",NS,WE); // According to this, the output is = alwyas=20 the same<BR> MessageBox(Testing); =20 = =20 = //=20 Is there anything easily spotable that is wrong with my code = above?</FONT></DIV> <DIV> </DIV> <DIV><FONT=20 face=3DArial> Map.Ellipse(WE-5,NS-5,WE+5,NS+5);<BR> = ; }<BR> }<BR> <BR> CDialog::OnPaint();<BR>}</FONT></D= IV> <DIV> </DIV> <DIV><FONT face=3DArial>If this code isn't enough, I can send you the = entire=20 Visual C++ Project . . . I'm new to GDI, so don't laugh at my code=20 :)</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial>Thanks,</FONT></DIV> <DIV><FONT face=3DArial>Andon M. Coleman</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial>Senior Programmer</FONT></DIV> <DIV><FONT face=3DArial>R&D</FONT></DIV> <DIV><BR><FONT face=3DArial>Nothing, Inc.</FONT></DIV></BODY></HTML> ------=_NextPart_000_0008_01BF4FBB.67A7EBC0-- sagamanDec 27, 1999, 12:05am
This is a multi-part message in MIME format.
------=_NextPart_000_000B_01BF4FCB.4A197140 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable That didn't come through very well at all. It might be better as an = attachment. Norm ------=_NextPart_000_000B_01BF4FCB.4A197140 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2722.2800" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>That didn't come through very well at = all. It=20 might be better as an attachment.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Norm</FONT></DIV></BODY></HTML> ------=_NextPart_000_000B_01BF4FCB.4A197140-- andon13Dec 27, 1999, 2:08pm
This is a multi-part message in MIME format.
------=_NextPart_000_01C1_01BF505B.367D71A0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_01C2_01BF505B.367D71A0" ------=_NextPart_001_01C2_01BF505B.367D71A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Let's try this :) [View Quote] Norm ------=_NextPart_001_01C2_01BF505B.367D71A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Let's try this :)</FONT></DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: = 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <DIV>sagaman <<A=20 href=3D"mailto:sagaman at sagatech.com">sagaman at sagatech.com</A>> = wrote in=20 message <A=20 = href=3D"news:3866c96f at server1.Activeworlds.com">news:3866c96f at server1.Act= iveworlds.com</A>...</DIV> <DIV><FONT face=3DArial size=3D2>That didn't come through very well at = all. =20 It might be better as an attachment.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial = size=3D2>Norm</FONT></DIV></BLOCKQUOTE></BODY></HTML> ------=_NextPart_001_01C2_01BF505B.367D71A0-- ------=_NextPart_000_01C1_01BF505B.367D71A0 Content-Type: application/octet-stream; name="AvatarMap.h" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="AvatarMap.h" #if = !defined(AFX_AVATARMAP_H__F56C5C83_BADB_11D3_87A1_00508B09DD0C__INCLUDED_= ) #define AFX_AVATARMAP_H__F56C5C83_BADB_11D3_87A1_00508B09DD0C__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // AvatarMap.h : header file // #include "Resource.h" /////////////////////////////////////////////////////////////////////////= //// // CAvatarMap dialog class CAvatarMap : public CDialog { // Construction public: CAvatarMap(CWnd* pParent =3D NULL); // standard constructor void AvatarList (CStringList* AVList); CStringList list; // Dialog Data //{{AFX_DATA(CAvatarMap) enum { IDD =3D IDD_AvatarMap }; // NOTE: the ClassWizard will add data members here //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CAvatarMap) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: // Generated message map functions //{{AFX_MSG(CAvatarMap) afx_msg void OnLButtonDown(UINT nFlags, CPoint point); virtual BOOL OnInitDialog(); afx_msg void OnPaint(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately = before the previous line. #endif // = !defined(AFX_AVATARMAP_H__F56C5C83_BADB_11D3_87A1_00508B09DD0C__INCLUDED_= ) ------=_NextPart_000_01C1_01BF505B.367D71A0 Content-Type: application/octet-stream; name="AvatarMap.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="AvatarMap.cpp" // AvatarMap.cpp : implementation file // #include "stdafx.h" #include "Ultra BOT.h" #include "AvatarManage.h" #include "AvatarMap.h" #include "Aw.h" #include "ChatMonitor.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] =3D __FILE__; #endif /////////////////////////////////////////////////////////////////////////= //// // CAvatarMap dialog CAvatarMap::CAvatarMap(CWnd* pParent /*=3DNULL*/) : CDialog(CAvatarMap::IDD, pParent) { //{{AFX_DATA_INIT(CAvatarMap) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void CAvatarMap::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAvatarMap) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAvatarMap, CDialog) //{{AFX_MSG_MAP(CAvatarMap) ON_WM_LBUTTONDOWN() ON_WM_PAINT() //}}AFX_MSG_MAP END_MESSAGE_MAP() /////////////////////////////////////////////////////////////////////////= //// // CAvatarMap message handlers void CAvatarMap::OnLButtonDown(UINT nFlags, CPoint point)=20 { } BOOL CAvatarMap::OnInitDialog()=20 { CDialog::OnInitDialog(); return TRUE; } void CAvatarMap::OnPaint()=20 { CPaintDC dc(this); // device context for painting CPaintDC Map(GetDlgItem(IDC_MapControl)); // device context for = painting =09 CRect rect; GetDlgItem(IDC_MapControl)->GetClientRect (&rect); CPoint Center; Center =3D rect.CenterPoint(); Map.SetMapMode(MM_ISOTROPIC); Map.SetViewportExt (rect.Width(), rect.Height()); Map.SetWindowExt (rect.Width(),rect.Height()); // Draws the Axis lines Map.MoveTo (Center.x,rect.top); Map.LineTo (Center.x,rect.bottom); Map.MoveTo (rect.left,Center.y); Map.LineTo (rect.right,Center.y); // Draws the Border Map.MoveTo (rect.left, rect.top); Map.LineTo (rect.left, rect.bottom); Map.MoveTo (rect.right, rect.top); Map.LineTo (rect.right, rect.bottom); Map.MoveTo (rect.left, rect.top); Map.LineTo (rect.right, rect.top); Map.MoveTo (rect.left, rect.bottom); Map.LineTo (rect.right, rect.bottom); // Draws the Avatar Blips POSITION pos; for( pos =3D list.GetHeadPosition(); pos !=3D NULL; ) { CString NextPerson =3D list.GetNext( pos ); char NAME[18]; sprintf(NAME,"%s",NextPerson); CString MyName; MyName.Format("[%s]",aw_string(AW_LOGIN_NAME)); if (NextPerson =3D=3D MyName) Map.SetViewportOrg (rect.Width() / 2, rect.Height() / 2); else { int NS =3D GetNS(NAME); int WE =3D GetWE(NAME); NS -=3D aw_int(AW_MY_X); WE -=3D aw_int(AW_MY_Z); NS *=3D .015; WE *=3D .015; NS *=3D .0001; WE *=3D .0001; if (NS < 0) NS =3D abs(NS); else NS /=3D 2; if (WE < 0) WE =3D abs(WE); else WE /=3D 2; CString Testing; Testing.Format("NS: %d, EW: %d",NS,WE); MessageBox(Testing); Map.Ellipse(WE-5,NS-5,WE+5,NS+5); } } =09 CDialog::OnPaint(); } void CAvatarMap::AvatarList (CStringList* AVList) {=20 list.RemoveAll(); POSITION pos; for( pos =3D AVList->GetHeadPosition(); pos !=3D NULL; ) { CString NextPerson =3D AVList->GetNext( pos ); list.AddTail(NextPerson); } } ------=_NextPart_000_01C1_01BF505B.367D71A0-- |