Results 1 to 6 of 6

Thread: an error...hmm

  1. #1

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729

    an error...hmm

    error line(the second line)
    PHP Code:
                devFunctions dFunction = new devFunctions();

    dFunction.receivedData += new LiNG_BiNG.Classes.devFunctions.receivedWebData(receivedPicture); 
    PHP Code:
            private void receivedPicture(byte[] data)
            {
                
    MemoryStream mS = new MemoryStream(data);
                
    this.Image Image.FromStream(mS);
            } 

    PHP Code:
        public class devFunctions
        
    {
            
    /// <summary>
            /// Gets the max number of Columns a devTab can get without spacing between pictures
            /// </summary>
            /// <param name="widthOfPictures">The size in pixels of the picture</param>
            /// <param name="widthOfTab">The size in pixels of the devTab</param>
            
    public static int getNumberOfColumns(int widthOfPicturesint widthOfTab)
            {
                
    double res = (double)widthOfTab / (double)(widthOfPictures);
                return (int)
    Math.Floor(res);
            }

            
    /// <summary>
            /// Gets the width in Pixels of each one of the borders of a devTab
            /// </summary>
            /// <param name="numberOfPictures">Number of pictures being populated into the devTab</param>
            /// <param name="widthOfPictures">Width in pixels of the pictures being used</param>
            /// <param name="widthOfTab">Width in pixels of the devTab being used</param>
            
    public static int getSizeOfBorders(int numberOfPicturesint widthOfPicturesint widthOfTab)
            {
                
    int res numberOfPictures widthOfPictures;
                return (
    widthOfTab res) / 2;
            }

            
    /// <summary>
            /// Delegate for receiving data through downloadData() function
            /// </summary>
            
    public delegate void receivedWebData(byte[] data);

            
    /// <summary>
            /// Event that fires when web data is received from downloadData() function
            /// </summary>
            
    public event receivedWebData receivedData;

            public 
    string downloadURL;

            
    /// <summary>
            /// Downloads an text or binary file from the internet
            /// </summary>
            /// <param name="url">The url of the file to be downloaded</param>
            
    public void downloadData(string url)
            {
                try
                {
                    
    downloadURL url;
                    
    System.Threading.Thread thread =
                        new 
    Thread(new System.Threading.ThreadStart(downloaddata));
                }
                catch (
    Exception e)
                {
                    
    string err "There was an error while creating a new thread\n" e.Message;
                    throw (new 
    Exception(err));
                }
            }

            private 
    void downloaddata()
            {
                
    WebClient web = new WebClient();
                
    receivedData(web.DownloadData(downloadURL));
            }
        } 
    error:
    C:\Documents and Settings\JBRANCO\My Documents\Visual Studio Projects\LiNG BiNG\Classes\devButton.cs(95): Cannot access a nonstatic member of outer type 'LiNG_BiNG.Classes.devButton' via nested type 'LiNG_BiNG.Classes.devButton.devButtonOptions'


    i am not getting the problem here..any help
    Last edited by PT Exorcist; Nov 23rd, 2002 at 04:13 PM.
    \m/\m/

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Everything seems ok. Post the code for devButton and devButtonOptions. I think thats where the problem is.
    Dont gain the world and lose your soul

  3. #3

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    PHP Code:
    using System;
    using LiNG_BiNG.Classes;

    namespace 
    LiNG_BiNG.Classes
    {
        public class 
    devOptions
        
    {
            private 
    devTab _parent null;

            private 
    int        _pictureWidth 115;
            private 
    int        _pictureHeight 115;
            private 
    bool    _canDownloadPicture true;

            
    #region Set's \ Get's

            /// <summary>
            /// Gets / Sets the picture width
            /// </summary>
            
    public int pictureWidth
            
    {
                
    get
                
    {
                    return 
    _pictureWidth;
                }
                
    set
                
    {
                    
    _pictureWidth value;
                }
            }

            
    /// <summary>
            /// Gets / Set the picture height
            /// </summary>
            
    public int pictureHeight
            
    {
                
    get
                
    {
                    return 
    _pictureHeight;
                }
                
    set
                
    {
                    
    _pictureHeight value;
                }
            }

            
    /// <summary>
            /// Sets if the picture can download it's thumbnail
            /// </summary>
            
    public bool canDownloadPicture
            
    {
                
    get
                
    {
                    return 
    _canDownloadPicture;
                }
                
    set
                
    {
                    
    _canDownloadPicture value;
                }
            }

            
    #endregion

            #region Constructor

            
    public devOptions(devTab parent)
            {
                
    this._parent parent;
            }

            public 
    devOptions(devTab parentint widthint height)
            {
                
    this._parent parent;
                
    _pictureWidth width;
                
    _pictureHeight height;
            }

            public 
    devOptions(devTab parentint widthint heightbool canDownload)
            {
                
    this._parent parent;
                
    _pictureWidth width;
                
    _pictureHeight height;
                
    _canDownloadPicture canDownload;
            }

            
    #endregion

        
    }

    \m/\m/

  4. #4

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    button:
    PHP Code:
    using System;
    using System.IO;
    using System.Text;
    using System.Drawing;
    using System.Windows.Forms;
    using LiNG_BiNG.Classes;

    namespace 
    LiNG_BiNG.Classes
    {
        public class 
    devButton Button 
        
    {
            
    #region Vars

            
    private devButtonOptions _devOptions null;

            public 
    devButtonOptions devOptions
            
    {
                
    get
                
    {
                    return 
    _devOptions;
                }
            }

            public class 
    devButtonOptions
            
    {
                private 
    devButton    _parent                null;
                private 
    string        _urlOfThumbnail        ;
                private 
    string        _urlOfFullPicture    ;
                private 
    bool        _hasImage            false;
                private 
    bool        _isDownloading        false;

                
    /// <summary>
                /// Gets the url of the thumbnail version picture
                /// </summary>
                
    public string urlOfThumbnail
                
    {
                    
    get
                    
    {
                        return 
    _urlOfThumbnail;
                    }
                }

                
    /// <summary>
                /// Gets the url of the full size picture
                /// </summary>
                
    public string urlOfFullPicture
                
    {
                    
    get
                    
    {
                        return 
    _urlOfFullPicture;
                    }
                    
    set
                    
    {
                        
    _urlOfFullPicture value;
                    }
                }

                
    /// <summary>
                /// Gets if the current button has an image
                /// </summary>
                
    public bool hasImage
                
    {
                    
    get
                    
    {
                        return 
    _hasImage;
                    }
                }

                
    /// <summary>
                /// Gets if the picture is being downloaded or not
                /// </summary>
                
    public bool isDownloading
                
    {
                    
    get
                    
    {
                        return 
    _isDownloading;
                    }
                }

                public 
    devButtonOptions(devButton parent)
                {
                    
    this._parent parent;
                }

                
    devFunctions dFunction = new devFunctions();

                public 
    void downloadPicture(string url)
                {
                    try
                    {
                        
    this._isDownloading true;
                        
    this._urlOfThumbnail url;
                        
    dFunction.downloadData(url);
                        
    dFunction.receivedData +=
                            new 
    LiNG_BiNG.Classes.devFunctions.receivedWebData(receivedPicture);
                        
    this._hasImage true;
                    }
                    catch (
    Exception e)
                    {
                        
    string error "There was an error in downloadPicture(string url)\n" e.Message;
                        throw (new 
    ArgumentException(error,error));
                    }
                }
            }

            
    #endregion

            #region Constructors
            
    public devButton()
            {
                
    _devOptions = new devButtonOptions(this);
                
    this.FlatStyle System.Windows.Forms.FlatStyle.Flat;
                
    this.Size = new System.Drawing.Size(115115);
                
    this.Click += new EventHandler(button_click);
            }

            public 
    devButton(string textstring url)
            {
                
    _devOptions = new devButtonOptions(this);
                
    this.FlatStyle System.Windows.Forms.FlatStyle.Flat;
                
    this.Size = new System.Drawing.Size(115115);
                
    this.Text text;
                
    this.devOptions.downloadPicture(url);

                
    this.Click += new EventHandler(button_click);
            }
            
    #endregion

            
    private void button_click(object senderEventArgs e)
            {
                if (
    this.BackColor != SystemColors.ControlDarkDark)
                {
                    
    this.BackColor SystemColors.ControlDarkDark;
                }
                else
                {
                    
    this.BackColor SystemColors.Control;
                }
            }

            private 
    void receivedPicture(byte[] data)
            {
                
    MemoryStream mS = new MemoryStream(data);
                
    this.Image Image.FromStream(mS);
            }
        }

    \m/\m/

  5. #5

    Thread Starter
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    doh im such a dumb! that eventhandler was refering to a function outside the class! msdn help rlz anyways without the class view i couldnt never get there i think..lol tks anyways devgrp
    \m/\m/

  6. #6
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Cool
    Dont gain the world and lose your soul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width