Anzeige

 erstellte dll ist leer


#1
hallo,
kann mir jemand sagen warum meine erstellte dll "leer" ist.
soll heißen ich hab zwar ne dll aber da ist weder nen namespace noch ne klasse drinne.

Code:
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace nativeMethods
{
    class nativeMethods
    {
        [DllImportAttribute("user32.dll")]
        private static extern int SendMessage(IntPtr hwnd, int msg, int wparam, int lparam);
        [DllImportAttribute("user32.dll")]
        private static extern bool ReleaseCapture();
        private const int WM_NCLBUTTONDOWN = 0xa1;
        private const int HT_CAPTION = 0x2;
        private const int WS_MINIMIZEBOX = 0x20000;
        private const int CS_DBLCLKS = 0x8;
        private bool maximiert;
        private bool hover;
        public Form Form;
        private Image minimize_standard;
        private Image minimize_hover;
        private Image maximize_standard;
        private Image maximize_hover;
        private Image restore_standard;
        private Image restore_hover;
        private Image close_standard;
        private Image close_hover;
        private Image img_standard;
        private Image img_hover;

        public nativeMethods(Form Form)
        {
            this.Form = Form;
        }

        public static void NonClientAreaDragging(IntPtr hwnd)
        {
            ReleaseCapture();
            SendMessage(hwnd, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
        }


        public void createMinimizeButton(PictureBox PictureBox, Image standard, Image hover)
        {
            minimize_standard = standard;
            minimize_hover = hover;
            PictureBox.Click += new EventHandler(minimize_Click);
            PictureBox.MouseEnter += new EventHandler(minimize_MouseEnter);
            PictureBox.MouseLeave += new EventHandler(minimize_MouseLeave);
        }

        public void createMaximizeRestoreButton(PictureBox PictureBox, Image maximize_standard, Image maximize_hover, Image restore_standard, Image restore_hover)
        {
            this.maximize_standard = maximize_standard;
            this.maximize_hover = maximize_hover;
            this.restore_standard = restore_standard;
            this.restore_hover = restore_hover;
            PictureBox.Click += new EventHandler(maximizeRestore_Click);
            PictureBox.MouseEnter += new EventHandler(maximizeRestore_MouseEnter);
            PictureBox.MouseLeave += new EventHandler(maximizeRestore_MouseLeave);
        }

        public void createCloseButton(PictureBox PictureBox, Image standard, Image hover)
        {
            close_standard = standard;
            close_hover = hover;
            PictureBox.Click += new EventHandler(close_Click);
            PictureBox.MouseEnter += new EventHandler(close_MouseEnter);
            PictureBox.MouseLeave += new EventHandler(close_MouseLeave);
        }

        public void minimize_Click(object sender, EventArgs e)
        {
            Form.WindowState = FormWindowState.Minimized;
        }

        public void minimize_MouseEnter(object sender, EventArgs e)
        {
            img_standard = minimize_standard;
            img_hover = minimize_hover;
            toggleControls(sender as PictureBox);
        }

        public void minimize_MouseLeave(object sender, EventArgs e)
        {
            toggleControls(sender as PictureBox);
        }

        public void maximizeRestore_Click(object sender, EventArgs e)
        {
            if (maximiert)
            {
                Form.WindowState = FormWindowState.Normal;
                maximiert = false;
            }
            else
            {
                Form.MaximumSize = new System.Drawing.Size(Screen.FromHandle(Form.Handle).WorkingArea.Width, Screen.FromHandle(Form.Handle).WorkingArea.Height);
                Form.WindowState = FormWindowState.Maximized;
                maximiert = true;
            }
        }
        public void maximizeRestore_MouseEnter(object sender, EventArgs e)
        {
            if (maximiert)
            {
                img_standard = restore_standard;
                img_hover = restore_hover;
            }
            else
            {
                img_standard = maximize_standard;
                img_hover = maximize_hover;
            }
            toggleControls(sender as PictureBox);
        }

        public void maximizeRestore_MouseLeave(object sender, EventArgs e)
        {
            toggleControls(sender as PictureBox);
        }

        public void close_Click(object sender, EventArgs e)
        {
            Form.Close();
        }

        public void close_MouseEnter(object sender, EventArgs e)
        {
            img_standard = close_standard;
            img_hover = close_hover;
            toggleControls(sender as PictureBox);
        }

        public void close_MouseLeave(object sender, EventArgs e)
        {
            toggleControls(sender as PictureBox);
        }

        public void toggleControls(PictureBox control)
        {
            if (hover)
            {
                control.Image = img_standard;
                hover = false;
            }
            else
            {
                control.Image = img_hover;
                hover = true;
            }
        }
    }
}
 

Spyke

Capoeirista
Premium-User
#2
du hast bei deiner Klasse nativeMethods keinen modifierer angegeben.
Somit ist diese standardmäßig erstmal internal, sprich nur innerhalb der eigenen DLL sichtbar, setzte mal public davor damits auch von außen sichtbar ist.

Code:
public class nativeMethods
Ansosnten wir kommst du drauf das nixs drin ist?
Per reflector oder ILSpy nachgesehen?
 
#3
per objektkatalog in visual studio nachgesehen. und da ist denn weder ne klasse noch nen namespace vorhanden

ok das fehlende public wars, da hab ich wieder mal den wald vor bäumen nicht gesehen
danke
 
Zuletzt bearbeitet:
Anzeige
Anzeige