begin process at 2012 02 17 05:09:11
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Control

 > MSFLEXGRID L'IMPRESSION !

MSFLEXGRID L'IMPRESSION !


 Description

Juste une procedure d'impression de l'objet MSflexgrid, pour aider d'autre personne !

2 Objets:
1 bouton=command1
et une Msflexgrid=msf1



Source

  • Private Sub Command1_Click()
  • Call imprime(msf1)
  • End Sub
  • Private Sub Form_Load()
  • 'pour adapter a la resolution
  • Dim X, Y As Integer
  • X = Screen.Width / Screen.TwipsPerPixelX
  • Y = Screen.Height / Screen.TwipsPerPixelY
  • rx = X / 800
  • ry = Y / 600
  • '*************
  • msf1.Cols = 10
  • msf1.Font.Size = 10
  • msf1.FixedCols = 0
  • msf1.ColWidth(0) = 2800 * rx ' client
  • msf1.ColWidth(1) = 500 * rx 'logo
  • msf1.ColWidth(2) = 1000 * rx 'ville
  • msf1.ColWidth(3) = 2000 * rx 'materiel
  • msf1.ColWidth(4) = 1000 * rx 'situation
  • msf1.ColWidth(5) = 1000 * rx 'date appel
  • msf1.ColWidth(6) = 0 ' la clef n'apparait pas dans le tableau
  • msf1.ColWidth(7) = 1000 * rx 'intervention
  • msf1.ColWidth(8) = 1000 * rx 'technicien
  • msf1.ColWidth(9) = 1000 * rx 'pret
  • msf1.TextMatrix(0, 0) = "Clients"
  • msf1.TextMatrix(0, 1) = "Logo"
  • msf1.TextMatrix(0, 2) = "Ville"
  • msf1.TextMatrix(0, 3) = "Materiel"
  • msf1.TextMatrix(0, 4) = "Situation"
  • msf1.TextMatrix(0, 5) = "Date appel"
  • msf1.TextMatrix(0, 6) = "clef"
  • msf1.TextMatrix(0, 7) = "Date intervention"
  • msf1.TextMatrix(0, 8) = "Technicien"
  • msf1.TextMatrix(0, 9) = "Pret"
  • msf1.Rows = 12
  • For a% = 1 To 10
  • msf1.TextMatrix(a%, Int((8 * Rnd) + 1)) = "N'importe quoi"
  • Next a%
  • End Sub
  • Sub imprime(grille As MSFlexGrid)
  • Printer.ScaleMode = 6
  • offset% = Printer.CurrentY
  • Printer.FontName = "ARIAL"
  • Printer.FontSize = 8.3
  • Printer.FontBold = False
  • 'pour adapter a la resolution
  • Dim X, Y As Integer
  • X = Screen.Width / Screen.TwipsPerPixelX
  • Y = Screen.Height / Screen.TwipsPerPixelY
  • rx = X / 800
  • ry = Y / 600
  • '*******
  • hh% = grille.CellTop / ry
  • Y1% = offset%
  • For a% = 0 To grille.Rows - 1
  • grille.Row = a% 'ligne active
  • Y1% = Y1% + ((grille.CellHeight / ry) / 56.7)
  • If Y1% > 270 Then Printer.NewPage: Y1% = 10
  • Y2% = Y1% + ((grille.CellHeight / ry) / 56.7)
  • For b% = 0 To grille.Cols - 1
  • grille.Col = b% 'colonne ative
  • X1% = (grille.CellLeft / rx) / 56.7
  • X2% = X1% + ((grille.CellWidth / rx) / 56.7)
  • coul = grille.CellBackColor
  • If coul = 0 Then coul = RGB(255, 255, 255)
  • Printer.FillStyle = 0 'rectangle plein
  • Printer.FillColor = coul
  • Printer.Line (X1%, Y1%)-(X2%, Y2%), , B
  • Printer.CurrentX = X1% + 0.5
  • Printer.CurrentY = Y1%
  • t$ = grille.Text
  • tt$ = ""
  • If grille.CellWidth > 0 Then
  • For ac% = 1 To Len(t$)
  • tt$ = Left(t$, ac%)
  • wc% = Printer.TextWidth(tt$) ' twips
  • If X1% + wc% > X2% - 2 Then Exit For
  • Next ac%
  • tb$ = Left(tt$, ac%)
  • For i% = 1 To Len(tb$)
  • ie% = InStr(tb$, Chr$(13) + Chr$(10))
  • If ie% > 0 Then
  • tbb$ = Left(tb$, ie% - 1)
  • tb$ = Mid(tb$, ie% + 2)
  • Printer.CurrentX = X1% + 0.5
  • Printer.Print tbb$
  • i% = ie% + 2
  • Else
  • Printer.CurrentX = X1% + 0.5
  • Printer.Print tb$
  • Exit For
  • End If
  • Next i%
  • End If
  • Next b%
  • Next a%
  • Printer.EndDoc
  • End Sub
Private Sub Command1_Click()
Call imprime(msf1)
End Sub

Private Sub Form_Load()
 'pour adapter a la resolution
  Dim X, Y As Integer
  X = Screen.Width / Screen.TwipsPerPixelX
  Y = Screen.Height / Screen.TwipsPerPixelY
  rx = X / 800
  ry = Y / 600
  '*************
   msf1.Cols = 10
   msf1.Font.Size = 10

   msf1.FixedCols = 0
   msf1.ColWidth(0) = 2800 * rx ' client
   msf1.ColWidth(1) = 500 * rx 'logo
   msf1.ColWidth(2) = 1000 * rx 'ville
   msf1.ColWidth(3) = 2000 * rx 'materiel
   msf1.ColWidth(4) = 1000 * rx 'situation
   msf1.ColWidth(5) = 1000 * rx 'date appel
   msf1.ColWidth(6) = 0    ' la clef n'apparait pas dans le tableau
   msf1.ColWidth(7) = 1000 * rx 'intervention
   msf1.ColWidth(8) = 1000 * rx 'technicien
   msf1.ColWidth(9) = 1000 * rx 'pret
    
msf1.TextMatrix(0, 0) = "Clients"
msf1.TextMatrix(0, 1) = "Logo"
msf1.TextMatrix(0, 2) = "Ville"
msf1.TextMatrix(0, 3) = "Materiel"
msf1.TextMatrix(0, 4) = "Situation"
msf1.TextMatrix(0, 5) = "Date appel"
msf1.TextMatrix(0, 6) = "clef"
msf1.TextMatrix(0, 7) = "Date intervention"
msf1.TextMatrix(0, 8) = "Technicien"
msf1.TextMatrix(0, 9) = "Pret"
msf1.Rows = 12
For a% = 1 To 10
msf1.TextMatrix(a%, Int((8 * Rnd) + 1)) = "N'importe quoi"
Next a%
   
End Sub
Sub imprime(grille As MSFlexGrid)
    Printer.ScaleMode = 6
    offset% = Printer.CurrentY
    Printer.FontName = "ARIAL"
    Printer.FontSize = 8.3
    Printer.FontBold = False
    'pour adapter a la resolution
    Dim X, Y As Integer
    
    X = Screen.Width / Screen.TwipsPerPixelX
    Y = Screen.Height / Screen.TwipsPerPixelY
    rx = X / 800
    ry = Y / 600
    '*******
    hh% = grille.CellTop / ry
    Y1% = offset%
    For a% = 0 To grille.Rows - 1
        grille.Row = a% 'ligne active
        Y1% = Y1% + ((grille.CellHeight / ry) / 56.7)
        If Y1% > 270 Then Printer.NewPage: Y1% = 10
    
        Y2% = Y1% + ((grille.CellHeight / ry) / 56.7)
        For b% = 0 To grille.Cols - 1
            grille.Col = b% 'colonne ative
            X1% = (grille.CellLeft / rx) / 56.7
            X2% = X1% + ((grille.CellWidth / rx) / 56.7)
            coul = grille.CellBackColor
            If coul = 0 Then coul = RGB(255, 255, 255)
            Printer.FillStyle = 0 'rectangle plein
            Printer.FillColor = coul
       
            Printer.Line (X1%, Y1%)-(X2%, Y2%), , B
            Printer.CurrentX = X1% + 0.5
            Printer.CurrentY = Y1%
            t$ = grille.Text
            tt$ = ""
            If grille.CellWidth > 0 Then
                For ac% = 1 To Len(t$)
                    tt$ = Left(t$, ac%)
                    wc% = Printer.TextWidth(tt$) ' twips
                    If X1% + wc% > X2% - 2 Then Exit For
                Next ac%
                tb$ = Left(tt$, ac%)
             For i% = 1 To Len(tb$)
                ie% = InStr(tb$, Chr$(13) + Chr$(10))
                If ie% > 0 Then
                    tbb$ = Left(tb$, ie% - 1)
                    tb$ = Mid(tb$, ie% + 2)
                    Printer.CurrentX = X1% + 0.5
                    Printer.Print tbb$
                    i% = ie% + 2
                Else
                    Printer.CurrentX = X1% + 0.5
                    Printer.Print tb$
                Exit For
                End If
             Next i%
                
            End If
        Next b%
    Next a%
    Printer.EndDoc
End Sub



 Sources du même auteur

Source avec Zip Source avec une capture DESSIN VECTORIEL
Source avec Zip Source avec une capture CE SERVIR D'UNE FONTES DE CARACTERE NON INSTALLER DANS LE PC
Source avec Zip DLL HYPER RAPIDE POUR IMAGES (DU JAMAIS VUE)
FONCTION API POUR DETECTION DES CLICKS SOURIS ET SITUATION
Source avec Zip Source avec une capture CASSEBRIQUE VB6 ULTRA RAPIDE EN 800 OU 1024 S'EST POSSIBLE !...

 Sources de la même categorie

Source avec Zip COMMUNICATION MODBUS MASTER par sergelapointe
Source avec Zip Source avec une capture DÉPLACEMENT AVEC FLÈCHES DANS UN PAVÉ DE TEXTBOX 9X9 DYNAMIQ... par EhJoe
Source avec Zip Source avec une capture Source .NET (Dotnet) CONTROLSTARS EN RÉPONSE À JAKNIGHT007 par bigboss9
Source avec Zip Source avec une capture Source .NET (Dotnet) CALENDRIER ANNUEL NORME ISO par Prog1001
Source avec Zip Source avec une capture Source .NET (Dotnet) CONTROLE STARS par jaknight007

 Sources en rapport avec celle ci

Source avec Zip GESTION DES IMPRIMÉES par davidleduc
Source avec Zip Source avec une capture GESTION DE LISTE par mehdi_m1986
Source avec Zip TRANSFÉRER LE CONTENU D'UNE MSFLEXGRID VERS WORD par marouanem2010
Source avec Zip Source avec une capture GESTION DES NOTES par marouanem2010
Source avec Zip IMPRIMER SOUS FORME DE TABLEAU (MSFLEXGRID ENTRE AUTRE) par Francki

Commentaires et avis

Commentaire de asimengo le 25/08/2005 10:52:40

très interessant ton idée, je vais jeter un coup d'oeil sur ta source DESSIN VECTORIEL.

Je suis interessé parce que l'objet implementation de recordset (voir source http://www.vbfrance.com/code.aspx?ID=33090) que j'ai développé renvoie des informations de tri et filtre afin qu'il soit affiché par celui qui utilise cet objet. Avec ACCESS c'est facile tu peux demander à afficher une requête dans un état et le pb est résolu. j'ai pas encore trouvé un tel objet qui communiquerait avec les objets VB qui me ferait visualiser l'état (je préfère) ou l'éditer directement.

Si quelqu'un peut m'indiquer ou le trouver j'en serais reconnaissant

Asimengo

Commentaire de asimengo le 26/08/2005 10:48:41

je pensais à mille choses en même temps et des fautes qui se glissent, heureusement que je suis repasssé par là pour ajouter un commentaire. Faites pas attention aux accents.

lire en :
"... des informations de tri et filtre afin qu'il soit affiché par ..."

plutôt:
... des informations de tri et filtre afin qu'elles soient affichées par ...

@RJLFRANCE : Déjà j'ai testé ta source les résultats sont approximatifs, néanmoins je sais maintenant comment envoyer directement à l'imprimante depuis un recordset c'est l'essentiel. Aurais tu une idée sur la gestion des pages?. Il suffit de me dire quelles isntructions ou API et je me charge du reste.
Merci dans tous les cas.

Asimengo

Commentaire de tolt le 30/03/2008 21:04:54

Bonjour,

Bravo pour votre code, il fonctionne à merveille.
En revanche il est trop petit sur un format A4...
Comment prendre toute la surface en largeure et ainsi grandir la vision de la chose toujours sur un format A4.

Merci.

Commentaire de msz1704 le 21/07/2009 12:34:15

Merci bcp

Ton code marche trèèèèèèès bien !

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

Impression d'un controle [ par MorpionMx ] Bonjour a tous, J'ai dans un Panel 2 Control persos. Et j'aimerais imprimer ces 2 Control l'un a cot&#233; de l'autre, ou alors ce qu'il y a dans le Impression avec VB.NET [ par ava0275 ] Bonjour ,Voici le topo ce que je veux faire:je fais une appli dans laquelle&nbsp;l utilisateur place des textbox dans un panel pendant l execution.Je comment imprimer une MSFlexgrid sur plusieur page [ par miklklkl ] Miklkl mailto:miklklkl@hotmail.comcomment imprimer une MSFlexgrid sur plusieur pageavec 'printer'merci d'avance</ Affichage ou pas de la boite de dialogue config d'impression [ par feaskaertes ] Bonjour ;)Un petit souci avec le showprinter : j'ai un commondialog (Dialog) sur une feuille mère (Reseau_PC) et je l'appelle sur une feuille fille av problème d'impression de formulaire [ par ppppp ] Bonjour à tous.J'ai créer différentes calculettes financières durant mon stage. Voila mon problème:Je voudrais imprimer le formulaire avec toutes les problème d'impression [ par gros71 ] il me semble avoir mal expliqué mon problème dans un précédent message.je voudrais pouvoir imprimer une feuille de classeur exel a partir d'une form q Impression.... [ par allfab ] Bonjour à tous,Je souhaite imprimer...mais je n'y arrive pas...c'est pourquoi je fais appel à vous.En fait, dans une form, j'ai une picturebox contena NET: Comment imprimer le nom et indice d'un control [ par scubaduba ] Salut; J'ai voulu imprimer le nom d'un control (comme si c'est un textbox --&gt; TextBox, pas le nom que j'ai donne) avec son indice (c'est preferabl impression en fonction de la saisie sur excel [ par flamalex ] je suis sur excel et utilise le VB de excel.Comment Imprimer&nbsp;?, uniquement ce qui a &#233;t&#233; rempli sur une feuil2 Excel jusqu imprimer à partir d'un code [ par dnpauline ] salut à tous!j'aimerais personnaliser une impression à partir d'un code. c'est à dire le click sur le bouton 'impression' vous permet de définir le fo


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,671 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales