Aracılığıyla paylaş


Create a brush resource or color resource

You can create a reusable brush or color that you can then apply to other objects. Resources have an advantage over copying and applying attributes because you can change the resource in one location. When you do this, all the objects that use the resource are instantly updated.

Not

You have many ways to create a resource in Visual Studio 2012 için Blend. This topic covers only how to create brush and color resources, but you can create a resource from most properties. Additionally, you can create a style or template resource that you can apply to a control, instantly changing the appearance or behavior of the control. For more information about how to create additional resource types, see Creating reusable resources. You can see all the resources that are used in your project in the Resources panel.

To create a brush resource

  1. If you do not already have an object on the artboard with a brush property that you want to convert to a resource, you can select Ellipse JJ170658.8938cfdf-9b75-4a33-bc88-b0636e114a0d(tr-tr,VS.110).png from the Tools panel, and draw an ellipse on the artboard. The properties panel will display the properties for the new ellipse object, with the Fill property selected under Brush.

  2. Under Brush in the Properties panel, click the Solid color brush tab JJ170658.3a66ec96-47bb-47fc-8876-6b9456feec3a(tr-tr,VS.110).png, the Gradient brush tab JJ170658.91fb0c61-7b3b-4ae7-8a59-760e625e3bd7(tr-tr,VS.110).png, or the Tile brush tab JJ170658.14623a18-70ab-450f-af01-ae9902d60e4d(tr-tr,VS.110).png to begin setting properties for your brush.

  3. When you are ready to save the brush, click Advanced options JJ170658.12e06962-5d8a-480d-a837-e06b84c545bb(tr-tr,VS.110).png next to the brush property (such as the Fill or Background property), and then click Convert to New Resource.

    The Create Brush Resource dialog box appears

    JJ170658.092a1fec-f5b5-427c-a51e-aae1f6a1eee2(tr-tr,VS.110).png

  4. In the Create Brush Resource dialog box, enter a name (key) for your new resource, select where you want the resource to be defined (such as at the application-level, document-level, object-level, or as a part of a resource dictionary), and then click OK.

  5. You can view and modify the brush resource that you created in the Resources panel.

    Viewing and modifying a brush resource in the Resources panel

    JJ170658.64136c65-52bc-4225-a948-b1171634baca(tr-tr,VS.110).png

To apply a brush resource to another object

  1. Select the object to which you want to apply the brush resource.

  2. Under Brush in the Properties panel, select the brush property that you want to change.

  3. Click the Brush resources tab JJ170658.415db740-5a54-48d2-8678-245ccfa7ee8b(tr-tr,VS.110).png.

  4. Under Local Brush Resources, select the brush resource that you want to apply to the object.

    Setting the Fill property of the selected object to the Brush1 resource

    JJ170658.af28e5e4-4861-45ac-b02d-e65386520ed7(tr-tr,VS.110).png

    Not

    You have other ways to apply a resource to an object, such as dragging the resource onto the artboard or using the Advanced options drop-down menu JJ170658.12e06962-5d8a-480d-a837-e06b84c545bb(tr-tr,VS.110).png. For more information, see Apply or remove a resource.

To create a color resource

  1. If you do not already have an object on the artboard with a color property that you want to convert to a resource, you can select Ellipse JJ170658.8938cfdf-9b75-4a33-bc88-b0636e114a0d(tr-tr,VS.110).png from the Tools panel, and draw an ellipse on the artboard. The Properties panel will display the properties for the new ellipse object, with the Fill property selected under Brush.

  2. Under Brush in the Properties panel, click the Solid color brush tab JJ170658.3a66ec96-47bb-47fc-8876-6b9456feec3a(tr-tr,VS.110).png or the Gradient brush tab JJ170658.91fb0c61-7b3b-4ae7-8a59-760e625e3bd7(tr-tr,VS.110).png. Select a color in the color editor. If you are modifying a Gradient brush JJ170658.91fb0c61-7b3b-4ae7-8a59-760e625e3bd7(tr-tr,VS.110).png, you can select a color for each gradient stop JJ170658.a3c9e482-e99b-4504-8a02-9507487d1791(tr-tr,VS.110).png.

    İpucu

    A Color eyedropper JJ170658.2ab2d2fb-3478-4b33-87fb-3cdeb9df4d52(tr-tr,VS.110).png appears in the lower-right corner of the color Editor when you are modifying a Solid color brush JJ170658.3a66ec96-47bb-47fc-8876-6b9456feec3a(tr-tr,VS.110).png or a gradient stop on a Gradient brush JJ170658.91fb0c61-7b3b-4ae7-8a59-760e625e3bd7(tr-tr,VS.110).png. With this eyedropper selected, you can grab a color sample from anywhere on your desktop and apply it to the selected brush. When you modify a Gradient brush JJ170658.91fb0c61-7b3b-4ae7-8a59-760e625e3bd7(tr-tr,VS.110).png, you can select the Gradient eyedropper Degrade Damlalık simgesini and drag a line across a sample of a color anywhere inside the Visual Studio 2012 için Blend application window to apply it to the brush. You can press the ESC key at any time to cancel out of the eyedroppers.

  3. When you are ready to save the color, click Convert color to resource JJ170658.6bf68607-add8-4d87-b6f4-100c8f05dd17(tr-tr,VS.110).png.

    Converting a color to a resource

    JJ170658.89203705-cf66-46e0-b153-52a23cd744f7(tr-tr,VS.110).png

    The Create Color Resource dialog box appears

    JJ170658.6bff8b19-3cd5-41a0-bbf9-ff65532d5aae(tr-tr,VS.110).png

  4. In the Create Color Resource dialog box, enter a name (key) for your new resource, select where you want the resource to be defined (such as at the application-level, document-level, object-level, or as a part of a resource dictionary), and then click OK.

  5. You can view and modify the color resource that you created in the Resources panel, just as you can view and modify a brush resource.

To apply a color resource to another object

  1. Select the object to which you want to apply the color resource.

  2. Under Brush in the Properties panel, select the brush property that you want to change.

  3. Click the Color resources.

  4. Under Local Color Resources, select the color resource that you want to apply to the object.

    Setting the Fill property of the selected object to the Color1 resource

    JJ170658.5cb88f90-c17a-4dad-be87-b6be7d74f410(tr-tr,VS.110).png

Ayrıca bkz.

Görevler

Convert an image to a reusable ImageBrush resource

Copy or apply attributes to an object

Add or remove a gradient stop