Click here to Skip to main content
15,884,298 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Code-Generation Setting Pin
ShilpiP18-Aug-10 3:10
ShilpiP18-Aug-10 3:10 
GeneralRe: Code-Generation Setting Pin
Rick York19-Aug-10 20:19
mveRick York19-Aug-10 20:19 
GeneralRe: Code-Generation Setting Pin
gothic_coder19-Aug-10 22:37
gothic_coder19-Aug-10 22:37 
QuestionEmail config setting. Pin
Samarjeet Singh@india17-Aug-10 21:40
Samarjeet Singh@india17-Aug-10 21:40 
AnswerRe: Email config setting. Pin
Richard MacCutchan17-Aug-10 22:27
mveRichard MacCutchan17-Aug-10 22:27 
GeneralRe: Email config setting. Pin
Samarjeet Singh@india17-Aug-10 22:31
Samarjeet Singh@india17-Aug-10 22:31 
GeneralRe: Email config setting. Pin
Richard MacCutchan18-Aug-10 1:15
mveRichard MacCutchan18-Aug-10 1:15 
QuestionRotate rerctangle in Bitmap Pin
raju_shiva17-Aug-10 21:32
raju_shiva17-Aug-10 21:32 
Hi sir,
I have origin axis of bitmap and x1,x2,y1,y2.
I want to draw a rectangle and rotate it with the given degree.I am trying with this code,but i am not getting.
Can some one help me

double x1,x2,y1,y2;
sf=(1024/31);  //Its a bitmap image
A1 = 10.00; //these are values i am reading from hardware
A2 = 10.00;
B1 = 10.00;
B2 = 10.00;

x1 = (A1 * sf);
x2 = (A2 * sf);
y1 = (B1 * sf);
y2 = (B2 * sf);
//To find the center origin of Bitmap
center.x=(((pCellInfo->rcBitmapRect.right-pCellInfo->rcBitmapRect.left)/2)+pCellInfo->rcBitmapRect.left);
center.y=(((pCellInfo->rcBitmapRect.bottom-pCellInfo->rcBitmapRect.top)/2)+pCellInfo->rcBitmapRect.top);

int a = 45; 
float Angle = ( 3.142 * a ) / 180; 

x1 =  x1 * cos(Angle) + y1 * sin(Angle); 
y1 = -x1 * sin(Angle) + y1 * cos(Angle);
x2 =  x2 * cos(Angle) + y2 * sin(Angle); 
y2 = -x2 * sin(Angle) + y2 * cos(Angle);

//I am using the right formula to claculate the axis for rotation
Origin(525,454);  // center origin(center.x,center.y);
MoveToEx(pCellInfo->hDC,center.x-x1,center.y-y2,NULL);

LineTo(pCellInfo->hDC,center.x-x1,center.y+y1);
LineTo(pCellInfo->hDC,center.x+x2,center.y+y1);
LineTo(pCellInfo->hDC,center.x+x2,center.y-y2);
LineTo(pCellInfo->hDC,center.x-x1,center.y-y2);


If i test with this hard code values,i am getting the rectangle rotated
MoveToEx(pCellInfo->hDC,525,289,NULL);// Angle 45 for reference
	LineTo(pCellInfo->hDC,360,454);
	LineTo(pCellInfo->hDC,525,619);
	LineTo(pCellInfo->hDC,690,454);
	LineTo(pCellInfo->hDC,525,289); 


how can i get the same values


Thanks
Raj
QuestionRe: Rotate rerctangle in Bitmap Pin
CPallini17-Aug-10 21:58
mveCPallini17-Aug-10 21:58 
AnswerRe: Rotate rerctangle in Bitmap Pin
raju_shiva17-Aug-10 22:38
raju_shiva17-Aug-10 22:38 
GeneralRe: Rotate rerctangle in Bitmap Pin
CPallini17-Aug-10 22:49
mveCPallini17-Aug-10 22:49 
GeneralRe: Rotate rerctangle in Bitmap Pin
raju_shiva17-Aug-10 23:13
raju_shiva17-Aug-10 23:13 
GeneralRe: Rotate rerctangle in Bitmap Pin
CPallini17-Aug-10 23:19
mveCPallini17-Aug-10 23:19 
GeneralRe: Rotate rerctangle in Bitmap Pin
raju_shiva17-Aug-10 23:45
raju_shiva17-Aug-10 23:45 
QuestionRe: Rotate rerctangle in Bitmap Pin
CPallini17-Aug-10 23:54
mveCPallini17-Aug-10 23:54 
AnswerRe: Rotate rerctangle in Bitmap Pin
raju_shiva18-Aug-10 0:16
raju_shiva18-Aug-10 0:16 
GeneralRe: Rotate rerctangle in Bitmap Pin
CPallini18-Aug-10 0:36
mveCPallini18-Aug-10 0:36 
GeneralRe: Rotate rerctangle in Bitmap Pin
raju_shiva18-Aug-10 1:18
raju_shiva18-Aug-10 1:18 
GeneralRe: Rotate rerctangle in Bitmap Pin
CPallini18-Aug-10 1:47
mveCPallini18-Aug-10 1:47 
GeneralRe: Rotate rerctangle in Bitmap Pin
raju_shiva18-Aug-10 20:54
raju_shiva18-Aug-10 20:54 
GeneralRe: Rotate rerctangle in Bitmap Pin
CPallini18-Aug-10 20:59
mveCPallini18-Aug-10 20:59 
GeneralRe: Rotate rerctangle in Bitmap Pin
Rick York19-Aug-10 15:49
mveRick York19-Aug-10 15:49 
GeneralRe: Rotate rerctangle in Bitmap Pin
CPallini19-Aug-10 21:26
mveCPallini19-Aug-10 21:26 
AnswerRe: Rotate rerctangle in Bitmap Pin
Peter_in_278017-Aug-10 22:00
professionalPeter_in_278017-Aug-10 22:00 
GeneralRe: Rotate rerctangle in Bitmap Pin
raju_shiva17-Aug-10 22:39
raju_shiva17-Aug-10 22:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.