Announcement

Collapse
No announcement yet.

Color/Font question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scott Turchin
    replied
    Perfect!
    Thanks! Works like a charm!

    Scott


    ------------------
    Scott
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Jules Marchildon
    replied
    Scott,
    Code:
    Case %WM_CTLCOLORSTATIC
         If GetDlgItem(ghDlg,%IDCLABEL3) = Cblparam then
            '<insert code herer>
         End IF
    Regards,
    Jules

    Leave a comment:


  • Scott Turchin
    started a topic Color/Font question

    Color/Font question

    I've seen this posted a hundred times easily but can't find a sample that covers waht I am doing..

    I have multiple labels and edit boxes, but I only want %IDLABEL3 to have color, everything else should be the normal system font and black...

    But %IDLABEL3 Has to be blue or red (probably blue)...


    So here I go, but htis paints ALL LABELS blue....(and makes them too big)
    'Most of this is in the STMP example (Reading past posts etc)
    Code:
    'In Dialogproc
    
    Local Lb         As LOGBRUSH
    Local lf         As LOGFONT
    Static hFont1    As Long
    Static hBrush    As Long       
    
    
        Case %WM_INITDIALOG
          '------------------------------------------------------------------
          'COLOR STUFF
          hFont1 = MakeFont("Courier New", 10)
          GetObject hFont1, SizeOf(lf), ByVal VarPtr(lf)
          'Make the text bold font or normal
          lf.lfWeight = %FW_BOLD
          Lb.lbStyle  = %BLACK_BRUSH
          Control Send CbHndl, %IDLABEL3, %WM_SETFONT, hFont1, %TRUE
          hBrush   = CreateSolidBrush(GetSysColor(%COLOR_3DFACE))
          '------------------------------------------------------------------
    
    THIS IS likely the part that is kicking my butt...  [img]http://www.powerbasic.com/support/forums/smile.gif[/img] I don't understand what it is doing....
    
    
        Case %WM_CTLCOLORSTATIC
                  SelectObject CbWparam, hFont1 'and who is CBWparam at this point?
                  SetBkMode CbWparam, %TRANSPARENT
                  SetTextColor CbWparam, %BLUE
                  Function = hBrush    
    
    
    Function MakeFont(ByVal Font As String, ByVal PointSize As Long) As Long
    
      Local hDC      As Long
      Local CyPixels As Long
    
      hDC = GetDC(%HWND_DESKTOP)
      CyPixels  = GetDeviceCaps(hDC, %LOGPIXELSY)
      ReleaseDC %HWND_DESKTOP, hDC
    
      PointSize = (PointSize * CyPixels) \ 72
    
      Function = CreateFont(0 - PointSize, 0, 0, 0, %FW_NORMAL, 0, 0, 0, _
                %ANSI_CHARSET, %OUT_TT_PRECIS, %CLIP_DEFAULT_PRECIS, _
                %DEFAULT_QUALITY, %FF_DONTCARE, ByCopy Font)
    
    End Function
    ------------------
    Scott
    mailto:[email protected][email protected]</A>

    [This message has been edited by Scott Turchin (edited January 23, 2001).]
Working...
X