|
|
I was afraid of that.
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I want to know how to use GDI+ to draw a rubber line?
Let's use GDI+ to draw! hoho
|
|
|
|
|
What do you mean by "rubber line"?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
draw a XOR line useing GDI+!
thanks to all the programmers who have helped me.
|
|
|
|
|
No, it does not. I did this by using OnPrtepareDC, and drawing the rubber band or shape to the screen directly, only drawing it to the bitmap at the end of the operation.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
can you explain it in more detail? the background in the client area is a bitmap, i draw my shape to the screen directly,too. but i don't know how to erase it.
thanks to all the programmers who have helped me.
|
|
|
|
|
It erases itself, because you draw the bitmap to the screen, then draw the line to the screen. Next time you draw the bitmap, the line is not there, so only the new one is drawn.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
You can intermingle gdi and gdi+ code, so yes. SetROP2() is not supported in gdi+ anymore i believe, but you can still call the old SetROP2() as you still have a dc handle somewhere in your code.
cheers,
swinfeaster
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Hi, i´ve downloaded the XP debug symbols but i cannot find a way to make the vc.net ide to recognize where they are installed. Any ideas???
Thanks
Gabriel
don´t worry drink happy
|
|
|
|
|
Hi I'm new to this forum, but I think it's pretty cool. I had a question about CPoint object. I need to be able to randomly generate an array of them. Which I got that far, but my problem was when the user entered a point, and I was supposed to tell the program to find the closest point in the array. Do any of you know how to do that? I tried using like the '<' compare operator but the CPoint class doesn't have that operator. Don't worry I'm not trying to get free homework (I'm using Introduction to MFC with Visual C++ to learn MFC) or anything I just don't understand and I would like to understand it. Thanks in advance for your help.
-CDudd
|
|
|
|
|
You need to use < on the members of CPoint, which are x and y.
And I'd answer this question if it *was* homework, because you're trying to do something, not just asking for a complete solution on a plate.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
I have tried that. I'm not really sure where to go from there. Another hint please? I'm not trying to do 'anything' I'm just trying to learn. Thanks for the quick post.
-CDudd
|
|
|
|
|
CDuddley wrote:
to find the closest point
If i understand correctly, you need to define a measure of distance between CPoints to do that. Most probably that would be euclidean distance , i.e.
d = sqrt((x1 - x2)^2 + (y1 - y2)^2)
So define a function that calculates the euclidean distance between two CPoints, maybe something like this:
#include <math.h>
double distance(const CPoint& p1, const CPoint& p2)
{
return sqrt((p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y));
}
a nicer variant (performance?) of this would be
double distance(const CPoint& p1, const CPoint& p2)
{
CSize diff = p1 - p2;
return sqrt(diff.x * diff.x + diff.y * diff.y);
}
(of course, for your purpose, you don't need to calculate the sqrt, but now i'm blabbering)
Now all you's gotta do is iterate over the array of CPoints, calculating the distance between your given test point and each point in the array and keeping track of the array index of the point that is the closest to the test point (now read this paragraph again).
that-exercise-is-left-to-the-OP-ly y'rs --pg
|
|
|
|
|
Thanks a bunch for the post. I was having trouble with the fact that if a random point was greater than the given point the point would be negative when I took the difference. I forgot all about the euclidian distance formula thanks a ton! I'll try to get the test program working now!
Thanks again,
CDudd
|
|
|
|
|
You're awesome I got the exercise working without a hitch! Thanks a ton man.
-CDudd
|
|
|
|
|
I need to figure out via a hwnd if the hwnd I have is a common dialog box. Is there a style, class, etc associated with common dialog boxes? I am only interested in the open and close dialog boxes. What is the best way to do this?
Thanks
Ralph Krausse
|
|
|
|
|
Using Spy++, it appears to me that there is no special class given to the Open and Save Dialog boxes, they are declared as the regular #32770 class, which is the identifier for the dialog class.
There may be some other trick that you can employ, like test the title or something, but this will not be guaranteed to work, especially if you are testing in someone elses application.
|
|
|
|
|
Does any one know a good article (preferably with source) about creating and reading group policies ?
|
|
|
|
|
Joaquín and Christian...my appologies for asking a rtti question again, but I still don't have quite enough experience with it to fully understand whats going on despite numerous teaching attempts from both of you.
Anyways.
I have an dynamic array of CWnd's which I would like to be able to act, look and feel like CButton, CEdit, CComboBox etc...
m_pControls = new CWnd[m_nControls];
dynamic_cast< CButton >(m_pControls[0]).Create(this, CRect(0,0,100, 20));
Someone wanna show how I do this properly..?
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Well, I think you have some misunderstandings about what kind of things one is supposed to do with dynamic_cast .
First of all, dynamic_cast only works for pointers or references. Your last sentence cannot work because you are tyring to use it to cast to CButton instead of CButton * . There are a lot of other reasons why it won't work, however.
Suppose you have a inheritance hierarchy like this
A
|
-------
| | |
B C D Now you're given a pointer to A and you want to know whether the object pointed to is really a B:
A * pA;
...
B * pB=dynamic_cast<B *>(pA); At this point, if pA was actually pointing to a B (which is legitimate, as B derives from A ), pB will be non-null. Otherwise, pB is null, menaing that pA points to a C , a D or something else. In this way, dynamic_cast lets you peep into the actual nature of an object referred to from its base class. What dynamic_cast does not do is create objects of derived classes on demand, as your code seems to assume. Hope this helped clariy things a bit more.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ummm...sorta...RTTI is proving to be the most difficult thing for me to understand fully. I'll probably have to hit the books again for a while.
I did however find another way around my problem, which actually is easier and less overhead. I hate it when I do that, try to solve a simple problem with a difficult solution. One day i'll learn.
Thanx again
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
The coordination in client rect is like this:
------------->+
|
|
|
|
|
|
|+
(I mean Y increase when it goes down)
Is there any way to change this rule and it increaze when it goes up?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Pass a negative y value into SetWindowExt() .
Simon
There's one for you, nineteen for me
Sonork ID 100.10024
|
|
|
|
|
I have created a Multiple Documents MFC project, using Internet Explorer Rebars for my toolbars instead of normal MFC toolbar.
When I put a control in my IDR_MAINFRAME dialog (the dialog bar), the control remains disabled even if I associated it with a member function for the message BN_CLICKED.
How can I do to enable my control?
|
|
|
|