ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Forum AtoutFox : Re: Surligner une portion de texte dans un champ d'un GRID.   

Sujet

rss Flux RSS des derniers messages

Vous devez vous identifier pour pouvoir poser une question ou répondre.

jeu. 11 octobre 2012, 14h44
Mike Gagnon
Canada Canada

atoutfox.public.association

Re: Surligner une portion de texte dans un champ d'un GRID.

Public oForm
oForm = Createobject('myForm')
oForm.Show

Define Class myForm As Form
  Add Object myGrid As Grid

  Procedure Load
    Create Cursor myProcess (percent i, Name c(10))
    Rand(-1)
    For ix = 1 To 100
      Insert Into myProcess Values (Int(Rand()*100),Sys(2015))
    Endfor
    Locate
  Endproc

  Procedure Init
    With This.myGrid
      .AddColumn(.ColumnCount+1)
      .Columns(.ColumnCount).ControlSource = 'myProcess.Percent'
      .Columns(.ColumnCount).DynamicFontBold = "!(thisform.UpdateContainer(this.columns(1).myPercent))"
      .Columns(.ColumnCount).Header1.Caption = 'Percentage'
    Endwith

    With This.myGrid.Columns(1)
      .AddObject('myPercent','myContainer')
      .myPercent.Width = .Width
      .myPercent.lblPercent.Width = .Width
      .myPercent.Visible = .T.
      .DynamicFontBold = "thisform.UpdateContainer(this.columns(1).myPercent)"
      .CurrentControl = 'myPercent'
      .Sparse = .F.
    Endwith

    This.myGrid.Columns(1).Enabled = .F.
  Endproc

  Procedure UpdateContainer(toContainer)
    With toContainer
      .shpPercent.BackColor = Iif(percent>90,0xFF,Iif(percent>70,0x00FFFF,0x00FF00))
      .shpPercent.Width = toContainer.Parent.Width * percent/100
      .lblPercent.Caption = '%'+Ltrim(Str(percent))
    Endwith
  Endproc
Enddefine

Define Class myContainer As Container
  BackColor=0xFFFFFF
  BorderWidth=0
  Add Object shpPercent As Shape With BorderStyle = 0
  Add Object lblPercent As Label With Alignment = 2 ,BackStyle=0
Enddefine


Journal

JpG pense que ce message est la bonne réponse ou qu'il est utile
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000009987
20 286 messages dans le forum • Liste complète des messages

www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2026.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3