Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7556993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:00:36+00:00 2026-05-30T12:00:36+00:00

I need to call this method, but I can’t find it in any namespace.

  • 0

I need to call this method, but I can’t find it in any namespace.

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.creategraphics.aspx

It says it is in System.Windows.Forms namespace and in System.Windows.Forms.dll.

I am using Visual Studio 2010 and imported the System.Windows.Forms reference into the project.

At the top I made an import (sry, my Java slang) using FORMS = System.Windows.Forms;

Graphics g = FORMS.CreateGraphics(); // error 

Error is: “The type or namespace name ‘CreateGraphics’ does not exist in the namespace ‘System.Windows.Forms (are you missing an assembly reference?)”

Thanks for any help.

—EDIT—

I am trying to run the code from the top answer from this post:

GDI+ / C#: How to save an image as EMF?

—EDIT—

With a user’s suggestions, I am trying:

Graphics g = new Graphics();
FORMS.Control a = new FORMS.Control();
g = a.CreateGraphics();

—EDIT—

Never mind, sorry people, I am stupid. Will accept in a second.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:00:38+00:00Added an answer on May 30, 2026 at 12:00 pm

    This:

    using FORMS = System.Windows.Forms;
    

    Is a namespace alias, not a type alias.

    Namespaces do not have methods defined on them.

    Additionally, CreateGraphics is not static, so can’t be called directly on a type either, only on an instance.

    Assuming that myForm is an instance of Form:

    Graphics g = myForm.CreateGraphics();
    

    In your linked example, CreateGraphics() is called on the this instance implicitly and assumes that the call is within a Form or Control type. So, if you are calling it within a control/form, it will just work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is hopefully a softball syntax question: I need to call a method with
I need to call a method from a webservice, so I've written this code:
In my C++ program, I need to call this c API: GConn* gnet_conn_new (const
I need to call an external dll from c#. This is the header definition:
I need to call a method that accepts a stream argument. The method loads
I need to call a library function that sometimes won't terminate within a given
I am developing an application in which i need to call a particular method
I can fix this problem by messing with outher parts of my codebase but
I need to use some service. The service method that i need to call
The b.GetPixel call in this method is pretty slow, is there a way to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.