How can Create new rect with width?
-
Hi all, I have a Rect, e.g: CRect rect=CRect(10,20,20,40); i have new width for rect like 80. now how can i create rect with this width and other values are remains same. please help me for this. thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
-
Hi all, I have a Rect, e.g: CRect rect=CRect(10,20,20,40); i have new width for rect like 80. now how can i create rect with this width and other values are remains same. please help me for this. thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
I think you can use of
CRect::DeflateRect
.Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
I think you can use of
CRect::DeflateRect
.Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
Hi all, I have a Rect, e.g: CRect rect=CRect(10,20,20,40); i have new width for rect like 80. now how can i create rect with this width and other values are remains same. please help me for this. thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
rect.InflateRect(0,0,70,0);
:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
rect.InflateRect(0,0,70,0);
:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
please explain why this.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
Your original rect
(10,20,20,40)
haswidth = right - left = 20 - 10 = 10 pixels.
If you want it 80 pixels wide (with minimum change on coordinates) then you should move its right side 70 pixels to the right:
leftnew = left;
rightnew = right + 70; // now width = rightnew - leftnew = 80
topnew = top;
bottomnew = bottom;That's what
InflateRect(0,0,70,0)
does. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Your original rect
(10,20,20,40)
haswidth = right - left = 20 - 10 = 10 pixels.
If you want it 80 pixels wide (with minimum change on coordinates) then you should move its right side 70 pixels to the right:
leftnew = left;
rightnew = right + 70; // now width = rightnew - leftnew = 80
topnew = top;
bottomnew = bottom;That's what
InflateRect(0,0,70,0)
does. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hamid. wrote:
CRect::DeflateRect.
but this use for Decreases the width and height of CRect.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
You can decrease your width of current width with this function.
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )
-
thanks , if new width is decrease so i can use DeflateRect or InflateRect.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
You may also use inflate with negative values. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi all, I have a Rect, e.g: CRect rect=CRect(10,20,20,40); i have new width for rect like 80. now how can i create rect with this width and other values are remains same. please help me for this. thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
Juat assign a new value to the
right
member:rect.right = rect.left + the_new_width;
--Mike-- Visual C++ MVP :cool: LINKS~! CP SearchBar v3.0 | C++ Forum FAQ I work for Keyser Söze