this is what I have so far:
MODULE1
FORM1Code:Dim dcMain As Long Dim bmpMain As Long Dim dcPic As Long Public Sub Init(hdc As Integer, h As Integer, w As Integer) Dim ret As Long dcMain = CreateCompatibleDC(hdc) bmpMain = CreateCompatibleBitmap(dcMain, w, h) ret = SelectObject(dcMain, bmpMain) dcPic = CreateCompatibleDC(dcMain) Dim pic1 As IPictureDisp Set pic1 = LoadPicture("c:\windows\circles.bmp") ret = SelectObject(dcPic, pic1) Set pic1 = Nothing End Sub Public Sub Destroy() Dim ret As Long ret = DeleteDC(dcMain) ret = DeleteObject(bmpMain) ret = DeleteDC(dcPic) End Sub Public Sub showdc(hdc As Long, h As Integer, w As Integer) Dim ret As Integer ret = BitBlt(hdc, 0, 0, w, h, dcMain, 0, 0, SRCCOPY) End Sub Public Sub drawdcmain() Dim ret As Long, ctr As Integer Dim pen As Long pen = CreatePen(PS_SOLID, 2, RGB(0, 255, 0)) ret = SelectObject(dcMain, pen) For ctr = 1 To 95 ret = TextOut(dcMain, Rnd * 100, Rnd * 100, "JON", 3) Next ctr ret = DeleteObject(pen) End Sub
what i want to know is how come everytime that the offscreen dc (dcMain) is drawn on with the TextOut function that it always appears black when blt'd to the screen, no matter what the pen is changed too, do I have to add a pallete? Also how come a bunch or garble is printed to the screen as well and is there anything you can do to clear it before blting it to the screen?Code:Private Sub Form_Load() Call Init(Me.hdc, Me.Height / Screen.TwipsPerPixelY, Me.Width / Screen.TwipsPerPixelX) drawdcmain End Sub Private Sub Form_Unload(Cancel As Integer) Destroy End Sub Private Sub Timer1_Timer() Call showdc(Me.hdc, Me.Height / 15, Me.Width / 15) End Sub




Reply With Quote