Here's the current arrangement of my form: I have a form (Form1) with a frame (Fra1) on it. I'm using SetParent to insert a second form (Form2) into the frame.
Form1 > Fra1 >Form2
Now, I call TransparentBlt to transfer an image onto Form2. When I want to use ExtFloodFill to fill in a region of that picture, the function executes, returns TRUE, and I call Form2.Refresh, but no colors are updated on the screen. However, if I start Form2 by itself and try the TransparentBlt > ExtFloodFill > Form2.Refresh, everything works as expected.
Would there be a reason the setting the parent of the form is affecting the way it is colored/APIs affect it? If so, what are some possible solutions to this issue?
From Form2:VB Code:
Private Sub Form_Load() Dim hBitmap As Long Dim hdc As Long Dim hFraDc As Long ' Preparing the image hdc = CreateCompatibleDC(GetDC(0)) hBitmap = LoadImage(App.hInstance, App.Path & "\Images\test01.bmp", IMAGE_BITMAP, 300, 200, LR_LOADFROMFILE) SelectObject hdc, hBitmap TransparentBlt Me.hdc, 10, 30, 300, 200, hdc, 0, 0, 300, 200, vbWhite Me.Refresh DeleteObject hBitmap mBrush = CreateSolidBrush(crNewColor) SelectObject Me.hdc, mBrush Me.ScaleMode = vbPixels ' Showing in Frame, Don't need Me.Show 'Me.Show End Sub Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'Floodfill... ExtFloodFill Me.hdc, X, Y, GetPixel(Me.hdc, X, Y), FLOODFILLSURFACE Me.Refresh End Sub Private Sub Form_Unload(Cancel As Integer) DeleteObject mBrush End Sub




Reply With Quote