|
surezu wrote: draw a transparent rectangle
Here try the following code:
void DrawTransparentRectangle( CDC& dc, Rect rc)
{
// the next line draws a transparent rectangle
// there now can you see it?
// i'm sure it is there, look again
}
|
|
|
|
|
Ha! I can see right through your reply
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
what is the problem u r facing right now?
if u r problem is that u r rectangle drawn with Rectangle()masks u r bmp then draw 4 lines simple.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
i'm having a CBitmap object, which will contain 2546x3288 size image,loading from bmp file.i need to draw a rectangle on that image witout lossing of background image...
void SFormViewer::OnPaint()<br />
{<br />
CPaintDC dc(this);
<br />
if(flag_iInitPaint)<br />
{<br />
CRect rClient;<br />
GetClientRect(&rClient);<br />
<br />
CPen m_Pen;<br />
m_Pen.CreatePen(PS_SOLID,2,RGB(250,0,0));<br />
<br />
CDC m_memDC;<br />
m_memDC.CreateCompatibleDC(&dc);<br />
m_memDC.SelectObject(&m_FormImage);<br />
m_memDC.SelectObject(&m_Pen);<br />
m_memDC.SetBkMode(TRANSPARENT);<br />
<br />
r_SelectedRect.SetRect(m_iShownImgTopX + p_iTopLeft.x, m_iShownImgTopY + p_iTopLeft.y, m_iShownImgTopX + p_iBottomRight.x, m_iShownImgTopY + p_iBottomRight.y);<br />
<br />
if(flag_Scroll == 0)<br />
{<br />
m_memDC.Rectangle(r_SelectedRect);<br />
<br />
}<br />
<br />
dc.BitBlt(0,0,rClient.Width(),rClient.Height(),&m_memDC,m_iShownImgTopX,m_iShownImgTopY,SRCCOPY);<br />
<br />
}<br />
}
|
|
|
|
|
surezu wrote: r_SelectedRect.SetRect(m_iShownImgTopX + p_iTopLeft.x, m_iShownImgTopY + p_iTopLeft.y, m_iShownImgTopX + p_iBottomRight.x, m_iShownImgTopY + p_iBottomRight.y);
if(flag_Scroll == 0)
{
m_memDC.Rectangle(r_SelectedRect);
}
what i suggest is, instead of using memDC.rectangle,
use like this.
say if you want to draw rectangle from (x1,y1) to (x2,y2)
moveto(x1,y1);
lineto(x2,y1);
moveto(x2,y1);
lineto(x2,y2);
moveto(x2,y2);
lineto(x1,y2);
try to guess the next part of the code.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
chandu004 wrote: what i suggest is, instead of using memDC.rectangle,
Why is 8 lines of code better than 1?
Inquiring minds want to know...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Rectangle draws a rectangle filled with the current selected brush.
Try selecting a null/hollow brush into the memDC instead of setting the background
mode to transparent
CBrush HollowBrush;
HollowBrush.CreateStockObject(HOLLOW_BRUSH);
CBrush *pOldBrush = m_memDC.SelectObject(&HollowBrush);
...
<draw your rectangle>
...
m_memDC.SelectObject(pOldBrush);
It's also a good idea to get into the habit of saving objects
previously selected into DCs so you can select them back in
when you're done with the DC. This will prevent resource leak problems.
Also....what happens if the bitmap isn't compatible with the memDC??
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
See Graphics::DrawRectangle on the MSDN.
|
|
|
|
|
Can any body help me to access printer in VC++
Thanks in advance
|
|
|
|
|
1) Click the top left corner of the page where it has the Bob Image and says "The Code Project"
2) After the home page loads look in the left column for the black bar that says "Sections"
3) Under Sections look for "General C++" and click it. That will open a new list of choices
4) Click "Printing"
Good luck
|
|
|
|
|
if you want to print you can use of StartDoc EndDoc for get name of printers see EnumPrinters .
|
|
|
|
|
Hi All,
I am using MFC Application.I am going to include Existing project in to my Project's Workspace.
I have new project of type static library OK.Noew I got problem when I am going to include header file of that new project in my MFC project's class.I got error like below.......
1>d:\testing_and_download\testing\testrtmp_working\testrtmp\rtmpdesk.h(2) : fatal error C1083: Cannot open include file: 'omnithread.h': No such file or directory
Here,
omnithread is my new project and in that I have omnithread.h file.In this project I have used the thread classes which i want to access here in my MFC project.
Ok. Thanks In Advance.
Ashish
|
|
|
|
|
use Full path or absolute path
like "..\\newprojectfoldername\\omnithread.h"
|
|
|
|
|
When I give the full path then it gives the error like...........
1>d:\testing_and_download\testing\testrtmp_working\testrtmp\omnithread\omnithread.h(137) : fatal error C1189: #error : "No implementation header file"
And I hope It comes from omnithread.h file in which I have defined like..........
****************************************************
#if defined (_OMNITHREAD_DLL) && defined(_WINSTATIC)
#error "Both _OMNITHREAD_DLL and _WINSTATIC are defined."
#elif defined(_OMNITHREAD_DLL)
#define _OMNITHREAD_NTDLL_ __declspec(dllexport)
#elif !defined(_WINSTATIC)
#define _OMNITHREAD_NTDLL_ __declspec(dllimport)
#elif defined(_WINSTATIC)
#define _OMNITHREAD_NTDLL_
#endif
// _OMNITHREAD_DLL && _WINSTATIC
#else
// Not using MSVC++ to compile
#define _OMNITHREAD_NTDLL_
#endif
// _MSC_VER
#elif defined(__sunos__) && (__OSVERSION__ == 5)
#ifdef UsePthread
#include <omnithread posix.h="">
#else
#include <omnithread solaris.h="">
#endif
#elif defined(__linux__)
#include <omnithread posix.h="">
#elif defined(__nextstep__)
#include <omnithread mach.h="">
#elif defined(__VMS)
#include <omnithread posix.h="">
#elif defined(__SINIX__)
#include <omnithread posix.h="">
#elif defined(__osr5__)
#include <omnithread posix.h="">
#elif defined(__irix__)
#include <omnithread posix.h="">
#else
#error "No implementation header file" ///////////ERROR Message Is like this
#endif
******************************************************************
Sorry for big code but I hope error comes from here and I have no that to much idea about this definition.
Thanks Hiru.
Ashish
|
|
|
|
|
|
The data packets received from NIC may have Indefinite length,and among the data may include '\n','\t','\0',and so on .
If I do not want to new and delete a char ** every time according to the size of data packet , are there any advanced tools or structurs can be used? Thanks for your help~
Never to say never~
|
|
|
|
|
can you put your question more clearer?
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
Michel_Huang wrote: are there any advanced tools or structurs can be used?
Yes, and guess how they work? They will new and delete heap memory every time according to the size of data packet. Standard Template Library[^]
|
|
|
|
|
ye~ I see ,thank you ~
Work hard. Laugh often. Keep your honor. Never to say never
|
|
|
|
|
If you're using UDP packets, the recv API does not allow you to read a bit of the packet then the rest of the packet. It gives you the data up to the size of the buffer you supply then discards the rest. Peeking to find out how much data is present is unreliable. You should define a maximum size packet supported and use a buffer that size. You can simply reuse the buffer once you've processed the data. The maximum packet size supported by the TCP stack can be retrieved with getsockopt , passing the SO_MAX_MSG_SIZE parameter.
TCP does not preserve message boundaries. What you see at the receiver can be only part of a single call to send or it can be the result of multiple calls to send . If required, you must put some kind of framing on top of the raw data. Best practice is again to define a fixed size buffer and be prepared to handle any size of data that's returned, which can be as low as one byte.
You should probably read the Winsock Programmer's FAQ[^].
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Thank you ~
Work hard. Laugh often. Keep your honor. Never to say never
|
|
|
|
|
I am using vfw to extract frames from an avi files. I;d like to know if the bit depth of the frame is available in the AVIFILEINFO structure or in any other structure.
|
|
|
|
|
Assuming you mean video...
You need to get that from the appropriate stream. That means you need to
use AVIStreamReadFormat() or open the stream and read a frame to get a BITMAPINFO struct.
From that struct, the BITMAPINFOHEADER.biBitCount field is what you want.
See AVIStreamReadFormat(), AVIStreamGetFrameOpen(), AVIStreamGetFrame(), etc.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I know there is a fund raiser thermometer on this site, but I don't know how to install it. I want to install a "indicator" on my blog toward a financial goal. Does anybody know where I can get one from or can you help me use the one that's on here.
Thanks
|
|
|
|
|
can you explain me what a fund raiser thermometer is?
please...
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|