.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 29th, 2005, 08:35 PM
maxus maxus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 2 maxus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 22 sec
Reputation Power: 0
C# .net custom class problem

okay so basically, i have a gdi+ function that loads & draws an image and ran on a button click, and when i tried to make a class out of it, it quit displaying the image. the code for the button is as follows:
Code:
private void button1_Click(object sender, System.EventArgs e)
{
	Bitmap bmp=new Bitmap("gdip.bmp");
	Graphics grf=this.CreateGraphics();
	grf.DrawImage(bmp,0,0);
	grf.Dispose();
}

.. the class looks like so:
Code:
public class Bmp
{
	private Graphics grf;
	private Bitmap img;
	~Bmp(){grf.Dispose();}

	public Bmp(Form f,string fn)
	{
		grf=f.CreateGraphics();
		ld(fn);
	}

	public bool ld(string fn)
	{
		img=new Bitmap(fn);
		return false;
	}

	public bool dr()
	{
		grf.DrawImage(this.img,0,0);	
		return false;
	}
}


and the class calls look like this:
Code:
Bmp bmp;
private void Form1_Load(object sender, System.EventArgs e)
{
	bmp=new Bmp(this,"gdip.bmp");
	bmp.dr();
}


please note that there are no errors on compile, and the bitmap class actually loads the bitmap, but no draw

Reply With Quote
  #2  
Old July 29th, 2005, 09:19 PM
maxus maxus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 2 maxus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 22 sec
Reputation Power: 0
sorry, dont need help with this anymore. the answer was that form_load called a paint afterwards which caused it to not show =/ silly me

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > C# .net custom class problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT