|
WalderMort wrote: Just remember something 10x10 pixels may be visible on the screen, but to a printer it's about the size of a fullstop
Heh No kidding - on my photo printer at 2880dpi it's pretty small
|
|
|
|
|
lol, the last printer I had was a dot-matrix
I could really use one too at the moment. I'm going to have to pay attention to whatever we are using at work, I heard the cost of ink can be quite high these days :->
|
|
|
|
|
ok, but not showing up at ALL?
I'm using the printer canvas' width and height to size my custom control's window.
Should make for a huge window that you can only see the top left of.
But there's nothin.
The drawing code is being called, but nothin.
i haven't gotten round to what i said i was gonna, though.
that's what i'm tryin' next.
...Steve
|
|
|
|
|
ok, writing some text at 0,0 (the ole "hello?" string) works fine.
I guess a blank part of the page is displaying.
Now my next question...
What the easiest way to do scroll bars?
I'll have to see if any of the controls do scroll bars themselves...
Otherwise i give the dialog scrollbars and figure out how to set em up and respond to em...
...Steve
|
|
|
|
|
Hi,
I am new to MFC programming and I have a problem:
I use a button and want to set its caption in unicode format (i.e. use my own language which is Farsi) but when I compile it, instead of every letter it shows a '?' sign can anyone help?
OMID KAMANGAR
|
|
|
|
|
omid kamangar wrote: I use a button and want to set its caption in unicode format (i.e. use my own language which is Farsi) but when I compile it, instead of every letter it shows a '?' sign can anyone help?
OMID KAMANGAR
check Show Unicode String!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
I have a program that analyses bitmap and at the moment i am using getPIxel and setPixel, as you will know if you have used them they are very slow. Does any one know of an alternative that will increase the speed?
|
|
|
|
|
Use a DIB and access the bits directly. This will be especially fast when you need to get a lot of pixels since you won't need to recalculate the pixel's offset and convert to a DWORD each time.
|
|
|
|
|
Im not too sure what you mean by "recalculate the pixel's offset and convert to a DWORD each time" because i dont think im doing that now. This is my code it compares each pixel in the 2 dc's :
<br />
for (int w = 0; w < width; w++)<br />
{<br />
for (int h = 0; h < height; h++)<br />
{<br />
if (GetPixel(hdcOld, w, h) != GetPixel(hdcNew, w, h))<br />
{<br />
SetPixel(dcNew, w, h, RGB(255, 255, 255));<br />
pixelCount++;<br />
}<br />
else<br />
{<br />
SetPixel(dcNew, w, h, RGB(0, 0, 0));<br />
}<br />
}<br />
}<br />
|
|
|
|
|
Maybe you are not doing it yourself, but what do you thing GetPixel() is doing internally? Each time you call it, it must first read the header, get the bits, calculate the size of a pixel, calculate the the size of a row, calculate which row, calculate how far into that row, get the pixel, convert it to a COLORREF then give it back to you. ALL FOR ONE PIXEL! This is for every single call.
If you use a dib, you can do all that calculating yourself and do it only once.
|
|
|
|
|
So how would i do it using dib, im pretty new to c++?
|
|
|
|
|
have a search of the GDI and bitmap articles, there are quite a few DIB wrappers available.
|
|
|
|
|
Ok so i have put my bitmaps in DIB's and placed them in seperate dc's but what function do i use now instaed of getPixel()?
|
|
|
|
|
There is no specific function. If you have downloaded and integrated one of the DIB wrapper classes, derive a new class from it and add a new member.
Lets say you are scanning a web-cam image and you want to get every 10th pixel. In your new function, get the images-bits from the base class which is just one big array of pixels. Calculate the bitmaps paramaters, then in a loop calculate which pixels you want ( y * bitmapwidth_inbytes + x ) and read them from the array.
Just remember, with a DIB, the pixels are not always a 32 value like you get back from GetPixel. They could be:
1 Bits ( 0 == black, 1 == white )
4 Bits ( 1 byte with two indexes into the color table )
8 Bits ( an array of bytes each representing an index into the color table )
16 Bits ( an array of WORD each representing an index into the color table )
24 Bits ( an array of DWORD look on MSDN for RGBQUAD )
32 Bits ( an array of DWORD look on MSDN for RGBQUAD )
64 Bits ( only windows vista supports these I think )
By far, the easiest to deal with are 24 and 32 bit images, all of the others use a color table. If you need the actual COLORREF value, then you must calculate it from whatever value you get from the array.
|
|
|
|
|
Hi !!
I have one main method and now i want to call this main method in another method..
for example...
void NORMAL()
{
}
void MAJOR ()
{
Here i want to call void NORMAL() method
}
In void MAJOR () method, I want to call void NORMAL ()..
how can i call it ??
Both are in same .cpp file..n i have no class.
Thanking you..
Shah
|
|
|
|
|
what about :
void MAJOR()
{
NORMAL();
}
This is rrrreeeaaallllyyyy basic stuff, or I did not understood the question.
|
|
|
|
|
oppsss..Really really sorry.. i have Problem in my code..
|
|
|
|
|
and what might be the problem ?
|
|
|
|
|
void MAJOR ()
{
NORMAL();
}
Come on, this is really beginner stuff! Aren't you calling your MAJOR() function from somewhere else? Where's it getting called from?
|
|
|
|
|
oppsss..Really sorry..Problem in my code..
|
|
|
|
|
Is this a specifc question or simple question?
|
|
|
|
|
Heee heee..This is not Specific nor Simple.. but its stupid question..Actually i tried same code but it was not working.. problem was in my code but in method.
|
|
|
|
|
Not problem,one thing is important that you could find your problem Its good;)
|
|
|
|
|
I'm getting a bad value when doing a drag-right-click ( doing a selection with the right mouse button) in a CTreeCtrl.
This is the callback for the NM_RCLICK notification.
void CAboutDlg::OnTreeRclick( NMHDR* pNMHDR, LRESULT* pResult )
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hSelItem = pNMTreeView->itemNew.hItem;
if ( hSelItem == NULL )
{
return;
}
}
Sometimes, the hSelItem tree item is not a valid item ( for example : 0x0000008d ) which is not valid.
I alse tried this where ptDrag is supposed to be the "structure that contains the client coordinates of the mouse at the time the event occurred that caused the notification message to be sent. (from MSDN) "
CPoint point( pNMTreeView->ptDrag );
UINT uHF;
HTREEITEM hItem;
hItem = m_Tree.HitTest( point, &uHF );
But the point is mostly invalid.
I also use which works, but seems not to be the right way to do it.
UINT uHF;
HTREEITEM hItem;
CPoint point;
GetCursorPos( &point );
m_Tree.ScreenToClient( &point );
hItem = m_Tree.HitTest( point, &uHF );
Thanks for you help and/or suggestions.
Max.
|
|
|
|
|
Some of the tree notifications don't set the itemNew element in the NM_TREEVIEW structure. As a result, it can be filled with random garbage.
Another thing to remember is that the right click notification happens whenever you right click on the tree control. If you're doing that over an area that doesn't include an item, you'll need to detect that.
IIRC, the last time I did this kind of stuff with a tree control, I ended up with a similar approach.
Sorry I'm not giving you more definite answers here. I'm working from memory, and don't have access to the code where I was dealing with this stuff.
Software Zen: delete this;
|
|
|
|