|
I use this code :
CBrush Red;
Red.CreateSolidBrush(RGB(255,0x00,0x00));
CBrush* savebrush = dc->SelectObject(&Red);
dc->BeginPath();
dc->Ellipse(11*Xunit,10*Yunit,16*Xunit,16*Yunit);
dc->Ellipse(14*Xunit,10*Yunit,19*Xunit,16*Yunit);
dc->MoveTo(8*Xunit,14*Yunit);
dc->LineTo(15*Xunit,20*Yunit);
dc->LineTo(22*Xunit,14*Yunit);
dc->EndPath();
dc->FillPath();
Some parts are painted as white area,but I want all of them to be red.
Any Suggestion?
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
|
|
|
|
|
Check out SetPloyFillMode.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi!
I tried to eject media from my CD-ROM drive ( Z: ) in an MFC program by using Interrupt 21h. But when I run the program, I get an exception in KRNL386.EXE at 0001:00008614 and the program crashes. While bx was 001Ah before the crash as it should be, the "crashing dialog" tells me it is 898Dh after the crash. So what did I do wrong?
void CEjectDlg::OnEject()
{
WORD DriveNum = 26;
BYTE DeviceCat = 0x08;
__asm
{
mov ax, 440Dh
mov bx, DriveNum
mov ch, DeviceCat
mov cl, 49h
int 21h
}
}
Another thing: is there a way to close the drive again by using Interrupt 21h?
Thanks,
Martin
|
|
|
|
|
You probably ought to use DeviceIOControl to eject your device.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
|
I'm looking at this URL
http://www.codeguru.com/opengl/oglwrapperclass.shtml
under the heading - Basic Use
I'm trying to create my own MDI application and draw graphics in the child window. But I don't understand anything about the six steps. i.e. when it says to replace CView with CGLEnabledView, do I just replace the word? Or do I have to actually create the class CGLEnabledView with all the methods and variables. It also tells me to override the VideoMode and OnDrawGL functions. What does that mean? When I create an MDI app, I don't see any such functions in my workspace. Are they present in header files? Basically, could someone give me a more detailed step by step explanation of how to set up an MDI app. where I can draw OpenGL graphics in the child window.
|
|
|
|
|
I have created an AppBar based on a CMDIFrameWnd (Instead
of the typical CDialog implementations.) My problem is
that once the AppBar has been docked to an edge, its
window is subsequently repositioned to fit within the
reduced screen area that was created at the time that the
AppBar was initially positioned. By looking at the values
passed into OnWindowPosChanged() I confirmed that the
AppBar was initially positioned properly, but there is
always one final internal action which repositions the
AppBar window into the reduced screen area. My AppBar
window is being resized in response to its own docking
notification! I am sure that this is an artifact of using
CMDIFrameWnd, but I do not know how to work around it.
Does anyone have a suggestion for how to prevent the
automatic resizing?
Thanks
|
|
|
|
|
I have a paint program....
I want to save what i have drawn to the Screen DC(the lines, rectangles, etc.) to a bitmap...
What i tried to do was to select a bitmap to the screen DC (CDC::SelectObject()) and then copy it to a memory DC (CDC::Bitblt).... it seems its wrong....
How do i go about it??
|
|
|
|
|
The screen DC has a bitmap in it, you need to select a bitmap into a memory DC, and then BitBlt.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Hi,
I have made an interface for setting and retrieving metafiles, and I would like to make like in ATL, I want to have:
IMyInterface
and
IMyInterfaceImpl
But I don´t know exactly how to do this or if it is a good idea ( I´m using ATL), can you help me ?, Thanks, Bye !
Braulio
|
|
|
|
|
Perhaps anyone has code available how to turn a bitmap (CBitmap or already drawn onto a CDC) into grey?
So far I tried to set a greyscale palette onto the CDC, but it did not work. And repainting every pixel is much too slow.
Any ideas?
Thanks in advance,
Roland
|
|
|
|
|
You're stuck. You NEED to do this pixel by pixel. It's much faster if you use a DIBSection, which is a DIB, but can be selected into a DC for drawing like a CBitmap. By the way, the formula is not red + green + blue/3, it's weighted if you want it to be right. I forget the weightings right now, but I've given them in this forum before, so do a search and you should be right.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
We are using Visual sourcesafe to share our code.
Our software is build around a central library. This library ( a project in vss) is shared to other Projects.
We want to create a new version of this library. So it must be possible for the client projects to use shared code from only 1 library.
But how can you verify what the source is of a shared file in vss?
From the icon, it is possible to see it is a shared file, but you can't see his location.
Any Ideas on this concept ?
|
|
|
|
|
Look at the properties of the file.
NikoTanghe wrote:
Any Ideas on this concept
Read the documentation
|
|
|
|
|
Mark Nischalke wrote:
Look at the properties of the file.
The properties of a shared file only show the current project, not the library ( = project) that shares the file !
Mark Nischalke wrote:
Any Ideas on this concept
Read the documentation
The manual doesn't help me solve my problem
|
|
|
|
|
Hi
I´ve added a tip of the day component to a program and it works fine. It is just that it does not show any tips. How do I add that ? should I create a text file or what?
Thanks
|
|
|
|
|
You will need to create a "tips.txt" file in the apps .exe directory. One line per tip.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
Hi,
I have written
the_Dialog=new CFileDialog( TRUE,_T(".pref"),
"Untitled", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST ,
"Preference Files(*.pref)|*.pref||");
It works fine.Suppose i select a folder which doesn't have untitled,pref ,it shows up a messagebox that untitled.pref file not found.Then i goto a folder which has file with that name then if i click on open it says untitled file is not found("extension was missing").until i click on that particular file i was not able to open.
Any idea?
Neha
|
|
|
|
|
I suggest you read about the flags.
When you use the OFN_*MUSTEXIST flags together with the initial file name, you're bound to get that result.
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
I'm trying to implement a selection tool which naturally creates a selection RECT but can't get it to work the way it should...someone care to fill in the blanks for me...?
DrawFocusRect uses XOR pen so drawing over the exact location as a previous call would remove it and so on. How then would I use WM_MOUSEMOVE to my advantage...?
Each mouse move it would have to:
1) remove itself
2) Draw itself
However neither of the combinations work in either order, so i'm at a loss as to how this would work. I once managed to get simialr effects using OnMouseDown OnMouseUp, but I need only OnMouseMove()
Any idea's...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Don't bother drawing it yourself. Make use of the CRectTracker class to do it for you.
Create the object in the OnLButtonDown and Destory it in the OnLButtonUp. Change the values in the OnMouseMove.
The only problems I have had with CRectTracker is that you should use a new/delete on it, as the second time you use the same object you get screen corruption. Also, if your control completely redraws between OnMouseMoves's etc, then you have to re-create the CRectTracker object:
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
Perhaps I didn't explain myself clearly enough. I wrote that message really early in the morning, so I was tired.
I don't want to use OnMouseUp and OnMouseDown i'm trying to implement a mouse tracker only when the mouse moves. Button clicking has no purpose with this implementation.
Any ideas...? This is where the problem comes in, I can't figure out when to do what...?
Thanx again!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I had to do this once, and there's probably a better way, but here's how I remember doing it off the top of my head(Pardon my pseudocode):
OnMouseDown-
Get the start CPoint, call it pt1
Set a flag to indicate drawing of the rect
moveto(pt1.x, pt1.y)
OnMouseMove-
Check flag to see if drawing a selection rect.
Get the current CPoint, called pt2
DrawRect(pt1, pt2)
{
lineto(pt2.x, pt1.y)
lineto(pt2.x, pt2.y)
lineto(pt1.x, pt2.y)
lineto(pt1.x, pt1.y)
}
Erase any previous rect with XOR.
This requires having saved the previous position of the mouse.
Redraw the rect once the way you want it to appear.
Save the current point as the previous point to so you can erase the old rect on the next mouse move.
OnMouseUp
Check extents of rect and select anything inside.
Set flag to indicate end of drawing selection rect.
Josh Knox
that-guy.net
"Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown
|
|
|
|
|
Hi,
What are the ways for creating PDF Files from XML documents.
I will use C++.
Which libraries can i use?
Is there any free libraries(even free for commercial use)?
And what about using Formatting Objects?
Any advice ,information, approach, light wolud be helpfull.
with greetings from germany
Özgür
"No one can be perfectly free till all are free; no one can be perfectly happy till all are happy."
|
|
|
|
|
Try the adobe site.
Here's a search result that will probably point you in the right direction.
http://search.adobe.com/cgi-bin/query?mss=simple&pg=q&what=web&fmt=.&where=www_search_main&superq=pdf+xml+convert&index=AdobeCom&q=pdf+xml+convert
Hope this helps,
Bill
|
|
|
|