|
My code :
CPen penObject;
penObject.CreatePen(PS_SOLID, 4, RGB(255,0,0));
CDCPoint->SelectObject(&penObject);
CDCPoint->MoveTo(100,100);
CDCPoint->LineTo(100,200);
Why the line is in colour BLACK instead of RED??????
Also, when i put:
CDCPoint->MoveTo(100,100);
CDCPoint->LineTo(100,100);
It cannot print a dot. It prints nothing.....do you know why????
|
|
|
|
|
Where does CDCPoint come from? If you're playing with memory device contexts, and your line is black instead of red, you've probably screwed calling CreateCompatibleBitmap. Does your code look like this?
CDC CDCPoint;
CDCPoint.CreateCompatibleDC(pSomeOtherDC);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&CDCPoint, cx, cy);
CDCPoint.SelectObject(&bitmap);
If yes, you need need to change first argument in CreateCompatibleBitmap from &CDCPoint to pSomeOtherDC. Currently, your bitmap is monochrome and red pen draws a black line.
Use MoveTo(100, 100) and LineTo(100, 101) to display a pixel. Better yet, call SetPixel(100, 100, RGB(...));
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
My program doesn't have CreatCompatibleBitmap...something liked that.....i just have in OnDraw(CDC* pDC):
if(CDCPoint==NULL)
{
CDCPoint=new CDC;
}
CDCPoint->m_hDC=pDC->m_hDC;
CDCPoint->m_hAttribDC=pDC->m_hAttribDC;
//creating a global window handler to help with output
Handler=m_hWnd;
//setting background mode so there wouldn't be a border around text (just in case)
pDC->SetBkMode(TRANSPARENT);
//setting fixed width font
CFont newFont;
newFont.CreateFont(18, 9, 0, 0, FW_REGULAR, 0, 0, 0, ANSI_CHARSET, OUT_DEVICE_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_MODERN, "Courier New");
pDC->SelectObject(&newFont);
Also, I found that there is another problem........normally the output font is Courier New....but suddently....all fonts change to another one....including all message box.
Thanks for your help anyway...
|
|
|
|
|
So what's the point of having CDCPoint variable? Isn't pDC enough?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
CDC* CDCPoint is a global variable for another files in the project. But pDC is just using in OnDraw().
Therefore, CDCPoint and pDC are the same but used in different area.
|
|
|
|
|
You shouldn't to copy HDC handles from pDC passed OnDraw to your global variable. They'll become invalid soon after OnDraw returns, b/c pDC will be released and your CDCPoint will be useless. Just perform your drawing using pDC. If using pDC instead of CDCPoint doesn't produce expected results, post your OnDraw handler code.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hi,
I have programmed a IE plugin. Now I want for installing/uninstalling the component. Should I go for an installation program like Wise
or should I write my own? What,if any, program for creating installer/uninstaller would you advise?
TIA
Hush..Hush.. thought I heard you calling my name now...
|
|
|
|
|
There are some freeware installers and cheaper than Wise/Installshield (but if you're gonna spend the bucks, get Wise). Try looking for inf-tool, which is nice, or InnoSetup.
|
|
|
|
|
Hi,,
I like to know if anyone knows the range of pixel intenisty.
I getting large negetive numbers.
Thanks
Ehsan
Ehsan Behboudi
|
|
|
|
|
Be a bit more specific, ie: in which context are you refering to.
Windows uses R, G, B color reference values which each element as a color saturation (correct me if I'm wrong) from 0 - 255, 0 being no color, 255 being full color.
So RGB(0,0,255) gives me true blue RGB(0, 0, -255) well I haven't even tried this!
|
|
|
|
|
I'm using the 'Cool Push Menu Button'.. or I want to!
But there is one parameter... CWnd is the type.. it's the parent window... The quiz is: Where is the parent wind (CWnd object) do I have to create on and then use it.. or can I use HWND_DESKTOP??
BETA
|
|
|
|
|
Welcome to the world of programming!
You'll find that, when developing code, you need to be very specific about how you use things.. for example, you can't just stick the word "window" in an API argument that works on a window.. you need to tell it speciifically what window you mean; also, it needs to be in the proper form as expected by the API (a pointer to a CWnd, for instance, or a handle to a window).
Similarly, when asking for help from other programmers, you need to give some sort of background information about what you're doing, and what you've tried that does not work. Source code is often helpful here. Or at least the name of the API you are trying to use.
That way, we'll be more inclined to be helpful, and less inclined to make fun of you.
|
|
|
|
|
or you could use GetParent(m_hWnd), or CWnd* pWndParent = this->GetParent().
But like the man (No offence) says be _MORE_ specific.
|
|
|
|
|
how to use a bitmap as a dialog background (runtime) ?
thx..
|
|
|
|
|
See http://www.codeguru.com/dialog/BmpDlg.shtml.
WillCodeForMoney
|
|
|
|
|
I'm having a problem with Visual Studio and can't quiet understand what's going on. I'm using VC++ 6.0 with SP5.
Every so often (more so than I would like) it'll get REALLY slow. To the point where I can't do anything for 30 or 40 seconds at time. This happens at all different times. Often it'll happen simply when I open a medium size file (6,000 lines) and hit return to insert a new line.
I have Task Manager opened, and the CPU is pegging out during these times.
I have a P3 at 733. I have 384MB of RAM. I've had this happen on NT4 as well as W2K. My project is largeish: about two dozen subfolders, and plenty of .cp and .h files (hundreds in fact). But, I'm not building MS Word here, so I can't believe on this machine that I'm over taxing DevStudio.
I've disbled all addins, I am using sourcesafe.
Any ideas as to what could be the problem, or how I can find out what's eating up the CPU time?
--
Bryan
|
|
|
|
|
Turn off all of the Statement Completion Options in Tools->Options
|
|
|
|
|
That kinda reduces the value of DevStudio then doesn't it?
Are you suggesting this as an idea, or do you know for sure that this is the cause of slowness?
--
Bryan
|
|
|
|
|
1. How do i make a dialog with a bitmap as the background
2. When i put a button on a Static control, the button disappears at runtime (hidden behind the static). How to avoid this, so that the button is on top of the static control ??
thx..Andreas
|
|
|
|
|
See http://www.codeguru.com/dialog/BmpDlg.shtml.
WillCodeForMoney
|
|
|
|
|
check out the CFileEditCtrl class. In this class I placed a button on an edit control. You can use the same technique with a static control.
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
I have an app, if the app fails in the middle of communicating and I try to relauch & start communicating again, the port is locked out.
If I reboot, I can start again!
Is there away to FREE the port up????????????????????
Gerry.
|
|
|
|
|
Hi everybody,
I need to know if someone know where I can find some VERY GOOD site or any things like that on Remote Control like PcAnywhere programming or if anybody have tutorials on that
TIA
BLaZe
|
|
|
|
|
Look for an app called VNC. It's open-source and does the job quite well.
|
|
|
|
|
In http://www.uk.research.att.com/vnc You will be able to find the VNC.
If it does not find the sources, Only let know to me, that I have the sources.
Cheers.
If you have the source of the snake game, Please it does not say anything!!!
Carlos Antollini.
|
|
|
|