|
Tried the following code.
CDC* pDC = m_Window.GetDC();
Graphics graphic( pDC->GetSafeHdc());
CRect wRect;
m_Window.GetClientRect( &wRect );
wRect.DeflateRect( 0, 0, 1, 1 );
RectF rect( wRect.left, wRect.top, wRect.Width(), wRect.Height());
Color color;
color.SetFromCOLORREF( RGB( 100, 0, 0 ));
Pen pen( color );
graphic.DrawRectangle( &pen, rect );
rect.Inflate( -0.5, -0.5 );
Color color2;
color2.SetFromCOLORREF( RGB( 0, 100, 0 ));
Pen pen2( color2 );
graphic.DrawRectangle( &pen2, rect );
But the graphic.DrawRectangle( &pen2, rect ); draws the rectangle in the next pixel.
Is there anything additional to do to work the floating points?
regards,
Krishnakumar
|
|
|
|
|
Do you want to break the pixel?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Do you want to break the pixel?
You can do it, but the stuff that oozes out will make the image blurry...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: You can do it, but the stuff that oozes out will make the image blurry..
If so, what is the change I should make in my code?
Regards,
Krishnakumar
|
|
|
|
|
Krishnakumartg wrote: If so, what is the change I should make in my code?
You'll need to include schematics in your comments on how to build a tiny hammer. Then you'll be able to break just one pixel.
|
|
|
|
|
Nah: the pixel is the atomic graphic unit and, you known, the atom is indivisible...oops
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Don't believe the physicists... You crack open a pixel it oozes GUI goodness!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: You crack open a pixel it oozes GUI goodness!
Yeah - GUI Goodness and dangerous radiation. Want all your users growing a third arm, grabbing torches and pitchforks, then storming your office looking for blood? Then go right ahead, crack them pixels, address their internals like it's 1950 and Buck Rogers is gonna save the day in time for supper... 'Cause he ain't, and when your head is on a (pixelated) pike and the guys in bunny suits are cleaning up your mess, don't try using your undead lips to say i didn't warn you...
---- You're right.
These facts that you've laid out totally contradict the wild ramblings that I pulled off the back of cornflakes packets .
|
|
|
|
|
Mark Salsbery wrote: Don't believe the physicists...
I know: I'm physicist...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Actually I just wanted to know whether it is possible or not?
And if possible how can it do that?
Regards,
Krishnakumar
|
|
|
|
|
Krishnakumartg wrote: Actually I just wanted to know whether it is possible or not?
Yes, it is.
Krishnakumartg wrote: And if possible how can it do that?
For instance, with a hammer.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Krishnakumartg wrote: can I draw a rectangle with values (0.5, 0.75, 100.1, 100.4) or something like that
not without changing your mapping mode and viewport[^].
Krishnakumartg wrote: according to my understanding pixel is the smallest possible drawing resolution
that is correct; you can not turn on 1/2 of a pixel. the best you can do is let Windows change the coordinate system you use to refer to the physical pixels. so, you can draw that rectangle, and have 100.1 appear at a different location than 100.0. but all you've really done is changed the way Windows interprets your drawing coordinates.
|
|
|
|
|
Hi All
I have connected external (USB ) Hard Disk of 250 GB,which have been detected as local drive by system.How can i recognize it as external (Logical) drive?
|
|
|
|
|
Use GetLogicalDrives(), GetLogicalDriveStrings() and GetDriveType().
|
|
|
|
|
Hey everybody!
How can I get the thread count of a process - like in task manager?
I have a handle to that process, but I can't find a way to get the count of the running threads.
Does anyone know how to do that?
Thanks!!!!
|
|
|
|
|
First get the process id from your handle by calling GetProcessId() . Then Iterate the process in system[^] and locate your process by matching the process id. Then you'll get the total count of threads from PROCESSENTRY32.cntThreads .
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks!
|
|
|
|
|
need a code returning the current path of my exe
thx
|
|
|
|
|
|
You can use _pgmptr .
Regards,
Krishnakumar
|
|
|
|
|
I have created a tree control and added few items in it.
And i have used TVN_SELCHANGED notify message as below.
But i am not able to get item names using LPNMTREEVIEW structure instead its showing junk chars.
void CMyDlg1::OnTvnSelchangingTreectrl(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<lpnmtreeview>(pNMHDR);
CString str = pNMTreeView->itemNew.pszText;
CString str1 = m_TreeCtrl.GetItemText(m_TreeCtrl.GetSelectedItem());
.....
}</lpnmtreeview>
|
|
|
|
|
According to MSDN, that is to be expected.
"The itemOld and itemNew members of the NMTREEVIEW structure are TVITEM structures that contain information about the previously selected item and the newly selected item. Only the mask, hItem, state, and lParam members of these structures are valid. The stateMask members of the TVITEM structures specified by itemOld and itemNew are undefined on input."
TVN_SELCHANGED Notification[^]
|
|
|
|
|
using
int DialogWidth = GetSystemMetrics(SM_CXSCREEN);
int DialogHeight = GetSystemMetrics(SM_CYSCREEN);
system Resolution is get but how to set System Resolution(by giving width and height) using code is there some methods?
|
|
|
|
|
To set screen resolution, you've to use ChangeDisplaySettings(). For that this[^] will help you. May need to have a look at this[^] too. And I think you can dig out better how to use them.
|
|
|
|