🜲 Samapico Posted December 22, 2007 Report Posted December 22, 2007 I'm trying to figure out how to draw stuff kind of like I would with the BitBlt API. However, I want to use native C# functions in System.Drawing. I'm not sure at all how all that works... I have Bitmap objects, I want to copy parts of them somewhere on a picturebox (or whatever would work). So far I've only been able to draw something, but it would get erased as soon as the control is redrawn (i.e. minimize window / restore). In VB6, I would use a picturebox with 'auto-redraw' set to OFF, then BitBlt bitmap data on the picturebox's hDC, and it would stay there. Has anyone done something similar in C# (or VB.net or Java would be close enough, I guess)? http://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Half-Life_Black_Mesa_logo.svg/120px-Half-Life_Black_Mesa_logo.svg.pngDCME co-developerSSCU 17th Parallel sysop
★ D1st0rt Posted December 22, 2007 Report Posted December 22, 2007 If I had to guess I would say put your custom drawing code in an event handler that gets called whenever the target control gets redrawn _UU___UU__SSSSS____AAA____UU___UU__SSSSS____AAA____UU___UU_SS_______AAAAA___UU___UU_SS_______AAAAA___UU___UU__SSSSS__AA___AA__UU___UU__SSSSS__AA___AA__UU___UU______SS_AAAAAAA__UU___UU______SS_AAAAAAA___UUUUU___SSSSS_AA____AA___UUUUU___SSSSS_AA____AAJ.C. Dento> prime example of why america will never be a world super power.Moscato> d1 is mad he will never have a job outside subspaceI can't see this because I turned signatures off. ps VT
🜲 Samapico Posted December 22, 2007 Author Report Posted December 22, 2007 That is most likely going to suck performance-wise... I'm pretty sure it is possible to draw stuff "permanently" http://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Half-Life_Black_Mesa_logo.svg/120px-Half-Life_Black_Mesa_logo.svg.pngDCME co-developerSSCU 17th Parallel sysop
★ D1st0rt Posted December 22, 2007 Report Posted December 22, 2007 In the limited work I've done with graphics, the entire screen was redrawn every time. Granted I wasn't using GDI, but I wouldn't be surprised if it behaved in a similar manner. It's possible that your "permanent" drawing just does this behind the scenes. _UU___UU__SSSSS____AAA____UU___UU__SSSSS____AAA____UU___UU_SS_______AAAAA___UU___UU_SS_______AAAAA___UU___UU__SSSSS__AA___AA__UU___UU__SSSSS__AA___AA__UU___UU______SS_AAAAAAA__UU___UU______SS_AAAAAAA___UUUUU___SSSSS_AA____AA___UUUUU___SSSSS_AA____AAJ.C. Dento> prime example of why america will never be a world super power.Moscato> d1 is mad he will never have a job outside subspaceI can't see this because I turned signatures off. ps VT
Smong Posted December 22, 2007 Report Posted December 22, 2007 If this is for a frontend, and you plan to allow animation, then you're going to be drawing constantly anyway.
⛊ Drake7707 Posted December 22, 2007 Report Posted December 22, 2007 In VB6, I would use a picturebox with 'auto-redraw' set to OFF you mean autoredraw = true
★ doc flabby Posted December 22, 2007 Report Posted December 22, 2007 quick search on google threw this up http://www.informit.com/articles/article.a...57&seqNum=8and this.http://www.codeguru.com/csharp/csharp/cs_g...icle.php/c6147/ Rediscover online gaming. Get Subspace.Owner of the PlaySubSpace Network (level 0 BanG) and PSSF server
🜲 Samapico Posted December 22, 2007 Author Report Posted December 22, 2007 In VB6, I would use a picturebox with 'auto-redraw' set to OFF you mean autoredraw = trueyeah, probably... I just remember we had to change it Actually that makes sense... it means whatever you put in it will be repainted everytime... ok then, I'll have to draw on a bitmap, and paint the bitmap on every Paint event. Thanks for these links doc, my searches on google weren't as successful http://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Half-Life_Black_Mesa_logo.svg/120px-Half-Life_Black_Mesa_logo.svg.pngDCME co-developerSSCU 17th Parallel sysop
🜲 Samapico Posted December 23, 2007 Author Report Posted December 23, 2007 http://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Half-Life_Black_Mesa_logo.svg/120px-Half-Life_Black_Mesa_logo.svg.pngDCME co-developerSSCU 17th Parallel sysop
Recommended Posts