|
Hi all,
I've got a form with a number of picture boxes. I now want to add a small picturebox on top of these main boxes and be able to see the main box through the small box. If I set the background colour to transparent it, as you probably know, will show the main forms background. Is there a way that I can set the parent of the small box to be the main box?
If not how do I go about creating a picturebox that does have true transparency. I presume I can write my own pictureBox class but don't know how and what I would need to override. Does anyone have any idea because I'm dying here guys!!
|
|
|
|
|
Forget the stupid picture box and draw your own image onto the screen.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
So how do I draw a transparent image?
|
|
|
|
|
Use the DrawImage method that takes an ImageAttributes class instance. That class does many things, transparency is one of them.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ok, I've used drawimage and imageattributes to make my image transparent. Now how do I float this image over a picturebox control (it seems to be painted under the control).
What I'm basically looking for is an image on the form that will change size and position dynamically. I need to be able to set things like cursors when I'm over a certain area of the image. So my idea was to float another image over the top and use this region to set cursors. The only way to use cursors I've found at the moment is by using forms controls (hence the pictureboxes). I've tried using rectangles and regions but I get the same problem as I'm now getting with images - they seem to be hidden under the picture.
I've tried overriding picturebox but can't seem to get it working. In fact anything I try doesn't produce the goods.
|
|
|
|
|
richiemac wrote:
What I'm basically looking for is an image on the form that will change size and position dynamically.
Sounds like you want to write your own control, from the total base class, that draws these images for you. A picture box will not work for this, that's why I said to draw yourself.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Could you please point me towards a good tutorial on this subject as I'm totally new to this stuff. From what I gather I would have to write my own paint events - is that right??
|
|
|
|
|
That's right. If you search this site for user control, you'll get heaps of hits.
This[^] and this[^] look like good places to start.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi all, I've run into some problems with a template I'm trying to do.
First of all I declared a class and its members in a header file.
eg:
class SomeClass
{
public:
SomeClass(void);
~SomeClass(void);
int SomeFunction(int &, int &);
private:
int someVars;
};
and then defined the class and its members in a source file.
This all worked fine, and run as expected.
but because it's for a library I'm writting, I need it to handle multiple datatypes, so naturally I turned the relivent parts into templates.
The problem is, the template only works if the whole class is declared and defined in the header file. If I try to put the definitions into a source file, I get undefined errors popping up everywhere.
Is there a way and could someone explain how I can declare a template in a header file and define it in a source file. It just keeps things somewhat tidy.
Regards
|
|
|
|
|
hello again :P, my modifing is broken. anyway on a final note to defining / declaring template...
in the eg shown above I had added something similar to
template <typename datatype="">
class SomeClass
{
...
}; replaced all the int's with DATATYPE.
in the source file I was messing around and have tried a few things like
template <typename datatype="">
SomeClass<datatype>::SomeClass(void) { }
... etc etc
I've tried other variouis things, but I haven't found a solution, the net hasn't been much help as of yet.
N/B: Not to worry, I have just read they have to be declared and defined in the same file, grrr. well I have to live with what I've got
Freedom doesn't come without a fight.
|
|
|
|
|
I have made it.
So:
Create cpp file and h file. the cpp file will have strange error. Right click on that cpp in solution explorer. Find Precompiled headers under C/C++. Under option "Create/Use Precompiled Header" chose "Not Using Precompiled Headers"
|
|
|
|
|
hello,
i want to send an XML file as an argument to a function which is being tested in CPPUNIT. how do i parse the entire file
thanks
|
|
|
|
|
I had to google CPPUNIT to find out what it was.
It would be better if you would post the actual code so we can see what you are doing.
The System::Xml namesapce has a number of well-developed classes that can used to read XML data into memory. The most obvious is: XmlReader. But, in your case, (I'm guessing here) you might prefer XmlDocument or the Navigator object that be created for XmlDocument.
Read the documentation; these classes are easy to use and almost foolproof.
|
|
|
|
|
hi
I've started R&D work on a USB-232 converter cable (comply with FCC standards).
My application (C++ driver on Linux OS) tries to connect with a device & communicates via this cable.(the device is connected to the rs232 port & PC is connected to the USB port)
I'd tested with the RS232 cable & now I want to use this USB-232 converter cable.
Are there any libraries or sample source codes to do that.
Thanks
|
|
|
|
|
It's a bit misleading IMO, but C++/CLI is the managed C++ forum. Either way, I suspect this is the wrong place to ask how Linux provides USB libraries. By all means, ask in the C++ forum, but I'd be looking at also asking where more people use Linux.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi
I need to convert a char a[8000] to a String* (in .NET)
how do I do it?
<br />
String * b = (String *) a;
will crash at a certain point.
thanks alot
|
|
|
|
|
A String does not contain a char *, it's a Unicode string. At a minimum, you'd need to turn your pointer into a BSTR, I would think. Either way, you can't cast a char * to a string type, you need to pass the byte array into a constructor. That memory address contains an array of bytes representing character data, it does NOT contain an instance of hte String class, which encapsulates a Unicode string.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
char a[8000] = "hello";<br />
String * b = new String(a);
|
|
|
|
|
It works well for me.
you can try also this:
char a[8000] = "hello";
String * b = new String(S"");
b = Convert::ToString(a);
|
|
|
|
|
I've got an unmanaged varargs function:
print(char*, ...);
And I've got an exception:
catch (System::Exception *ex)
And I try to print it:
print("%s", ex->Message);
And I get 5 weird symbol characters in the output. What's going on? Am I doing something wrong here? I check Message in managed code and it's fine. Print works fine too, for everything else.
|
|
|
|
|
Just a guess, maybe it's because ex->Message is in Unicode? And your print function only works on ANSI NULL terminated strings?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
ur char* is probably pointing to sumthing in the memory thats not a string
so when u print it it shows u the ascii values of the numbers in the memory
give me the complete code and ill tell u wut ur doin wrong
|
|
|
|
|
Hey,
When migrating VC6 projects to VC7 I often get this warning when compiling the source files that were original VC6 project files that did not emit this warning:
[Warning C4005: 'UNICODE' macro redefinition] with the warning level set to 3
Is there an option or switch I have set wrong?
Best regards,
Bill
|
|
|
|
|
I have added reference of COM: "Microsoft DAO 3.6 Object Library"
Object *pLang = S"dbLangGeneral";<br />
Object *pSrc = S".\\Data\\Database.mdb";<br />
Object *pDes = S".\\Data\\Database.com";<br />
dao::DBEngine::ompactDatabase(pSrc->ToString(), pDes->ToString() , pLang, 0, NULL);
I Got "error C2352: 'dao::_DBEngine::CompactDatabase' : illegal call of non-static member function"
How can i correct it.
|
|
|
|
|
Saksida Bojan wrote:
dao::DBEngine::ompactDatabase
Should that read CompactDatabase ?
Saksida Bojan wrote:
I Got "error C2352: 'dao::_DBEngine::CompactDatabase' : illegal call of non-static member function"
The function you're trying to call is not static, and so needs an instance of the class to call it.
Christian Graus - Microsoft MVP - C++
|
|
|
|