|
Does anyone know I can change the text-color of ONE item in a CListCtrl?
thanks
|
|
|
|
|
That's easy - just handle NM_CUSTOMDRAW notification. Look for "Custom draw (listview)" in your VC++ help index.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks for the tip!
unfortunately I still don't know how to use it in my Dialog based MFC-App
The help did't take me any further.
I want to draw e.g. the first item in red color, the second in green etc..
|
|
|
|
|
Examples are on the CodeProject website - just go to the "List control" section.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
|
Hi,
I like to know how can I get the length(in pixels) between two points.
can i get the length in some other unit too???
Thanks
Ehsan
Ehsan Behboudi
|
|
|
|
|
It's basic trig. If you have a right angle triangle, (a*a) + (b*b) = c*c. C is the side you are dealing with, so if your line is from 0,100 to 100, 47, then a = 100 and b = 100-47, 53. So the square root of (100*100) + (53 * 53) is the length of your line.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
|
|
|
|
|
Hi,
I like to know how can I get the length between two points.
Thanks
Ehsan
Ehsan Behboudi
|
|
|
|
|
Ehsan - is this question related to Visual C++?
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hi!
How can I program a function that checks whether the file has been modified? (e.g. changed dialogs etc.)
I have heard something about a CRC-Checksum..how to do that?
thanks in advance
|
|
|
|
|
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
|
|
|
|