---
title: "In WPF how to give the InteropBitmap drawing font"  
description: "In WPF how to give the InteropBitmap drawing font"  
author: "Manoj Bhatt"  
published: 2013-09-23  
updated: 2013-09-23  
canonical: https://www.mindstick.com/forum/1486/in-wpf-how-to-give-the-interopbitmap-drawing-font  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# In WPF how to give the InteropBitmap drawing font

**ex winform****：**

[Graphics](https://www.mindstick.com/articles/336067/html-graphics-using-html) g = Graphics.FromImage(newimg);

[String](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) str = "[hello world](https://www.mindstick.com/forum/12912/how-to-show-hello-world-backbone-marionette-js)";

Font font = new Font("Arial", 30);

SolidBrush sbrush = new SolidBrush(Color.Black);

g.DrawString(str, font, sbrush, new PointF(100, 120));

In the [WPF](https://www.mindstick.com/forum/304/wpf) on how the InteropBitmap to do the same thing?

## Replies

### Reply by Sumit Kesarwani

Hi Manoj,\

The graphics object in Wpf is different than Winforms since Wpf uses Vector Graphics. In Wpf you will be using a DrawingVisual, DrawingContext, FormattedText and a BitmapImage, the DrawingContext is equivalent to the Graphics object in Winforms. This is a quick example to show what I mean.

```
public MainWindow(){    InitializeComponent();    Grid myGrid = new Grid();    BitmapImage bmp = new BitmapImage(new Uri(@"C:\temp\test.jpg")); //Use the path to your Image    DrawingVisual dv = new DrawingVisual();    DrawingContext dc = dv.RenderOpen();    dc.DrawImage(bmp, new Rect(100, 100, 300, 300));    dc.DrawText(new FormattedText("Hello World",                CultureInfo.GetCultureInfo("en-us"),                FlowDirection.LeftToRight,                new Typeface("Arial"),                30, System.Windows.Media.Brushes.Black),                new System.Windows.Point(100, 120));    dc.Close();    myGrid.Background = new VisualBrush(dv);    this.Content = myGrid;}
```


---

Original Source: https://www.mindstick.com/forum/1486/in-wpf-how-to-give-the-interopbitmap-drawing-font

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
