Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help with CODE....

Posted on 2006-11-05
8
Medium Priority
?
248 Views
Last Modified: 2010-04-16
Hi
I am useing the following code to draw a ring, of light and its not working?

        private void button1_Click(object sender, EventArgs e)
        {
            Bitmap b = new Bitmap(710, 710);
            b.MakeTransparent(Color.Blue);
            Graphics g = Graphics.FromImage(b);
            g.Clear(Color.WhiteSmoke);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g.DrawEllipse(new Pen(Brushes.White, 6f), 5, 5, 700, 700);
            b.Save(new System.IO.FileStream(@"c:\temp\lightring.gif", System.IO.FileMode.Create), System.Drawing.Imaging.ImageFormat.Gif);
        }
0
Comment
Question by:schenkp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 16

Expert Comment

by:muzzy2003
ID: 17877453
This is drawing a white circle on a very pale background, and it is working. What is the problem you are trying to solve?
0
 

Author Comment

by:schenkp
ID: 17877495
I am tring to have it display over the active form?  But for some reason its not or am i doing something wrong?
0
 
LVL 16

Expert Comment

by:muzzy2003
ID: 17877513
All you're doing here is creating a graphic and saving it out to a file. There's nothing here to display it. Are you talking ASP.NET forms or Windows forms?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 16

Expert Comment

by:muzzy2003
ID: 17877524
If it's Windows forms, try using:

Graphics g = this.CreateGraphics();

instead, and not using your Bitmap b at all.
0
 

Author Comment

by:schenkp
ID: 17877533
       private void button1_Click(object sender, EventArgs e)
        {
            Bitmap b = new Bitmap(710, 710);
            b.MakeTransparent(Color.WhiteSmoke);
            //Graphics g = Graphics.FromImage(b);
            Graphics g = this.CreateGraphics();
            g.Clear(Color.WhiteSmoke);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g.DrawEllipse(new Pen(Brushes.White, 6f), 5, 5, 700, 700);
           // b.Save(new System.IO.FileStream(@"c:\temp\lightring.gif", System.IO.FileMode.Create), System.Drawing.Imaging.ImageFormat.Gif);
        }

0
 

Author Comment

by:schenkp
ID: 17877542
How can i make the everything on the form transparent except for the ring?
0
 
LVL 16

Assisted Solution

by:muzzy2003
muzzy2003 earned 800 total points
ID: 17877559
Remove the g.Clear(Color.WhiteSmoke), and you'll just be drawing the ring onto the form.
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 1200 total points
ID: 17877655
Hi schenkp;

This will make the form transparent except for the ring. I made the color of the ring to yellow because to many things are white and you may not see it.

      private void button1_Click(object sender, System.EventArgs e)
      {
            this.TransparencyKey = Color.WhiteSmoke;
            this.BackColor = Color.WhiteSmoke;
            this.Refresh();
            Graphics g = this.CreateGraphics();
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g.DrawEllipse(new Pen(Brushes.Yellow, 6f), 5, 5, 700, 700);
      }

Fernando
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question