|
Using CxImage, I'm loading a PNG from a dll. The png has some transparent parts. When I display the image on the screen, the transparency seems to be ignored. I've looked thru the code but just can't seem to find what I am looking for. Can someone provide a sample or point me in the right direction.
Snip-it of my code from my ::OnPaint() handler (error checking has been removed):
CxImage *image = new CxImage();
HRSRC hres;
hres = FindResource( dll->getModuleHandle(), "#5099"; , "PNG");
image->LoadResource( hres, CXIMAGE_FORMAT_PNG, dll->getModuleHandle());
image->Draw2( dc, 10, 10, 247, 52);
I get the image but the transparent parts are not transparent.
Thanks,
Randy
|
|
|
|
|
Hello,
I need to draw some rectangle which each has a dot in the centre.
The dot representing the x and y cordinates.
Can anyone help.
lvidot
|
|
|
|
|
Check MoveTo and LineTo , FrameRect and
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
How can I do something like TRACE if I'm not using MFC or ATL ?
I want my function that displays complex data structures to be able to show the result somewhere inside the IDE.
//Peter
|
|
|
|
|
VOID OutputDebugString(
LPCTSTR lpOutputString // pointer to string to be displayed
);
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Ah, so easy...
Almost embarrassing I didn’t find it myself.
Unfortunately my project is compiled without language extensions (also developing on other targets) and without them I cannot include windows.h .
Do you know the correct signature for this function ?
I have tried with
extern "C" void OutputDebugString( char const * );
extern "C" void _cdecl OutputDebugString( char const * );
but the linker wouldn't have any of that.
Or is there a pragma to enable language extensions for a small part of a source file?
Thanks a lot // Peter
|
|
|
|
|
How about:
__declspec(dllimport) void __stdcall OutputDebugString(const char *);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
In case anyone else was looking for this info here is what finally
worked ok.
extern "C" void __stdcall OutputDebugStringA(const char *);
|
|
|
|
|
|
Has anyone run into the problem of suddenly a CMapStringToOb member becomes invalid? Not a pointer either! After initialization it is valid but when I start to add an object I call assertvalid and it asserts!
ed
|
|
|
|
|
Sounds like someone is overwriting memory....
onwards and upwards...
|
|
|
|
|
I am working on a project where Im reading values from a machine every second, I then increment these values in a file, and then graph this file, every second I reset the plot and graph it again with the new values, when I reach the end of the upper bound of the x-axis, I want the lower and upper bounds to increment by 1 every second, Im working inside a forever loop and the code looks like so:
x=0; y=0;<br />
char* s;<br />
for( ;; )<br />
g1.plot_dataFile("data.dat", "test");<br />
Sleep(1000);<br />
g1.reset_plot();<br />
<br />
x++;<br />
if(x>20)
{<br />
y++;<br />
sprintf(s, "set xrange [%i:20+%i]", y, y);<br />
g1.cmd(s);<br />
}<br />
}
g1.cmd(string s) is a function to send commands to an external plotting application, and needs to take strings
While running, when x reaches 20, I get "Run-Time Check Failure #3 The variable 's' is being used without being defined."
Any help please!!!
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
did you post all of your code? It looks like s never gets a value at all! You simply declare it:
char *s;
But never assign anything to it.
(p.s., at the very least, you should assign NULL to it when it is first created. Just good programming practice. )
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
Your right, I just set a large buffer for s and it worked
char s[1024] = {0};
Thanks v.m.
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
allocate a space in the s pointer before 'sprintf'ing in it
try calloc or a big buffer
like char s[1024] = {0};
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Excellent, that worked a charm,
Thanks!
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
Just curious, but shouldn't x be reset to 0 once it exceeds 20?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
No!, what i want is the graph to increment indefinatly every second, so when x reaches 20 then the lower and upper bound of the x-axis on the graph will increment, in other words the x-axis will show from 1-21, then 2-22, 3-23, and so on.
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
Hey everyone how do I get rid of flickering in a childview in an mfc app? I have to views divided by a splitter bar. I've tried using CMemDC and I believe it gets rid of the flicker, however it seems to remap my view so stuff is drawn in a different location then what it is supposed to be.
my view's OnDraw looks like this
{
CMemDC pDC(dc);
CDocument* pDocBase = GetDocument();
CBaseStationDoc* pDoc = (CBaseStationDoc*)pDocBase;
CRect rcClient;
GetClientRect(&rcClient);
// Fill Background Color, Black
pDC->FillSolidRect(rcClient, RGB(0, 0, 0));
// Remap ViewportOrg to hor. center of client window and 100 pixels vertically top down.
int nXCoord = rcClient.Width()/2;
int nYCoord = rcClient.Height()/2;
pDC->SetViewportOrg(nXCoord, 100);
// Draw Robot Sensors
DrawSensors(nXCoord, nYCoord, pDC);
pDC->SetViewportOrg(nXCoord, nYCoord);
// Draw Sensor Table
DrawTableOfSensors(pDC);
}
When this code executes I can only see the bottom right quarter of what I normally see when the CMemDC line above is commented out, and dc is changed back to pDC
Any ideas?
|
|
|
|
|
Try making sure that the parent window of this is returng FALSE from it's handling of WM_ERASEBKGND. Also, making the parent window's background brush NULL may also help (see PreCreateWindow and AfxRegisterWndClass).
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Well its stopped flickering, but the viewportorg is all screwed up or something because of the CMemDC class.
If you type in CMemDC in google or something you'll see what I'm talking about.
|
|
|
|
|
I have converted most of the VCF to now store it's string data in unicode (UTF16).
If the program is running on Win9.x it translates strings back down to ansi. What I am not sure of is how, given a certain locale, do I know which char set (or code page?) to use?
For example, lets say I want to draw the text for "Hello" in polish. When converted from Unicode to ansi, with the default ACP, I end with certain values that are beyond the ascii number 128.
Does changing the locale (using SetThreadLocale) also change to the right char set? If it doesn't then how do I know which to use? Is it up to me to figure this out? I am assuming that "char set" and "code page" mean the same thing.
I am presuming that if I do not set this correctly, then when I translate the unicode to ansi string, and draw it, it will not draw the right characters.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Actually, I believe the charset used to display a string has to do with the font used to render the text. A font can be created with a particular character set (assuming that font supports the charset you specify.)
When using WideCharToMultiByte, you can specify the code page. I've always used the default CP_ASP and it seems to work, as long as the font is correct, but I tend to just read strings from a file and display them - nothing much more complicated than that.
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
Ahh, OK that makes sense. Do you remember/know how to do this?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
CreateFont takes a charset as one of its parameters. It can be ANSI_CHARSET, RUSSIAN_CHARSET, etc.
The trick, of course, is to make sure you have fonts supporting that character set. You can do this with EnumFontFamiliesEx .
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|