IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Presentation Foundation Discussion :

Image svg convertie en Xaml : Quoi faire après?


Sujet :

Windows Presentation Foundation

  1. #1
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut Image svg convertie en Xaml : Quoi faire après?
    Bonjour,

    J'ai 2 images vectoriel au format SVG. J'ai pu les convertir au format xaml.
    Mon souci est le suivant : quoi faire avec dans mon projet avec ce code?

    1. Quoi ajouter dans mon projet : un dictionnaire de resource ou un user control, ou une page?
    2. L'une des images doit servir de fond d'application : dois je ensuite l'utiliser comme une simple image png avec la classe imagebrush?
    3. La deuxième est un logo à intégrer sur le bandeau principal comment l'integrer à un objet Image


    Je vous remercie de votre aide.

  2. #2
    Expert confirmé
    Inscrit en
    Avril 2008
    Messages
    2 564
    Détails du profil
    Informations personnelles :
    Âge : 64

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 564
    Points : 4 442
    Points
    4 442
    Par défaut
    bonjour masmeta

    Une image vectorielle tu peux la wrapper dans un GeometryDrawing ,mettre le geometrydrawin dans un dictionnaire de resources car le control Iimage dans sa prop Source comporte une sous-prop Drawing qui accepte un GeometryDrawing....

    code dictionary1.xaml:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
     
    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:local="clr-namespace:WpfDrawingImage">
     
     
        <GeometryDrawing x:Key="geom">
            <GeometryDrawing.Geometry>
                <GeometryGroup>
                    <EllipseGeometry Center="50,50" RadiusX="45" RadiusY="20" />
                    <EllipseGeometry Center="50,50" RadiusX="20" RadiusY="45" />
                </GeometryGroup>
            </GeometryDrawing.Geometry>
            <GeometryDrawing.Brush>
                <LinearGradientBrush>
                    <GradientStop Offset="0.0" Color="Blue" />
                    <GradientStop Offset="1.0" Color="#CCCCFF" />
                </LinearGradientBrush>
            </GeometryDrawing.Brush>
            <GeometryDrawing.Pen>
                <Pen Thickness="10" Brush="Black" />
            </GeometryDrawing.Pen>
        </GeometryDrawing>
    </ResourceDictionary>
    code app.xam:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <Application x:Class="WpfDrawingImage.App"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 StartupUri="MainWindow.xaml">
        <Application.Resources>
            <ResourceDictionary Source="Dictionary1.xaml"/>
        </Application.Resources>
    </Application>
    code winform xaml:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
    <Window x:Class="WpfDrawingImage.Window1"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" 
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            mc:Ignorable="PresentationOptions"
     
            xmlns:local="clr-namespace:WpfDrawingImage"
            Title="Window1" Height="300" Width="300"
           >
        <Border BorderBrush="Gray" BorderThickness="1" 
            HorizontalAlignment="Left" VerticalAlignment="Top"
            Margin="10">
            <Image>
                <Image.Source>
                    <DrawingImage PresentationOptions:Freeze="True"
                                  Drawing="{StaticResource geom}">
                    </DrawingImage>
                </Image.Source>
            </Image>
        </Border>
    </Window>
    bon code...............

  3. #3
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut
    Merci de ton aide, je vais suivre ton exemple

    Mon code de conversion est le suivant pour mon image de fond
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
     
    <?xml version="1.0" encoding="UTF-8"?>
    <Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
    <Canvas Name="svg2985" Width="1488" Height="1052">
    <Canvas.Resources>
    <PathGeometry xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="clipPath2999" Figures="m 0 841.89 1190.551 0 0 -841.89 L 0 0 0 841.89 z" FillRule="NonZero"/>
    <PathGeometry xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="clipPath3007" Figures="m 0 841.89 1190.55 0 L 1190.55 0 0 0 0 841.89 z" FillRule="NonZero"/>
    </Canvas.Resources>
    <!--Unknown tag: metadata--><!--Unknown tag: sodipodi:namedview--><Canvas Name="g2993">
    <Canvas.RenderTransform>
    <MatrixTransform Matrix="1.25 0 0 -1.25 0 1052.3625"/></Canvas.RenderTransform>
    <Canvas Name="g2995">
    <Canvas Name="g2997">
    <Canvas Name="g3003">
    <Canvas Name="g3005"/>
    <Canvas Name="g3019"><Canvas Name="g3021">
    <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path3023" Fill="{StaticResource pattern3011}">
    <Path.Data><PathGeometry Figures="M 1190.551 0 0 0 l 0 841.89 1190.551 0 0 -841.89 z" FillRule="nonzero"/></Path.Data></Path>
    </Canvas>
    </Canvas>
    </Canvas>
    </Canvas>
    </Canvas></Canvas>
    </Canvas>
    </Viewbox>
    J'ai donc uniquement à faire dans le dictionnaire de ressource un copier coller de ce code dans une balise <GeometryDrawing > </GeometryDrawing > ?

  4. #4
    Expert confirmé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2009
    Messages
    2 032
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Novembre 2009
    Messages : 2 032
    Points : 5 471
    Points
    5 471
    Par défaut
    Avec quoi tu convertis le svg en xaml? Ca me parait un peu bizzare le résultat, enfin surtout la partie 4 ou 5 canvas à la suite et la transformation matricielle -_-.

  5. #5
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut
    J'ai utilisé inkscape. J'avoue que je me suis pas trop posées de questions quand j'ai vu la possibilité de pouvoir l'enregistrer sous xaml.

    Il y a une meilleur solution?

  6. #6
    Expert confirmé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2009
    Messages
    2 032
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Novembre 2009
    Messages : 2 032
    Points : 5 471
    Points
    5 471
    Par défaut
    Je sais pas j'ai jamais fait .
    Compare le code avec http://www.graphspe.com/svg-to-xaml-...ter#/Converter pour voir.
    Moi ce que je m'attends à avoir c'est un ensemble de <Path >. Apres je connais pas non plus SVG peut etre que la transformation existe également et que ton svg en a une et du coup il est normal de l'avoir également dans la traduction xaml.

  7. #7
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut
    Je connais ce site.

    J'ai comparé avec la même image inkscape et le site.
    Pour le site, le code comprend uniquement des canvas alors que inkscape inclue une viewbox remplie de canvas.

  8. #8
    Expert confirmé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2009
    Messages
    2 032
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Novembre 2009
    Messages : 2 032
    Points : 5 471
    Points
    5 471
    Par défaut
    Moi j'essaye le xaml tel quel il ne fonctionne pas, deja il y a une ressource "pattern3011" qui n'est pas déclaré. Je decide de la remplacer par "Black" ca me rempls tout mon écran de noir.

    Mets le code du site pour voir.

  9. #9
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut
    J'ai choisi un icone téléchargeable : http://upload.wikimedia.org/wikipedi...b/Hazard_E.svg

    Code créé par le site : je te laisse faire., je vais éviter de charger le post

    Code créé par inkscape :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    <?xml version="1.0" encoding="UTF-8"?>
    <Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform"><Canvas Name="svg16614" Width="1" Height="1"><Canvas.RenderTransform><TranslateTransform X="0" Y="0"/></Canvas.RenderTransform><Canvas.Resources/><!--Unknown tag: metadata--><!--Unknown tag: sodipodi:namedview--><Polygon xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Points="182.85,519.35 210.04,519.35 210.04,546.5 182.85,546.5 182.85,519.35 " Name="polygon16624" FillRule="evenodd" Fill="#FFFF7D00" StrokeThickness="0" Stroke="#FF000000" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Polygon.RenderTransform><MatrixTransform Matrix="3.61655e-2 0 0 -3.621876e-2 -6.604532 19.80188"/></Polygon.RenderTransform></Polygon><Canvas Name="g22908"><Canvas.RenderTransform><MatrixTransform Matrix="0.985389 0 0 0.985412 -4.007169e-2 6.433833e-2"/></Canvas.RenderTransform><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16690" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.63708142 0.71226009 L 0.64332057 0.72475668 L 0.95014709 0.76187915 C 0.95014709 0.77731618 0.95051409 0.79826656 0.95051409 0.81333606 L 0.80113821 0.78209447 C 0.79710083 0.782462 0.79343065 0.77988909 0.79086168 0.78099168 C 0.79086168 0.78356459 0.79196267 0.7850347 0.79453185 0.78466717 C 0.79710083 0.78466717 0.80223919 0.78466717 0.80223919 0.78871019 C 0.80223919 0.79606118 0.80480838 0.80230958 0.80884555 0.80745519 C 0.80884555 0.81260101 0.80517537 0.81517371 0.80113821 0.81884941 C 0.79379765 0.81921694 0.78462232 0.81554145 0.77874996 0.82068705 C 0.76590446 0.83355117 0.75305875 0.81554145 0.73911227 0.81333606 C 0.72773454 0.80451496 0.70864969 0.81517371 0.69727217 0.80230958 C 0.68736285 0.80488249 0.68185749 0.79385601 0.67304916 0.79385601 C 0.6668098 0.78613749 0.65653328 0.77878651 0.66020345 0.76849508 C 0.6653416 0.76592217 0.66901199 0.75967377 0.67415015 0.75820366 L 0.67415015 0.75563075 C 0.64332057 0.74717718 0.61432639 0.74276663 0.58386381 0.73431305 L 0.57505548 0.73431305 L 0.49504568 0.71630311 C 0.48256717 0.7137302 0.47302464 0.71409773 0.46164713 0.71042224 C 0.45650897 0.70784933 0.44843442 0.70674674 0.44439725 0.70380631 C 0.4913755 0.70968718 0.54202393 0.71299515 0.58900218 0.71887581 C 0.59377334 0.71520032 0.59010317 0.70895212 0.59120416 0.70380631 C 0.59377334 0.6986607 0.60111369 0.69461768 0.60478386 0.69094218 C 0.61873056 0.69094218 0.63047507 0.70196866 0.63708142 0.71226009 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16692" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.68479367 0.67624021 C 0.69022893 0.67945687 0.69794299 0.67031977 0.70351153 0.67329977 C 0.71319163 0.67853734 0.72663355 0.68469378 0.73911227 0.68432625 C 0.74425042 0.68689916 0.74425042 0.69351488 0.74571841 0.69829317 C 0.74681961 0.70196866 0.75195777 0.70601169 0.74828759 0.71115729 C 0.74828759 0.7137302 0.74461742 0.71630311 0.74204824 0.71850828 C 0.73691008 0.71887581 0.73213892 0.7174057 0.72700055 0.71630311 C 0.71158587 0.71667064 0.69910736 0.72549174 0.68369247 0.72181625 C 0.67488414 0.71703817 0.6668098 0.71556784 0.65543229 0.71336267 C 0.64625675 0.71078977 0.65029392 0.70196866 0.64882593 0.69572026 C 0.64185258 0.68653142 0.63341125 0.68212087 0.63341125 0.66925675 C 0.63708142 0.6637434 0.64332057 0.66631631 0.64992692 0.66778642 C 0.66130444 0.67256471 0.6739666 0.67518349 0.68479367 0.67624021 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16694" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.9494131 0.62257791 L 0.94978009 0.67844538 L 0.54349191 0.64977669 L 0.54202393 0.65087928 C 0.5460611 0.65602489 0.54863028 0.66447846 0.54459311 0.67072686 C 0.54202393 0.67587268 0.53541758 0.68101829 0.53027942 0.68212087 C 0.52660925 0.68101829 0.52220508 0.67918065 0.52110388 0.67660774 C 0.5185347 0.67146192 0.52183787 0.66631631 0.51669972 0.6637434 C 0.50789139 0.66521373 0.50458821 0.67182966 0.49834885 0.67440236 C 0.48807233 0.67440236 0.47706181 0.6674189 0.47302464 0.65712768 C 0.47302464 0.65345198 0.47999799 0.6486739 0.47449284 0.6449984 C 0.46972146 0.64536593 0.46421631 0.64426335 0.46017914 0.64316076 L 0.46164713 0.64169044 C 0.62386872 0.63544225 0.78719151 0.62441577 0.9494131 0.62257791 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16696" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.35961628 0.59207138 C 0.36558332 0.5918363 0.37110323 0.59365439 0.3709938 0.59942237 L 0.3709938 0.59942237 C 0.37246199 0.60199527 0.36879182 0.6060383 0.36732362 0.60861099 C 0.36769062 0.620005 0.35484512 0.62257791 0.34750478 0.62919384 C 0.33869645 0.63286934 0.33209009 0.62662094 0.32585074 0.62147533 C 0.3181434 0.61926995 0.3041967 0.62809126 0.30052652 0.61669725 C 0.30162751 0.60677335 0.31043605 0.60273033 0.31263803 0.59390902 C 0.31924438 0.5861905 0.3302549 0.5872933 0.34053143 0.58472039 C 0.34823877 0.58472039 0.35337693 0.59096858 0.35961628 0.59207138 z " FillRule="evenodd"/></Path.Data></Path><Polygon xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Points="208.7,531.41 208.7,530.14 198.2,529.8 208.7,531.41 " Name="polygon16698" FillRule="evenodd" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Polygon.RenderTransform><MatrixTransform Matrix="3.670173e-2 0 0 -3.675494e-2 -6.70987 20.08763"/></Polygon.RenderTransform></Polygon><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16700" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.24180376 0.56524034 L 0.24914411 0.57295885 C 0.24694213 0.57663435 0.24327175 0.58067737 0.24180376 0.58325007 C 0.23923458 0.58949847 0.23299543 0.59354149 0.22675607 0.59354149 C 0.2230859 0.59354149 0.21647955 0.59354149 0.21391058 0.5872933 C 0.21391058 0.57847199 0.21904873 0.56818056 0.22638908 0.56413754 C 0.23152724 0.56156484 0.23923458 0.56303496 0.24180376 0.56524034 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16702" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.26933016 0.55127342 C 0.26961962 0.55081888 0.27401605 0.55873153 0.27079815 0.56377001 C 0.2707064 0.56386189 0.27488122 0.56069172 0.27079815 0.56377001 C 0.26671508 0.5668483 0.25942063 0.56781303 0.25281428 0.56781303 C 0.24914411 0.56524034 0.24914411 0.56046205 0.24914411 0.55641902 C 0.25281428 0.55017062 0.26350373 0.54929777 0.26933016 0.55127342 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16704" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.46017914 0.51635612 L 0.45907794 0.51819397 L 0.45760996 0.52003161 L 0.45614197 0.52223699 L 0.45467378 0.52407464 L 0.45320579 0.52628002 L 0.4517376 0.5284854 L 0.44990262 0.53069057 L 0.44843442 0.53252842 L 0.44659944 0.53473359 L 0.44476425 0.53693897 L 0.44292927 0.53877661 L 0.44072708 0.54098199 L 0.4388921 0.54281963 L 0.43668991 0.54465749 L 0.43485493 0.54649513 L 0.43265274 0.54833298 C 0.43118476 0.54318716 0.43522193 0.53951188 0.4374239 0.53546865 C 0.44366326 0.52922045 0.4513706 0.52003161 0.45871095 0.51635612 L 0.46017914 0.51635612 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16706" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.75452695 0.44578668 C 0.75653541 0.44823332 0.75916073 0.45305663 0.76076631 0.45865102 C 0.75755477 0.46149944 0.75085678 0.46122371 0.74975558 0.46636953 C 0.75232476 0.47886613 0.73947926 0.48437926 0.73323991 0.49173046 C 0.72443158 0.49687607 0.71452205 0.49467069 0.7068147 0.49724359 C 0.69396899 0.49467069 0.68405968 0.50900513 0.67158096 0.50018403 C 0.67011298 0.49136272 0.65616628 0.48879002 0.65873546 0.4784986 C 0.66460761 0.46600179 0.67855431 0.45828328 0.69140002 0.45534305 C 0.69617118 0.45019723 0.69874037 0.44394883 0.70644771 0.44284624 C 0.71892621 0.44247872 0.72626656 0.42961459 0.73911227 0.4347602 C 0.74535141 0.43586278 0.75122378 0.44183557 0.75452695 0.44578668 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16708" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.4253124 0.32008483 C 0.42616385 0.32732507 0.42558752 0.33456124 0.42678038 0.34177027 C 0.42934956 0.35830989 0.41430188 0.36823378 0.41320089 0.3847734 C 0.41320089 0.3910218 0.40953072 0.39616762 0.40842952 0.40388614 C 0.40696153 0.40792916 0.40842952 0.41270724 0.40732853 0.41675026 C 0.40329136 0.41785284 0.3985202 0.42446877 0.39338183 0.42189608 C 0.38677569 0.41564767 0.38934466 0.40645883 0.38824367 0.39910785 C 0.38640869 0.39028675 0.38016933 0.38256823 0.38273852 0.37374692 C 0.38016933 0.36492582 0.37613217 0.35353181 0.38237131 0.34581329 C 0.38604148 0.33074379 0.40255737 0.33441928 0.4113657 0.32523044 C 0.41503587 0.32008483 0.42017424 0.31493902 0.4253124 0.32008483 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16710" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.52147088 0.31787945 C 0.52399016 0.32131306 0.52234776 0.33241012 0.52183787 0.33919736 C 0.51752545 0.34829421 0.50422121 0.37521724 0.50422121 0.37521724 C 0.50312001 0.37631983 0.50055104 0.37631983 0.49798186 0.37631983 C 0.48917353 0.36492582 0.48256717 0.34985631 0.48880632 0.33588939 C 0.48843932 0.32192247 0.50495521 0.31934978 0.51266255 0.31016094 C 0.51743371 0.31016094 0.52032397 0.31503095 0.52147088 0.31787945 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16712" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.61836356 0.035233956 L 0.58496501 0.11168427 C 0.59192709 0.11593102 0.60611959 0.1153649 0.61395919 0.11278685 C 0.62056554 0.10874383 0.62790589 0.10506834 0.63414524 0.099922732 C 0.64185258 0.10102532 0.64699074 0.1032307 0.65066113 0.10984663 C 0.65469829 0.11609482 0.65212911 0.12748883 0.66130444 0.13116432 L 0.72222939 0.034131371 C 0.74131424 0.035233956 0.7615003 0.033763843 0.78168614 0.034866427 L 0.47522683 0.44064107 L 0.62019854 0.19879354 C 0.62386872 0.19364772 0.62753889 0.18739953 0.62900709 0.18225371 C 0.62129953 0.1771081 0.61762936 0.18850211 0.61139021 0.18997223 C 0.60625185 0.19291266 0.5985445 0.19144255 0.59487433 0.19401546 C 0.59083716 0.19144255 0.59230536 0.18629673 0.58716699 0.18519415 C 0.58092784 0.18298898 0.57322029 0.18298898 0.57065132 0.17637305 C 0.56918312 0.16902206 0.57175231 0.15873063 0.56771514 0.15248223 L 0.56661415 0.15248223 L 0.41687106 0.48621711 C 0.42714759 0.49246552 0.43962609 0.48217409 0.44953562 0.49099519 C 0.45614197 0.48584958 0.46238112 0.48327668 0.47008846 0.48695217 L 0.47118966 0.48952508 C 0.47008846 0.49173046 0.45981193 0.50974019 0.4653173 0.50974019 C 0.48513615 0.49944898 0.51633272 0.45093229 0.53394959 0.43292235 C 0.64332057 0.30023704 0.75012278 0.16424377 0.86389814 0.035233956 L 0.94978009 0.035601484 L 0.94978009 0.0844857 C 0.8015052 0.24106161 0.63708142 0.39028675 0.48073198 0.53877661 C 0.47816301 0.54245211 0.47449284 0.54281963 0.47559382 0.54759792 C 0.48146597 0.54759792 0.49100851 0.552376 0.49614667 0.54759792 C 0.64699074 0.43365761 0.79967001 0.31934978 0.94978009 0.20430667 L 0.94978009 0.28774045 C 0.8147177 0.37779015 0.67121397 0.45791575 0.5324814 0.54208458 C 0.52844423 0.54759792 0.52771023 0.56634292 0.53541758 0.57001841 L 0.94978009 0.41491262 L 0.94978009 0.49062766 C 0.79673383 0.52811766 0.64332057 0.57406144 0.48733834 0.59942237 C 0.47999799 0.59464408 0.48220018 0.58177995 0.48366816 0.57295885 C 0.48513615 0.56781303 0.46201412 0.56965089 0.45687597 0.56303496 C 0.43668991 0.57883952 0.41944003 0.59905484 0.40182337 0.61706478 C 0.40696153 0.61963748 0.41320089 0.61816736 0.41687106 0.62184286 C 0.42714759 0.63066396 0.42714759 0.64463088 0.42604639 0.65602489 C 0.42604639 0.66227329 0.42127523 0.6674189 0.41870604 0.6736673 C 0.4124669 0.67918065 0.40365836 0.67513741 0.397419 0.67771032 C 0.39228084 0.68175334 0.38714268 0.68836927 0.38090333 0.68689916 C 0.3706268 0.68579636 0.35924929 0.67954817 0.35044096 0.68616389 C 0.34677078 0.68983939 0.34310061 0.69608779 0.3442016 0.70270372 C 0.35741431 0.71005471 0.36438766 0.71152482 0.37356298 0.7236541 C 0.38127032 0.7236541 0.39264784 0.72732959 0.39778621 0.71961087 C 0.40035518 0.71961087 0.40292436 0.72218378 0.40659454 0.7236541 C 0.44733343 0.73578317 0.48733834 0.74901503 0.52954522 0.76408453 C 0.5317474 0.7563658 0.53945475 0.7574686 0.54459311 0.75269052 C 0.56074179 0.74717718 0.5585396 0.7673925 0.56624715 0.77511101 L 0.7739788 0.84898842 L 0.7739788 0.850091 L 0.64845894 0.850091 L 0.40292436 0.73100509 C 0.38897766 0.73137262 0.38127032 0.74533953 0.38530749 0.75673354 C 0.38677569 0.75893871 0.39044586 0.75783613 0.39191385 0.7563658 C 0.39778621 0.75195525 0.42641338 0.75673354 0.43301974 0.75820366 C 0.43705691 0.76334926 0.44256227 0.7662897 0.44770043 0.76886261 C 0.45063661 0.77547854 0.44439725 0.78062415 0.44770043 0.78650502 C 0.44806742 0.78760761 0.44623244 0.79789903 0.44292927 0.79422354 C 0.43925909 0.79789903 0.43412094 0.80304464 0.42898257 0.79936915 C 0.41980724 0.79165063 0.40842952 0.78429964 0.39558402 0.78429964 C 0.3845735 0.78319706 0.38824367 0.77070025 0.38053633 0.76702476 C 0.36291946 0.77474327 0.34640379 0.7850347 0.32621773 0.7850347 C 0.20106487 0.79826656 0.1691343 0.64242571 0.26455879 0.58692556 C 0.26822896 0.58692556 0.2774045 0.57516402 0.28107467 0.57663435 C 0.28621283 0.58398533 0.29759034 0.61265402 0.29281918 0.62074027 C 0.28914901 0.62588588 0.28144167 0.62845879 0.28290965 0.6361773 C 0.29061699 0.64610099 0.30199472 0.63323687 0.31190404 0.64095538 C 0.31410623 0.64389582 0.3438346 0.65198186 0.34897276 0.65198186 C 0.36769062 0.62882632 0.38750968 0.60456797 0.40659454 0.58030984 C 0.39778621 0.56965089 0.38090333 0.53436606 0.38530749 0.51929656 L 0.54239093 0.035233956 L 0.61836356 0.035233956 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16714" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.41430188 0.035233956 L 0.34530259 0.55311106 C 0.34163242 0.55568397 0.33759525 0.55825688 0.33649426 0.56193237 C 0.33649426 0.56560786 0.34053143 0.57075347 0.33686125 0.57185606 C 0.3302549 0.57442897 0.32548374 0.5810449 0.31887739 0.57883952 C 0.31006906 0.57369391 0.29759034 0.57516402 0.29098399 0.56597539 C 0.28768103 0.5622999 0.25648445 0.52186947 0.25648445 0.52333958 C 0.25134629 0.5284854 0.25391527 0.54134952 0.24400595 0.54392243 C 0.23996878 0.54392243 0.23776659 0.54759792 0.23519741 0.54392243 C 0.22602208 0.53767403 0.22602208 0.52885293 0.21721354 0.52370711 C 0.21317637 0.5174587 0.21317637 0.5086376 0.21427757 0.5023892 C 0.21941573 0.49724359 0.22712307 0.4998165 0.22932526 0.49209799 L 0.14564528 0.36749873 L 0.14564528 0.2583365 L 0.29979253 0.55862441 L 0.30089352 0.55862441 L 0.17684164 0.16938959 L 0.23079324 0.16461151 C 0.23483041 0.18004854 0.2366656 0.19658816 0.24070277 0.21165766 C 0.24547393 0.21055508 0.24547393 0.20540947 0.24657492 0.20136645 L 0.2498781 0.19033975 L 0.2634578 0.1771081 C 0.26969716 0.16975711 0.26786197 0.16056827 0.27153214 0.15321729 C 0.28474484 0.13961811 0.30676588 0.1333697 0.32328155 0.12601872 C 0.33686125 0.13373723 0.33355808 0.15726052 0.34016443 0.17012464 C 0.34126542 0.17306508 0.3445686 0.17233002 0.3445686 0.17012464 L 0.34897276 0.035233956 L 0.41430188 0.035233956 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16716" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.86426513 0.205777 C 0.86810534 0.20737627 0.87574347 0.24396421 0.87307346 0.24878013 C 0.87022914 0.25383396 0.86463213 0.25760144 0.85949376 0.26274705 C 0.85178642 0.26237952 0.85068543 0.27524385 0.84150989 0.27009803 C 0.83527075 0.26237952 0.82389323 0.2634821 0.81875487 0.254661 C 0.81618589 0.24547216 0.81508469 0.23297557 0.82132405 0.22672716 C 0.83013238 0.22268414 0.83490375 0.21423057 0.84407908 0.21570068 C 0.85031844 0.21165766 0.85779645 0.20600665 0.86426513 0.205777 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16718" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.44916862 0.19695568 L 0.4524718 0.25392594 C 0.4524718 0.26642254 0.44256227 0.27303847 0.43999309 0.28443248 L 0.43448793 0.29950198 C 0.41466887 0.29766434 0.42274321 0.26201199 0.40916372 0.25429347 C 0.40806252 0.24657496 0.41797205 0.24142914 0.42054123 0.23518095 C 0.4253124 0.22011144 0.42861557 0.19695568 0.44916862 0.19695568 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16720" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.51046036 0.082280319 L 0.5056892 0.11168427 C 0.50238602 0.12197569 0.49871585 0.1333697 0.49504568 0.14366113 C 0.48770533 0.15027706 0.48403516 0.15946569 0.48036499 0.16718421 C 0.47192365 0.17233002 0.46311511 0.18041607 0.45430678 0.1896047 C 0.44292927 0.18372403 0.43632291 0.17233002 0.42971656 0.16387624 C 0.42824858 0.15505514 0.42824858 0.14733662 0.42934956 0.13851531 C 0.43412094 0.12418108 0.44109407 0.11021416 0.44843442 0.09587971 C 0.45357279 0.087058398 0.46238112 0.084118172 0.47265764 0.083750644 L 0.49247649 0.074194275 C 0.49871585 0.077869769 0.51009336 0.073459219 0.51046036 0.082280319 z " FillRule="evenodd"/></Path.Data></Path></Canvas></Canvas></Viewbox>

  10. #10
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut
    J'ai résolu mon problème voici un mini tutorial pour y arriver :

    1. Télécharger inkscape
    2. Ouvrir votre fichier *.svg avec inkscape, faite Fichier\Enregistrer sous "*.xaml"
    3. Ouvrir votre fichier *.xaml dans un notepad
    4. Ouvrir votre projet Wpf et ajouter un élément "resource dictionnary"
    5. Copier coller le code de l'image dans le ressource dictionnary et ajouter

      Code : Sélectionner tout - Visualiser dans une fenêtre à part
      1
      2
      3
      4
      5
      6
       
       
      <ControlTemplate x:Key="Hazard_E"> <-- Important à rajouter -->
      <Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform"><Canvas Name="svg16614" Width="1" Height="1"><Canvas.RenderTransform><TranslateTransform X="0" Y="0"/></Canvas.RenderTransform><Canvas.Resources/><!--Unknown tag: metadata--><!--Unknown tag: sodipodi:namedview--><Polygon xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Points="182.85,519.35 210.04,519.35 210.04,546.5 182.85,546.5 182.85,519.35 " Name="polygon16624" FillRule="evenodd" Fill="#FFFF7D00" StrokeThickness="0" Stroke="#FF000000" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Polygon.RenderTransform><MatrixTransform Matrix="3.61655e-2 0 0 -3.621876e-2 -6.604532 19.80188"/></Polygon.RenderTransform></Polygon><Canvas Name="g22908"><Canvas.RenderTransform><MatrixTransform Matrix="0.985389 0 0 0.985412 -4.007169e-2 6.433833e-2"/></Canvas.RenderTransform><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16690" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.63708142 0.71226009 L 0.64332057 0.72475668 L 0.95014709 0.76187915 C 0.95014709 0.77731618 0.95051409 0.79826656 0.95051409 0.81333606 L 0.80113821 0.78209447 C 0.79710083 0.782462 0.79343065 0.77988909 0.79086168 0.78099168 C 0.79086168 0.78356459 0.79196267 0.7850347 0.79453185 0.78466717 C 0.79710083 0.78466717 0.80223919 0.78466717 0.80223919 0.78871019 C 0.80223919 0.79606118 0.80480838 0.80230958 0.80884555 0.80745519 C 0.80884555 0.81260101 0.80517537 0.81517371 0.80113821 0.81884941 C 0.79379765 0.81921694 0.78462232 0.81554145 0.77874996 0.82068705 C 0.76590446 0.83355117 0.75305875 0.81554145 0.73911227 0.81333606 C 0.72773454 0.80451496 0.70864969 0.81517371 0.69727217 0.80230958 C 0.68736285 0.80488249 0.68185749 0.79385601 0.67304916 0.79385601 C 0.6668098 0.78613749 0.65653328 0.77878651 0.66020345 0.76849508 C 0.6653416 0.76592217 0.66901199 0.75967377 0.67415015 0.75820366 L 0.67415015 0.75563075 C 0.64332057 0.74717718 0.61432639 0.74276663 0.58386381 0.73431305 L 0.57505548 0.73431305 L 0.49504568 0.71630311 C 0.48256717 0.7137302 0.47302464 0.71409773 0.46164713 0.71042224 C 0.45650897 0.70784933 0.44843442 0.70674674 0.44439725 0.70380631 C 0.4913755 0.70968718 0.54202393 0.71299515 0.58900218 0.71887581 C 0.59377334 0.71520032 0.59010317 0.70895212 0.59120416 0.70380631 C 0.59377334 0.6986607 0.60111369 0.69461768 0.60478386 0.69094218 C 0.61873056 0.69094218 0.63047507 0.70196866 0.63708142 0.71226009 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16692" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.68479367 0.67624021 C 0.69022893 0.67945687 0.69794299 0.67031977 0.70351153 0.67329977 C 0.71319163 0.67853734 0.72663355 0.68469378 0.73911227 0.68432625 C 0.74425042 0.68689916 0.74425042 0.69351488 0.74571841 0.69829317 C 0.74681961 0.70196866 0.75195777 0.70601169 0.74828759 0.71115729 C 0.74828759 0.7137302 0.74461742 0.71630311 0.74204824 0.71850828 C 0.73691008 0.71887581 0.73213892 0.7174057 0.72700055 0.71630311 C 0.71158587 0.71667064 0.69910736 0.72549174 0.68369247 0.72181625 C 0.67488414 0.71703817 0.6668098 0.71556784 0.65543229 0.71336267 C 0.64625675 0.71078977 0.65029392 0.70196866 0.64882593 0.69572026 C 0.64185258 0.68653142 0.63341125 0.68212087 0.63341125 0.66925675 C 0.63708142 0.6637434 0.64332057 0.66631631 0.64992692 0.66778642 C 0.66130444 0.67256471 0.6739666 0.67518349 0.68479367 0.67624021 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16694" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.9494131 0.62257791 L 0.94978009 0.67844538 L 0.54349191 0.64977669 L 0.54202393 0.65087928 C 0.5460611 0.65602489 0.54863028 0.66447846 0.54459311 0.67072686 C 0.54202393 0.67587268 0.53541758 0.68101829 0.53027942 0.68212087 C 0.52660925 0.68101829 0.52220508 0.67918065 0.52110388 0.67660774 C 0.5185347 0.67146192 0.52183787 0.66631631 0.51669972 0.6637434 C 0.50789139 0.66521373 0.50458821 0.67182966 0.49834885 0.67440236 C 0.48807233 0.67440236 0.47706181 0.6674189 0.47302464 0.65712768 C 0.47302464 0.65345198 0.47999799 0.6486739 0.47449284 0.6449984 C 0.46972146 0.64536593 0.46421631 0.64426335 0.46017914 0.64316076 L 0.46164713 0.64169044 C 0.62386872 0.63544225 0.78719151 0.62441577 0.9494131 0.62257791 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16696" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.35961628 0.59207138 C 0.36558332 0.5918363 0.37110323 0.59365439 0.3709938 0.59942237 L 0.3709938 0.59942237 C 0.37246199 0.60199527 0.36879182 0.6060383 0.36732362 0.60861099 C 0.36769062 0.620005 0.35484512 0.62257791 0.34750478 0.62919384 C 0.33869645 0.63286934 0.33209009 0.62662094 0.32585074 0.62147533 C 0.3181434 0.61926995 0.3041967 0.62809126 0.30052652 0.61669725 C 0.30162751 0.60677335 0.31043605 0.60273033 0.31263803 0.59390902 C 0.31924438 0.5861905 0.3302549 0.5872933 0.34053143 0.58472039 C 0.34823877 0.58472039 0.35337693 0.59096858 0.35961628 0.59207138 z " FillRule="evenodd"/></Path.Data></Path><Polygon xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Points="208.7,531.41 208.7,530.14 198.2,529.8 208.7,531.41 " Name="polygon16698" FillRule="evenodd" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Polygon.RenderTransform><MatrixTransform Matrix="3.670173e-2 0 0 -3.675494e-2 -6.70987 20.08763"/></Polygon.RenderTransform></Polygon><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16700" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.24180376 0.56524034 L 0.24914411 0.57295885 C 0.24694213 0.57663435 0.24327175 0.58067737 0.24180376 0.58325007 C 0.23923458 0.58949847 0.23299543 0.59354149 0.22675607 0.59354149 C 0.2230859 0.59354149 0.21647955 0.59354149 0.21391058 0.5872933 C 0.21391058 0.57847199 0.21904873 0.56818056 0.22638908 0.56413754 C 0.23152724 0.56156484 0.23923458 0.56303496 0.24180376 0.56524034 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16702" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.26933016 0.55127342 C 0.26961962 0.55081888 0.27401605 0.55873153 0.27079815 0.56377001 C 0.2707064 0.56386189 0.27488122 0.56069172 0.27079815 0.56377001 C 0.26671508 0.5668483 0.25942063 0.56781303 0.25281428 0.56781303 C 0.24914411 0.56524034 0.24914411 0.56046205 0.24914411 0.55641902 C 0.25281428 0.55017062 0.26350373 0.54929777 0.26933016 0.55127342 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16704" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.46017914 0.51635612 L 0.45907794 0.51819397 L 0.45760996 0.52003161 L 0.45614197 0.52223699 L 0.45467378 0.52407464 L 0.45320579 0.52628002 L 0.4517376 0.5284854 L 0.44990262 0.53069057 L 0.44843442 0.53252842 L 0.44659944 0.53473359 L 0.44476425 0.53693897 L 0.44292927 0.53877661 L 0.44072708 0.54098199 L 0.4388921 0.54281963 L 0.43668991 0.54465749 L 0.43485493 0.54649513 L 0.43265274 0.54833298 C 0.43118476 0.54318716 0.43522193 0.53951188 0.4374239 0.53546865 C 0.44366326 0.52922045 0.4513706 0.52003161 0.45871095 0.51635612 L 0.46017914 0.51635612 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16706" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.75452695 0.44578668 C 0.75653541 0.44823332 0.75916073 0.45305663 0.76076631 0.45865102 C 0.75755477 0.46149944 0.75085678 0.46122371 0.74975558 0.46636953 C 0.75232476 0.47886613 0.73947926 0.48437926 0.73323991 0.49173046 C 0.72443158 0.49687607 0.71452205 0.49467069 0.7068147 0.49724359 C 0.69396899 0.49467069 0.68405968 0.50900513 0.67158096 0.50018403 C 0.67011298 0.49136272 0.65616628 0.48879002 0.65873546 0.4784986 C 0.66460761 0.46600179 0.67855431 0.45828328 0.69140002 0.45534305 C 0.69617118 0.45019723 0.69874037 0.44394883 0.70644771 0.44284624 C 0.71892621 0.44247872 0.72626656 0.42961459 0.73911227 0.4347602 C 0.74535141 0.43586278 0.75122378 0.44183557 0.75452695 0.44578668 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16708" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.4253124 0.32008483 C 0.42616385 0.32732507 0.42558752 0.33456124 0.42678038 0.34177027 C 0.42934956 0.35830989 0.41430188 0.36823378 0.41320089 0.3847734 C 0.41320089 0.3910218 0.40953072 0.39616762 0.40842952 0.40388614 C 0.40696153 0.40792916 0.40842952 0.41270724 0.40732853 0.41675026 C 0.40329136 0.41785284 0.3985202 0.42446877 0.39338183 0.42189608 C 0.38677569 0.41564767 0.38934466 0.40645883 0.38824367 0.39910785 C 0.38640869 0.39028675 0.38016933 0.38256823 0.38273852 0.37374692 C 0.38016933 0.36492582 0.37613217 0.35353181 0.38237131 0.34581329 C 0.38604148 0.33074379 0.40255737 0.33441928 0.4113657 0.32523044 C 0.41503587 0.32008483 0.42017424 0.31493902 0.4253124 0.32008483 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16710" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.52147088 0.31787945 C 0.52399016 0.32131306 0.52234776 0.33241012 0.52183787 0.33919736 C 0.51752545 0.34829421 0.50422121 0.37521724 0.50422121 0.37521724 C 0.50312001 0.37631983 0.50055104 0.37631983 0.49798186 0.37631983 C 0.48917353 0.36492582 0.48256717 0.34985631 0.48880632 0.33588939 C 0.48843932 0.32192247 0.50495521 0.31934978 0.51266255 0.31016094 C 0.51743371 0.31016094 0.52032397 0.31503095 0.52147088 0.31787945 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16712" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.61836356 0.035233956 L 0.58496501 0.11168427 C 0.59192709 0.11593102 0.60611959 0.1153649 0.61395919 0.11278685 C 0.62056554 0.10874383 0.62790589 0.10506834 0.63414524 0.099922732 C 0.64185258 0.10102532 0.64699074 0.1032307 0.65066113 0.10984663 C 0.65469829 0.11609482 0.65212911 0.12748883 0.66130444 0.13116432 L 0.72222939 0.034131371 C 0.74131424 0.035233956 0.7615003 0.033763843 0.78168614 0.034866427 L 0.47522683 0.44064107 L 0.62019854 0.19879354 C 0.62386872 0.19364772 0.62753889 0.18739953 0.62900709 0.18225371 C 0.62129953 0.1771081 0.61762936 0.18850211 0.61139021 0.18997223 C 0.60625185 0.19291266 0.5985445 0.19144255 0.59487433 0.19401546 C 0.59083716 0.19144255 0.59230536 0.18629673 0.58716699 0.18519415 C 0.58092784 0.18298898 0.57322029 0.18298898 0.57065132 0.17637305 C 0.56918312 0.16902206 0.57175231 0.15873063 0.56771514 0.15248223 L 0.56661415 0.15248223 L 0.41687106 0.48621711 C 0.42714759 0.49246552 0.43962609 0.48217409 0.44953562 0.49099519 C 0.45614197 0.48584958 0.46238112 0.48327668 0.47008846 0.48695217 L 0.47118966 0.48952508 C 0.47008846 0.49173046 0.45981193 0.50974019 0.4653173 0.50974019 C 0.48513615 0.49944898 0.51633272 0.45093229 0.53394959 0.43292235 C 0.64332057 0.30023704 0.75012278 0.16424377 0.86389814 0.035233956 L 0.94978009 0.035601484 L 0.94978009 0.0844857 C 0.8015052 0.24106161 0.63708142 0.39028675 0.48073198 0.53877661 C 0.47816301 0.54245211 0.47449284 0.54281963 0.47559382 0.54759792 C 0.48146597 0.54759792 0.49100851 0.552376 0.49614667 0.54759792 C 0.64699074 0.43365761 0.79967001 0.31934978 0.94978009 0.20430667 L 0.94978009 0.28774045 C 0.8147177 0.37779015 0.67121397 0.45791575 0.5324814 0.54208458 C 0.52844423 0.54759792 0.52771023 0.56634292 0.53541758 0.57001841 L 0.94978009 0.41491262 L 0.94978009 0.49062766 C 0.79673383 0.52811766 0.64332057 0.57406144 0.48733834 0.59942237 C 0.47999799 0.59464408 0.48220018 0.58177995 0.48366816 0.57295885 C 0.48513615 0.56781303 0.46201412 0.56965089 0.45687597 0.56303496 C 0.43668991 0.57883952 0.41944003 0.59905484 0.40182337 0.61706478 C 0.40696153 0.61963748 0.41320089 0.61816736 0.41687106 0.62184286 C 0.42714759 0.63066396 0.42714759 0.64463088 0.42604639 0.65602489 C 0.42604639 0.66227329 0.42127523 0.6674189 0.41870604 0.6736673 C 0.4124669 0.67918065 0.40365836 0.67513741 0.397419 0.67771032 C 0.39228084 0.68175334 0.38714268 0.68836927 0.38090333 0.68689916 C 0.3706268 0.68579636 0.35924929 0.67954817 0.35044096 0.68616389 C 0.34677078 0.68983939 0.34310061 0.69608779 0.3442016 0.70270372 C 0.35741431 0.71005471 0.36438766 0.71152482 0.37356298 0.7236541 C 0.38127032 0.7236541 0.39264784 0.72732959 0.39778621 0.71961087 C 0.40035518 0.71961087 0.40292436 0.72218378 0.40659454 0.7236541 C 0.44733343 0.73578317 0.48733834 0.74901503 0.52954522 0.76408453 C 0.5317474 0.7563658 0.53945475 0.7574686 0.54459311 0.75269052 C 0.56074179 0.74717718 0.5585396 0.7673925 0.56624715 0.77511101 L 0.7739788 0.84898842 L 0.7739788 0.850091 L 0.64845894 0.850091 L 0.40292436 0.73100509 C 0.38897766 0.73137262 0.38127032 0.74533953 0.38530749 0.75673354 C 0.38677569 0.75893871 0.39044586 0.75783613 0.39191385 0.7563658 C 0.39778621 0.75195525 0.42641338 0.75673354 0.43301974 0.75820366 C 0.43705691 0.76334926 0.44256227 0.7662897 0.44770043 0.76886261 C 0.45063661 0.77547854 0.44439725 0.78062415 0.44770043 0.78650502 C 0.44806742 0.78760761 0.44623244 0.79789903 0.44292927 0.79422354 C 0.43925909 0.79789903 0.43412094 0.80304464 0.42898257 0.79936915 C 0.41980724 0.79165063 0.40842952 0.78429964 0.39558402 0.78429964 C 0.3845735 0.78319706 0.38824367 0.77070025 0.38053633 0.76702476 C 0.36291946 0.77474327 0.34640379 0.7850347 0.32621773 0.7850347 C 0.20106487 0.79826656 0.1691343 0.64242571 0.26455879 0.58692556 C 0.26822896 0.58692556 0.2774045 0.57516402 0.28107467 0.57663435 C 0.28621283 0.58398533 0.29759034 0.61265402 0.29281918 0.62074027 C 0.28914901 0.62588588 0.28144167 0.62845879 0.28290965 0.6361773 C 0.29061699 0.64610099 0.30199472 0.63323687 0.31190404 0.64095538 C 0.31410623 0.64389582 0.3438346 0.65198186 0.34897276 0.65198186 C 0.36769062 0.62882632 0.38750968 0.60456797 0.40659454 0.58030984 C 0.39778621 0.56965089 0.38090333 0.53436606 0.38530749 0.51929656 L 0.54239093 0.035233956 L 0.61836356 0.035233956 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16714" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.41430188 0.035233956 L 0.34530259 0.55311106 C 0.34163242 0.55568397 0.33759525 0.55825688 0.33649426 0.56193237 C 0.33649426 0.56560786 0.34053143 0.57075347 0.33686125 0.57185606 C 0.3302549 0.57442897 0.32548374 0.5810449 0.31887739 0.57883952 C 0.31006906 0.57369391 0.29759034 0.57516402 0.29098399 0.56597539 C 0.28768103 0.5622999 0.25648445 0.52186947 0.25648445 0.52333958 C 0.25134629 0.5284854 0.25391527 0.54134952 0.24400595 0.54392243 C 0.23996878 0.54392243 0.23776659 0.54759792 0.23519741 0.54392243 C 0.22602208 0.53767403 0.22602208 0.52885293 0.21721354 0.52370711 C 0.21317637 0.5174587 0.21317637 0.5086376 0.21427757 0.5023892 C 0.21941573 0.49724359 0.22712307 0.4998165 0.22932526 0.49209799 L 0.14564528 0.36749873 L 0.14564528 0.2583365 L 0.29979253 0.55862441 L 0.30089352 0.55862441 L 0.17684164 0.16938959 L 0.23079324 0.16461151 C 0.23483041 0.18004854 0.2366656 0.19658816 0.24070277 0.21165766 C 0.24547393 0.21055508 0.24547393 0.20540947 0.24657492 0.20136645 L 0.2498781 0.19033975 L 0.2634578 0.1771081 C 0.26969716 0.16975711 0.26786197 0.16056827 0.27153214 0.15321729 C 0.28474484 0.13961811 0.30676588 0.1333697 0.32328155 0.12601872 C 0.33686125 0.13373723 0.33355808 0.15726052 0.34016443 0.17012464 C 0.34126542 0.17306508 0.3445686 0.17233002 0.3445686 0.17012464 L 0.34897276 0.035233956 L 0.41430188 0.035233956 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16716" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.86426513 0.205777 C 0.86810534 0.20737627 0.87574347 0.24396421 0.87307346 0.24878013 C 0.87022914 0.25383396 0.86463213 0.25760144 0.85949376 0.26274705 C 0.85178642 0.26237952 0.85068543 0.27524385 0.84150989 0.27009803 C 0.83527075 0.26237952 0.82389323 0.2634821 0.81875487 0.254661 C 0.81618589 0.24547216 0.81508469 0.23297557 0.82132405 0.22672716 C 0.83013238 0.22268414 0.83490375 0.21423057 0.84407908 0.21570068 C 0.85031844 0.21165766 0.85779645 0.20600665 0.86426513 0.205777 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16718" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.44916862 0.19695568 L 0.4524718 0.25392594 C 0.4524718 0.26642254 0.44256227 0.27303847 0.43999309 0.28443248 L 0.43448793 0.29950198 C 0.41466887 0.29766434 0.42274321 0.26201199 0.40916372 0.25429347 C 0.40806252 0.24657496 0.41797205 0.24142914 0.42054123 0.23518095 C 0.4253124 0.22011144 0.42861557 0.19695568 0.44916862 0.19695568 z " FillRule="evenodd"/></Path.Data></Path><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path16720" Fill="#FF000000" StrokeThickness="0" StrokeMiterLimit="10.43299961" StrokeLineJoin="Miter" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat"><Path.Data><PathGeometry Figures="M 0.51046036 0.082280319 L 0.5056892 0.11168427 C 0.50238602 0.12197569 0.49871585 0.1333697 0.49504568 0.14366113 C 0.48770533 0.15027706 0.48403516 0.15946569 0.48036499 0.16718421 C 0.47192365 0.17233002 0.46311511 0.18041607 0.45430678 0.1896047 C 0.44292927 0.18372403 0.43632291 0.17233002 0.42971656 0.16387624 C 0.42824858 0.15505514 0.42824858 0.14733662 0.42934956 0.13851531 C 0.43412094 0.12418108 0.44109407 0.11021416 0.44843442 0.09587971 C 0.45357279 0.087058398 0.46238112 0.084118172 0.47265764 0.083750644 L 0.49247649 0.074194275 C 0.49871585 0.077869769 0.51009336 0.073459219 0.51046036 0.082280319 z " FillRule="evenodd"/></Path.Data></Path></Canvas></Canvas></Viewbox>
       
      </ControlTemplate > <-- Important à rajouter -->
    6. Dans le fichier app.xaml
      Code : Sélectionner tout - Visualiser dans une fenêtre à part
      1
      2
      3
      4
      5
      6
      7
       
       <ResourceDictionary>
                  <ResourceDictionary.MergedDictionaries>
                      <ResourceDictionary Source="Pictures.xaml"/>
                   ...
                  </ResourceDictionary.MergedDictionaries>
              </ResourceDictionary>
    7. Dans le fichier MainWindow.xaml pour un bouton
      Code : Sélectionner tout - Visualiser dans une fenêtre à part
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
       
      <Button  Grid.Column="1" 
                  Margin="0,0,18.577,17.148" 
                  Name="button1" 
                  Height="128" 
                  VerticalAlignment="Bottom" 
                  HorizontalAlignment="Right" 
                  Width="128">
                  <DockPanel>
                      <ContentControl Template="{StaticResource Hazard_E}" />
                      <TextBlock DockPanel.Dock="Bottom">My text here</TextBlock>
                  </DockPanel>
              </Button>


    Et ca marche.
    J'ai plus qu'à trouver pour mettre un arrière plan à ma form avec staticResource.

  11. #11
    Expert confirmé
    Inscrit en
    Avril 2008
    Messages
    2 564
    Détails du profil
    Informations personnelles :
    Âge : 64

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 564
    Points : 4 442
    Points
    4 442
    Par défaut
    bonjour masmeta

    Cela depend de l'outil utilise (inksapece ,plugin-xaml code plex, expression studio) et de ce qu'on recupere comme type de fichier xaml...
    Mais les possibilites de faire sa "tambouille" à la francaise sont nombreuses et variees .
    J'ai cite un exemple ....
    On n' as pas besoin necessairement d'un content control ....
    Voici 2 autres facons d'utiliser le fichier xaml recupere avec un simple visualbrush ("vb" est le key du ViewBox dans le Dictionary4.xaml)

    code xaml :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
     
    <Window x:Class="WpfDrawingImage.Window4"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="Window4" Height="300" Width="300">
        <StackPanel>
            <Button
               Width="150" Height="150" >
                <Button.Background>
                    <VisualBrush Visual="{StaticResource vb}">
                    </VisualBrush>
                </Button.Background>
            </Button >
            <Separator Height="25"/>
            <Image   
                Width="100"
                Height="100"
                Stretch="Uniform">
                <Image.Source>
                    <DrawingImage >
                        <DrawingImage.Drawing>
                            <GeometryDrawing  >
                                <GeometryDrawing.Geometry>
                                    <RectangleGeometry 
                                        Rect="0,0,150,150" 
                                        RadiusX="15"
                                        RadiusY="15"/>
                                </GeometryDrawing.Geometry>
                                <GeometryDrawing.Brush>
                                    <VisualBrush
                                        Viewport="0,0,1,1"
                                        ViewboxUnits="RelativeToBoundingBox"
                                        Visual="{StaticResource vb}"/>
                                </GeometryDrawing.Brush>
                            </GeometryDrawing>
                        </DrawingImage.Drawing>
                    </DrawingImage>
                </Image.Source>
            </Image>
        </StackPanel>
     
    </Window>
    bon code..............

  12. #12
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut
    Je comprend bien. Cela prouve que c'est un outil puissant, et décourageant à la fois; Je n'ai pas trouvé de bonne pratiques, juste des cas par cas.
    Pour moi qui vient du Windows form, j'ai beaucoup de mal à changer ma vision de l'esprit. Mais j'y travaille


    Par contre comment déclares tu ta ressources vb dans ton ressource dictionnary?

  13. #13
    Expert confirmé
    Inscrit en
    Avril 2008
    Messages
    2 564
    Détails du profil
    Informations personnelles :
    Âge : 64

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 564
    Points : 4 442
    Points
    4 442
    Par défaut
    rebonjour
    Decourageant non..Au contraire il est souple...
    Tu as en fait affecte le contenu de ton fichier dessin xaml à:
    -la prop ContentPresenter du ControlTemplate d'un Content Control ...

    Moi je le store tel quel comme control ViewBox.
    Ensuite j'affecte ce control à la prop Content d'un VisualBrush
    Un VisualBrush est un "snapshot" (photo kodak instantanee) du ViewBox...

    -j'utilise ce VisualBrush pour peindre le Background d'un button
    -j'utilise ce VisualBrush comme brush pour peindre un GeometryDrawing forme d'un rectangle (fill)...
    Le GeometryDrawing une fois peint je l'affecte à prop Drawing du DrawingImage du control Image...
    Le dictionary est fort simple:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
        <Viewbox 
            x:Key="vb" Stretch="Uniform">
            <Canvas Name="svg16614" Width="1" Height="1">
     
     
                <!-- le reste du fichier -->
     
            </Canvas>
        </Viewbox>
    </ResourceDictionary>
    bon code............

  14. #14
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut
    re-bonjour,

    J'ai testé ton code. Ma solution n'est pas si viable que cela car l'image ne se redimensionne pas comme il faut.
    J'ai réussi faire ton exemple pour un objet image.
    Par contre pour le bouton je suis embêté. J'ai intégré un style de base. Mon image de background est alors compressé sur le côté. Je comprend que cela vient du content.

    Est-il possible d'avoir l'image entière sur le bouton et non bloqué à droite?

    Voici le code du bouton ( j'ai pris le style de base de la toolbox) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
     <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Content="Test" Name="btnClose"  Height="96" Width="96" Margin="10,0,0,0" Click="btnClose_Click">
                    <Button.Background >
                        <VisualBrush Visual="{StaticResource Close}" Stretch="Fill">
                        </VisualBrush>
     
                    </Button.Background>
                </Button>
    Code du bouton dans le dictionnaire :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
     
      <Viewbox x:Key="Close" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
                <Canvas Name="Calque_1" Width="256" Height="256" Canvas.Left="0" Canvas.Top="0">
                    <Canvas.RenderTransform>
                        <TranslateTransform X="0" Y="0"/>
                    </Canvas.RenderTransform>
                    <Canvas.Resources/>
                    <!--Unknown tag: metadata-->
                    <!--Unknown tag: sodipodi:namedview-->
                    <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path320" Fill="#FFFFFFFF">
                        <Path.Data>
                            <PathGeometry Figures="M-911.667-2.5c0 0 6.25-15.25 14.5-15.25" FillRule="NonZero"/>
                        </Path.Data>
                    </Path>
                    <Canvas Name="g380">
                        <Canvas.RenderTransform>
                            <MatrixTransform Matrix="1.4646482 0 0 1.4646482 -59.475885 -59.489433"/>
                        </Canvas.RenderTransform>
                        <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path382" Fill="#FF666666">
                            <Path.Data>
                                <PathGeometry Figures="m 147.217 127.997 31.427 -31.418 c 5.303 -5.303 5.303 -13.907 0 -19.207 -0.706 -0.703 -1.468 -1.298 -2.265 -1.811 -5.265 -3.393 -12.346 -2.795 -16.951 1.811 L 128.01 108.79 96.568 77.346 c -5.309 -5.303 -13.91 -5.303 -19.213 0 -5.3 5.306 -5.3 13.904 0 19.21 l 31.444 31.441 -16.406 16.409 -15.038 15.038 c -5.3 5.303 -5.3 13.901 0 19.207 5.303 5.306 13.904 5.306 19.21 0 l 31.444 -31.447 31.418 31.424 c 5.306 5.306 13.907 5.306 19.216 0 5.303 -5.303 5.303 -13.904 0 -19.21 l -31.426 -31.421 z" FillRule="NonZero"/>
                            </Path.Data>
                        </Path>
                        <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path384" Fill="#FFFFFFFF" Opacity="0.25">
                            <Path.Data>
                                <PathGeometry Figures="M 159.428 77.372 128.01 108.79 96.568 77.346 c -5.309 -5.303 -13.91 -5.303 -19.213 0 -5.3 5.306 -5.3 13.904 0 19.21 l 31.444 31.441 -16.406 16.409 c 4.898 -1.216 9.832 -2.701 14.771 -4.491 3.308 -1.198 6.521 -2.508 9.659 -3.896 8.971 -3.973 17.183 -8.695 24.483 -13.934 9.393 -6.741 17.262 -14.341 23.25 -22.336 2.59 -3.463 4.834 -6.993 6.688 -10.564 2.341 -4.512 4.069 -9.079 5.133 -13.623 -5.263 -3.393 -12.344 -2.795 -16.949 1.81 z" FillRule="NonZero"/>
                            </Path.Data>
                        </Path>
                    </Canvas>
                </Canvas>
            </Viewbox>

  15. #15
    Expert confirmé
    Inscrit en
    Avril 2008
    Messages
    2 564
    Détails du profil
    Informations personnelles :
    Âge : 64

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 564
    Points : 4 442
    Points
    4 442
    Par défaut
    bonjour Masmeta

    Mais ici tu as fait des modifs dans le fichier xaml d'origne sans y rien comprendre et tu obtient n'importe quoi...........

    Tu as subtitue un path au rectangle d'origine
    Il faut lui appliquer le transform du rectangle d'origne car il contient tout le reste s.v.p....
    Je te signales que je n'aime pas les debutants qui joue au gros malin....

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
     
    <Window x:Class="WpfDrawingImage.Window5"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="Window5" Height="300" Width="300">
        <Window.Resources>
            <!--TON VIEWBOX-->
            <Viewbox x:Key="Close" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
                <Canvas Name="Calque_1" Width="256" Height="256" Canvas.Left="0" Canvas.Top="0">
                    <Canvas.RenderTransform>
                        <TranslateTransform X="0" Y="0"/>
                    </Canvas.RenderTransform>
                    <Canvas.Resources/>
                    <!--Unknown tag: metadata-->
                    <!--Unknown tag: sodipodi:namedview-->
                    <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path320" Fill="#FFFFFFFF">
                        <Path.Data>
                            <PathGeometry Figures="M-911.667-2.5c0 0 6.25-15.25 14.5-15.25" FillRule="NonZero"/>
                        </Path.Data>
                        <!--ICI LE TRANSFORM D'ORIGINE-->
                        <Path.RenderTransform>
                            <MatrixTransform Matrix="3.61655e-2 0 0 -3.621876e-2 -6.604532 19.80188"/>
                        </Path.RenderTransform>
                    </Path>
                    <Canvas Name="g380">
                        <Canvas.RenderTransform>
                            <MatrixTransform Matrix="1.4646482 0 0 1.4646482 -59.475885 -59.489433"/>
                        </Canvas.RenderTransform>
                        <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path382" Fill="#FF666666">
                            <Path.Data>
                                <PathGeometry Figures="m 147.217 127.997 31.427 -31.418 c 5.303 -5.303 5.303 -13.907 0 -19.207 -0.706 -0.703 -1.468 -1.298 -2.265 -1.811 -5.265 -3.393 -12.346 -2.795 -16.951 1.811 L 128.01 108.79 96.568 77.346 c -5.309 -5.303 -13.91 -5.303 -19.213 0 -5.3 5.306 -5.3 13.904 0 19.21 l 31.444 31.441 -16.406 16.409 -15.038 15.038 c -5.3 5.303 -5.3 13.901 0 19.207 5.303 5.306 13.904 5.306 19.21 0 l 31.444 -31.447 31.418 31.424 c 5.306 5.306 13.907 5.306 19.216 0 5.303 -5.303 5.303 -13.904 0 -19.21 l -31.426 -31.421 z" FillRule="NonZero"/>
                            </Path.Data>
                        </Path>
                        <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path384" Fill="#FFFFFFFF" Opacity="0.25">
                            <Path.Data>
                                <PathGeometry Figures="M 159.428 77.372 128.01 108.79 96.568 77.346 c -5.309 -5.303 -13.91 -5.303 -19.213 0 -5.3 5.306 -5.3 13.904 0 19.21 l 31.444 31.441 -16.406 16.409 c 4.898 -1.216 9.832 -2.701 14.771 -4.491 3.308 -1.198 6.521 -2.508 9.659 -3.896 8.971 -3.973 17.183 -8.695 24.483 -13.934 9.393 -6.741 17.262 -14.341 23.25 -22.336 2.59 -3.463 4.834 -6.993 6.688 -10.564 2.341 -4.512 4.069 -9.079 5.133 -13.623 -5.263 -3.393 -12.344 -2.795 -16.949 1.81 z" FillRule="NonZero"/>
                            </Path.Data>
                        </Path>
                    </Canvas>
                </Canvas>
            </Viewbox>
        </Window.Resources>
        <StackPanel >
            <!--TON Button -->
            <Button 
                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" 
                    Content="Test" 
                    Name="btnClose"  
                    Height="96" 
                    Width="96" 
                    Margin="10,0,0,0" 
                   >
                <Button.Background >
                    <VisualBrush 
                            Visual="{StaticResource Close}" 
                            Stretch="Fill">
                    </VisualBrush>
                </Button.Background>
            </Button>
        </StackPanel>
    </Window>
    bon code...........

  16. #16
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut
    Bonjour Mabrouki

    On m'a fourni l'image sous format svg que j'ai converti avec Inkscape en Xaml.
    J'avoue ne pas avoir étudier le code de l'image, pensant que cela venait plus de ma programmation à moi où à un paramètre mal gérer.

    Je te remercie du temps que tu passes sur mon problème. Cependant je n'ai pas le temps et l'envie de faire mon malin.




    Citation Envoyé par MABROUKI Voir le message
    bonjour Masmeta

    Mais ici tu as fait des modifs dans le fichier xaml d'origne sans y rien comprendre et tu obtient n'importe quoi...........

    Tu as subtitue un path au rectangle d'origine
    Il faut lui appliquer le transform du rectangle d'origne car il contient tout le reste s.v.p....
    Je te signales que je n'aime pas les debutants qui joue au gros malin....

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
     
    <Window x:Class="WpfDrawingImage.Window5"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="Window5" Height="300" Width="300">
        <Window.Resources>
            <!--TON VIEWBOX-->
            <Viewbox x:Key="Close" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
                <Canvas Name="Calque_1" Width="256" Height="256" Canvas.Left="0" Canvas.Top="0">
                    <Canvas.RenderTransform>
                        <TranslateTransform X="0" Y="0"/>
                    </Canvas.RenderTransform>
                    <Canvas.Resources/>
                    <!--Unknown tag: metadata-->
                    <!--Unknown tag: sodipodi:namedview-->
                    <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path320" Fill="#FFFFFFFF">
                        <Path.Data>
                            <PathGeometry Figures="M-911.667-2.5c0 0 6.25-15.25 14.5-15.25" FillRule="NonZero"/>
                        </Path.Data>
                        <!--ICI LE TRANSFORM D'ORIGINE-->
                        <Path.RenderTransform>
                            <MatrixTransform Matrix="3.61655e-2 0 0 -3.621876e-2 -6.604532 19.80188"/>
                        </Path.RenderTransform>
                    </Path>
                    <Canvas Name="g380">
                        <Canvas.RenderTransform>
                            <MatrixTransform Matrix="1.4646482 0 0 1.4646482 -59.475885 -59.489433"/>
                        </Canvas.RenderTransform>
                        <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path382" Fill="#FF666666">
                            <Path.Data>
                                <PathGeometry Figures="m 147.217 127.997 31.427 -31.418 c 5.303 -5.303 5.303 -13.907 0 -19.207 -0.706 -0.703 -1.468 -1.298 -2.265 -1.811 -5.265 -3.393 -12.346 -2.795 -16.951 1.811 L 128.01 108.79 96.568 77.346 c -5.309 -5.303 -13.91 -5.303 -19.213 0 -5.3 5.306 -5.3 13.904 0 19.21 l 31.444 31.441 -16.406 16.409 -15.038 15.038 c -5.3 5.303 -5.3 13.901 0 19.207 5.303 5.306 13.904 5.306 19.21 0 l 31.444 -31.447 31.418 31.424 c 5.306 5.306 13.907 5.306 19.216 0 5.303 -5.303 5.303 -13.904 0 -19.21 l -31.426 -31.421 z" FillRule="NonZero"/>
                            </Path.Data>
                        </Path>
                        <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path384" Fill="#FFFFFFFF" Opacity="0.25">
                            <Path.Data>
                                <PathGeometry Figures="M 159.428 77.372 128.01 108.79 96.568 77.346 c -5.309 -5.303 -13.91 -5.303 -19.213 0 -5.3 5.306 -5.3 13.904 0 19.21 l 31.444 31.441 -16.406 16.409 c 4.898 -1.216 9.832 -2.701 14.771 -4.491 3.308 -1.198 6.521 -2.508 9.659 -3.896 8.971 -3.973 17.183 -8.695 24.483 -13.934 9.393 -6.741 17.262 -14.341 23.25 -22.336 2.59 -3.463 4.834 -6.993 6.688 -10.564 2.341 -4.512 4.069 -9.079 5.133 -13.623 -5.263 -3.393 -12.344 -2.795 -16.949 1.81 z" FillRule="NonZero"/>
                            </Path.Data>
                        </Path>
                    </Canvas>
                </Canvas>
            </Viewbox>
        </Window.Resources>
        <StackPanel >
            <!--TON Button -->
            <Button 
                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" 
                    Content="Test" 
                    Name="btnClose"  
                    Height="96" 
                    Width="96" 
                    Margin="10,0,0,0" 
                   >
                <Button.Background >
                    <VisualBrush 
                            Visual="{StaticResource Close}" 
                            Stretch="Fill">
                    </VisualBrush>
                </Button.Background>
            </Button>
        </StackPanel>
    </Window>
    bon code...........

  17. #17
    Membre actif Avatar de Masmeta
    Homme Profil pro
    Ing. R&D informatique industrielle
    Inscrit en
    Mai 2006
    Messages
    472
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Ing. R&D informatique industrielle
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2006
    Messages : 472
    Points : 221
    Points
    221
    Par défaut
    En retravaillant les images et en supprimant le style que je cherche à créer.
    J'ai bien mon image en fond d'écran.

Discussions similaires

  1. Quoi faire après l'alternance
    Par delta07 dans le forum Emploi
    Réponses: 0
    Dernier message: 24/01/2014, 13h11
  2. image superposé quoi faire?
    Par sali2801 dans le forum Interfaces Graphiques en Java
    Réponses: 3
    Dernier message: 14/06/2012, 12h51
  3. Quoi faire après M2
    Par Invité dans le forum Etudes
    Réponses: 6
    Dernier message: 05/03/2009, 00h18
  4. Que faire apres un Bachelor en developpement web
    Par Turtle dans le forum Etudes
    Réponses: 9
    Dernier message: 12/03/2005, 19h35
  5. [debutant]quoi fair pour recompiler un fichier .java
    Par nouaman dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 27/05/2004, 10h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo