Tuesday 15 July 2014

c# - graphics from a class onto a form -


OK, so I needed to create simple animation in C # to use as a loading icon. If all this works fine and good then this class should be taken as an example

  PictureBox square = new PictureBox (); Bitmap BM = new bitmap (Square width, square. Height); Graphics Graphics = Graphics. Framesize (bm); BaseImage.DrawRectangle (pen.black, 0, 0, 100, 100); category. Image = BM;   

So I worked my animation and everything here, but then I realized that I need to keep my animation in an orbit, so that I tell it from my affiliate programs. This is the place where the problem came, I made my class and I did everything in the same way, but instead of a class, for the form, I called my class with my form but the screen was empty and there was no animation. Is there something that needs to be passed to do this?

  Namespace Spinning Logo {// Here is a sample of my class class test {public zero class () {PictureBox square = new PictureBox (); Bitmap BM = new bitmap (Square width, square. Height); Graphics Graphics = Graphics. Framesize (bm); BaseImage.DrawRectangle (pen.black, 0, 0, 100, 100); category. Image = BM; }}} Private Zero Button 1_Click (Object Sender, EventArgs E) {// Here I'll debug my class how. WrightLine ("11"); Test class = new test (); Square.square (); }    

your test class pass picturebox < / Code> is in the form:

  Namespace spinning logo {class test {public zero class (picture box pp) {bitmap BM = new bitmap (PP, with PP.); Graphics Graphics = Graphics. Framesize (bm); BaseImage.DrawRectangle (pen.black, 0, 0, 100, 100); ThePB.Image = BM; }}} Private Zero Button 1_Click (Object Sender, EventArgs E) {test class = new exam (); Square.square (myPictureBox); You can also pass    by using  , but then you can still use the  picture box  Control (I think) must be id.   

No comments:

Post a Comment