Thread

GDI Problems with Win32 . . . (Sdk)

GDI Problems with Win32 . . . // Sdk

1  |  

andon13

Dec 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>&nbsp;CPaintDC=20
dc(this); // device context for painting</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;CPaintDC Map(GetDlgItem(IDC_MapControl)); =
// device=20
context for painting<BR>&nbsp;<BR>&nbsp;CRect=20
rect;<BR>&nbsp;GetDlgItem(IDC_MapControl)-&gt;GetClientRect=20
(&amp;rect);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;CPoint Center;<BR>&nbsp;Center =3D=20
rect.CenterPoint();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT=20
face=3DArial>&nbsp;Map.SetMapMode(MM_ISOTROPIC);<BR>&nbsp;Map.SetViewport=
Ext=20
(rect.Width(), rect.Height());<BR>&nbsp;Map.SetWindowExt=20
(rect.Width(),rect.Height());</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;// Draws the Axis =
lines<BR>&nbsp;Map.MoveTo=20
(Center.x,rect.top);<BR>&nbsp;Map.LineTo=20
(Center.x,rect.bottom);<BR>&nbsp;Map.MoveTo=20
(rect.left,Center.y);<BR>&nbsp;Map.LineTo =
(rect.right,Center.y);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;// Draws the Border<BR>&nbsp;Map.MoveTo=20
(rect.left,&nbsp; rect.top);<BR>&nbsp;Map.LineTo (rect.left,&nbsp;=20
rect.bottom);<BR>&nbsp;Map.MoveTo (rect.right, =
rect.top);<BR>&nbsp;Map.LineTo=20
(rect.right, rect.bottom);<BR>&nbsp;Map.MoveTo (rect.left,&nbsp;=20
rect.top);<BR>&nbsp;Map.LineTo (rect.right, =
rect.top);<BR>&nbsp;Map.MoveTo=20
(rect.left,&nbsp; rect.bottom);<BR>&nbsp;Map.LineTo (rect.right,=20
rect.bottom);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;// Draws the Avatar Blips</FONT></DIV>
<DIV><FONT face=3DArial>&nbsp;POSITION pos;<BR>&nbsp;for( pos =3D=20
list.GetHeadPosition(); pos !=3D NULL; =
)<BR>&nbsp;{<BR>&nbsp;&nbsp;CString=20
NextPerson =3D list.GetNext( pos );<BR>&nbsp;&nbsp;char=20
NAME[18];<BR>&nbsp;&nbsp;sprintf(NAME,"%s",NextPerson);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;CString=20
MyName;<BR>&nbsp;&nbsp;MyName.Format("[%s]",aw_string(AW_LOGIN_NAME));</F=
ONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;if (NextPerson =3D=3D=20
MyName)<BR>&nbsp;&nbsp;&nbsp;Map.SetViewportOrg (rect.Width() / 2, =
rect.Height()=20
/ 2);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT =
face=3DArial>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;int=20
NS =3D GetNS(NAME);<BR>&nbsp;&nbsp;&nbsp;int WE =3D=20
GetWE(NAME);<BR>&nbsp;&nbsp;&nbsp;NS -=3D =
aw_int(AW_MY_X);<BR>&nbsp;&nbsp;&nbsp;WE=20
-=3D aw_int(AW_MY_Z);<BR>&nbsp;&nbsp;&nbsp;NS *=3D =
..015;<BR>&nbsp;&nbsp;&nbsp;WE *=3D=20
..015;<BR>&nbsp;&nbsp;&nbsp;NS *=3D .0001;<BR>&nbsp;&nbsp;&nbsp;WE *=3D=20
..0001;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;&nbsp;if (NS &lt;=20
0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;NS =3D abs(NS);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT =
face=3DArial>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;NS /=3D=20
2;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;&nbsp;if (WE &lt;=20
0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;WE =3D abs(WE);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT =
face=3DArial>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;WE /=3D=20
2;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>&nbsp;&nbsp;&nbsp;CString=20
Testing;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//=20
This is my problem . .&nbsp;.<BR>&nbsp;&nbsp;&nbsp;Testing.Format("NS: =
%d, EW:=20
%d",NS,WE);&nbsp;&nbsp;&nbsp; //&nbsp;According to this, the output is =
alwyas=20
the same<BR>&nbsp;&nbsp;&nbsp;MessageBox(Testing);&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; //=20
Is there anything easily spotable that is wrong with my code =
above?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT=20
face=3DArial>&nbsp;&nbsp;&nbsp;Map.Ellipse(WE-5,NS-5,WE+5,NS+5);<BR>&nbsp=
;&nbsp;}<BR>&nbsp;}<BR>&nbsp;<BR>&nbsp;CDialog::OnPaint();<BR>}</FONT></D=
IV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial>Andon M. Coleman</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial>Senior Programmer</FONT></DIV>
<DIV><FONT face=3DArial>R&amp;D</FONT></DIV>
<DIV><BR><FONT face=3DArial>Nothing, Inc.</FONT></DIV></BODY></HTML>

------=_NextPart_000_0008_01BF4FBB.67A7EBC0--

sagaman

Dec 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.&nbsp; It=20
might be better as an attachment.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Norm</FONT></DIV></BODY></HTML>

------=_NextPart_000_000B_01BF4FCB.4A197140--

andon13

Dec 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 &lt;<A=20
href=3D"mailto:sagaman at sagatech.com">sagaman at sagatech.com</A>&gt; =
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.&nbsp;=20
It might be better as an attachment.</FONT></DIV>
<DIV>&nbsp;</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--

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn