|
Hmmm - this worked fine for me:
- Create the check boxes in
OnInitDialog :
CRect rcCheck1(baseSize_);
rcCheck1.bottom /= 2;
CRect rcCheck2;
rcCheck2.SubtractRect(baseSize_, rcCheck1);
rcCheck1.left = rcCheck1.right - 100;
rcCheck2.left = rcCheck2.right - 100;
check1_.Create(_T("1"), WS_CHILD|WS_VISIBLE|BS_CHECKBOX, rcCheck1, this, 101);
check2_.Create(_T("2"), WS_CHILD|WS_VISIBLE|BS_CHECKBOX, rcCheck2, this, 102);
- Draw the images 100 pixels narrower (as I've made the checkboxes 100 pixels wide). I added the following two lines in
OnPaint right before the OffsetRect method calls to do that:
rcImage1.right -=100;
rcImage2.right -=100;
Oh, and check1_ and check2_ are members of the dialog class, of type CButton .
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
Thanks for valuable information on this.... I have tried the same thing in my application, it is working fine.
With the help your example code i have created one slider bar, and using MCI functions i trying to play the call. I am able to play the call, but the slider bar is not moving.
Can you please let me know why i am not able to get that..
Please help me regarding this also..
Thanks in advance..
Thanks
Venkatesh.
|
|
|
|
|
Never used MCI, got no idea, sorry.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
I need one more small help regarding line creation on images. I am able to get images and check boxes on dialog box. Now i want to create one horizontal line on images. I have tried with the same logic which i have used for images and check boxes.
But if i moved vertical scroll bar down, then the line is also moving and getting erasing..
Can you please help me out in this regards, because this is last component of my application.
Thanks in advance..
Thanks
Venkatesh.
|
|
|
|
|
venki502 wrote: one horizontal line on images
How you doing that?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
In OnInitDialog function i have written following code snippet..
CRect rcLine1(baseSize_);
rcLine1.bottom /= 2;
rcLine1.SubtractRect(baseSize_, rcLine1);
x1 = rcLine1.left + 15;
y1 = x1;
x2 = rcLine1.top - 700;
y2 = rcLine1.bottom - 1300;
Thanks
Venkatesh
|
|
|
|
|
How are you drawing the line - with MoveTo +LineTo in your OnPaint handler?
If that's the case, you need to offset it with the scroll position, like when you blitted the images.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
I using MoveTo and LineTo functions in OnPaint only... i have written remaining code in OnInitDialog. becuase i want to move the line across the images.
but still i am getting same problem..
Any clue regarding this..?
Thanks
Venkatesh.
|
|
|
|
|
As I said, you need to offset the endpoints of the line exactly the same as you offset the rectangles into which you blitted the images.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
I am using below code snippet in OnPaint method..
CRect rcLine1(baseSize_);
rcLine1.bottom /= 2;
rcLine1.SubtractRect(baseSize_, rcLine1);
rcLine1.OffsetRect(-offset_);
rcLine1.left += 15;
rcLine1.right = rcLine1.left;
rcLine1.top -= 700;
rcLine1.bottom -= 1300;
but still i am facing same problem...? kindly please look into this once..
Thanks
Venkatesh.
|
|
|
|
|
But you've not said what co-ordinates you're drawing the line with.
Or where you're trying to draw the line.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
I am using below code snippet in OnPaint method..
CRect rcLine1(baseSize_);
rcLine1.bottom /= 2;
rcLine1.SubtractRect(baseSize_, rcLine1);
rcLine1.OffsetRect(-offset_);
rcLine1.left += 15;
rcLine1.right = rcLine1.left;
rcLine1.top -= 700;
rcLine1.bottom -= 1300;
dc.MoveTo(rcLine1.left,rcLine1.right);
dc.LineTo(rcLine1.top,rcLine1.bottom);
this is how i am trying to draw the line..
still i am facing same problem...?
Thanks
Venkatesh
|
|
|
|
|
Your co-ordinate use looks messed up.
You've got MoveTo(left, right); followed by LineTo(top, bottom); . That just doesn't seem right.
I added a horizontal line between two images with
dc.MoveTo(rcImage1.left+15, rcImage1.bottom);
dc.MoveTo(rcImage1.right-15, rcImage1.bottom);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
Thanks for your help, I am able to draw veritcal line successfully across the images, we have given static pixels information for drawing a line right..? but now i want to move line across the images whenever i have clicked on button..
Can you please tell me how can i achive this..?
Thanks
Venkatesh.
|
|
|
|
|
Hi Stuart,
I able to draw vertical line.. thanks for your help..
Thank you so much..
Thanks
Venki
|
|
|
|
|
Hi Stuart,
Can you please help me regarding line drawing.. I want to draw line with the slider thumb positions.
I am using below code snippet for drawing line..
GetClientRect( &deflatedClientRect );
deflatedClientRect.DeflateRect( TB_WIDTH, TB_WIDTH );
slider_bar1.GetThumbRect( &thumbRect );
slider_bar1.ClientToScreen( &thumbRect );
ScreenToClient(&thumbRect);
ptStart.x = thumbRect.CenterPoint().x;
ptStart.y = TB_WIDTH;
ptEnd.x = ptStart.x;
ptEnd.y = deflatedClientRect.bottom;
using this code i will get the slider bar thumb position in terms of pixels, so using MoveTo and LineTo funtions i am drawing line..
but here i am not offsetting the pixels, so the line is getting erasing while moving scroll bar down..
Can you please help me regarding this.. please kindly give me reply as i have to deliver this app by tomorro... please
thanks in advance...
|
|
|
|
|
venki502 wrote: but here i am not offsetting the pixels, so the line is getting erasing while moving scroll bar down
Ummm - so what behaviour are you trying to achieve?
Offsetting ptSDtart and ptEnd is easy enough....
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
Thanks responding on this.. actually i have two horizontal sliders in between them i need to draw vertical line..
so using that code snippet i am able to get starting position of the top slider,
so i am using that..actually i also want to move that line along with slider positions... so that's the reason i am using that..
can you please tell me how can i do that..
thanks in advance..
|
|
|
|
|
Seems pretty obvious to me that you need to get the thumb positions of the two sliders and draw between them:
slider_bar1.GetThumbRect( &thumbRect1 );
slider_bar1.ClientToScreen( &thumbRect1 );
ScreenToClient(&thumbRect1);
slider_bar2.GetThumbRect( &thumbRect2 );
slider_bar2.ClientToScreen( &thumbRect2 );
ScreenToClient(&thumbRect2);
ptStart.x = thumbRect1.CenterPoint().x;
ptStart.y = thumbRect1.bottom;
ptEnd.x = thumbRect2.CenterPoint().x;
ptEnd.y = thumbRect2.top;
?
[edit] changed slider_bar1 to slider_bar2 when manipulating thumbRect2 [/edit]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Okay, we don't need to offset the pixels is it..? do we get the vertical scroll proble here..?
i will check and i will update you..
Thanks in advance
|
|
|
|
|
venki502 wrote: we don't need to offset the pixels is it..?
No, you don't need to offset, as the line position is calculated using rectangles derived from child controls, which are correctly adjusted for the scroll position.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi stuart,
No the line is getting erasing.... i did the same thing whatever u have posted in the previous thread..
when i move vertical scroll bar down , the line is getting erasing..
For your information i have added that code in OnPaint function..
can you please tell me where i am doing wrong..?
thanks in advance..
modified on Thursday, February 19, 2009 1:23 PM
|
|
|
|
|
No idea - I implemented a line drawing thing, it worked fine.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Stuart,
I am using below code snippet :
GetClientRect( &deflatedClientRect );
deflatedClientRect.DeflateRect( TB_WIDTH, TB_WIDTH );
slider_bar1.GetThumbRect( &thumbRect1);
slider_bar1.ClientToScreen( &thumbRect1);
ScreenToClient(&thumbRect1);
m_bottom_slider_control.GetThumbRect(&thumbRect2);
m_bottom_slider_control.ClientToScreen(&thumbRect2);
ScreenToClient(&thumbRect2);
ptStart.x = thumbRect1.CenterPoint().x;
ptStart.y = thumbRect1.bottom;
ptEnd.x = thumbRect2.CenterPoint().x;
ptEnd.y = thumbRect2.bottom;
x1 = ptStart.x; y1 = ptStart.y; x2 = ptEnd.x; y2 = ptEnd.y;
int nOldmode=dc.SetROP2(R2_NOTXORPEN);
dc.MoveTo(old_x1,old_y1);
dc.LineTo(old_x2,old_y2);
dc.MoveTo(x1,y1);
dc.LineTo(x2,y2);
old_x1 = x1;
old_y1 = y1;
old_x2 = x2;
old_y2 = y2;
I am writing below code in OnPaint function, when i moved vertical scroll bar down it is getting erasing ..
please tell me where i am going wrong..?
thanks in advance...
|
|
|
|
|
Don't know - can't see anything wrong with that.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|