|
-
Sep 1st, 2000, 02:26 PM
#1
Thread Starter
Addicted Member
You can use these two alternative options:
1. Hide PictureBox then draw whatever you want on it (don't forget to set AutoRedraw property to TRUE). After drawing make it visible (in other words, show it).
2. Use two PictureBox controls. One will be always visible, and the other will be always hidden. After drawing to hidden PictureBox (AutoRedraw = True - look up), put image into visible PictureBox like this:
PictureBox1.Picture = PictureBox2.Image
Hope this helps...
-
Sep 1st, 2000, 06:43 PM
#2
New Member
yeah.. thats what i normally do, but it is very slow, which is why i wanted to try doing it in memory, i think it would be faster
-
Sep 1st, 2000, 06:53 PM
#3
Thread Starter
Addicted Member
whell...that goes beyond my posibilities 
Maybe you'll find something on Microsoft's SDK pages. Go to http://msdn.microsoft.com/library/default.asp
[Edited by Arcom on 09-01-2000 at 08:04 PM]
-
Sep 2nd, 2000, 06:48 AM
#4
Fanatic Member
Here a typical example to draw something in memory => much faster!
Code:
'...
hDCTmp = CreateCompatibleDC(0)
hBMTmp = CreateCompatibleBitmap(Picture1.hdc, Picture1.ScaleWidth, Picture1.ScaleHeight)
HBMPrv = SelectObject(hDCTmp, hBMTmp)
'...
SetPixel (hDCTmp, x, y, RGB(c1,c2,c3))
'...
'Copy the picture in the memory DC to Picture1
BitBlt Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, hDCTmp, 0, 0, vbSrcCopy
'...
'Clean Up (Form_Unload event)
SelectObject hDCTmp, HBMPrv
DeleteObject hBMTmp
DeleteDC hDCTmp
-
Sep 2nd, 2000, 09:44 PM
#5
New Member
-
Sep 14th, 2000, 03:16 PM
#6
The best way to make this is to create a virtuell Metafile in the memory. Its very fast and take only a little part of your memory
Public Declare Function CreateMetaFile Lib "gdi32" Alias "CreateMetaFileA" _
(ByVal lpString As Any) As Long
Public Declare Function CloseMetaFile Lib "gdi32" (ByVal hMF As Long) As Long
Public Declare Function PlayMetaFile Lib "gdi32" (ByVal hdc As Long, ByVal hMF As Long) As Long
Public Declare Function DeleteMetaFile Lib "gdi32" (ByVal hMF As Long) As Long
Public Declare Function SetBkColor Lib "gdi32" (ByVal hdc As Long, ByVal crColor As Long) As Long
Public Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
mlngMMF = CreateMetaFile(ByVal 0&) ' mlngMMF is the Hdc of the Metafile
SetBkColor mlngMMF, vbWhite 'set the backgroundcolor to white
SetBkMode mlngMMF, 1 'make the background transparent
now you can paint with API- calls
if you are finished then make this
mlngMMF = CloseMetaFile(mlngMMF) ' you will get back a new Hdc
to paint the metafile you need this command
PlayMetaFile Picturebox1.hdc, mlngMMF
-
Sep 15th, 2000, 01:19 PM
#7
Fanatic Member
WMF, EMF, ... are very powerful but they don't support bitmaps and so on. I mean, you can draw a line in the metafile, and after rescaling it, the line is enlarged, but remains it's fine quality. This behaviour doesn't apply to bitmaps. I think, BitBlt and StretchBlt are here the most common options.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|