SIGN UP MEMBER LOGIN:    
Blog

Create Custom Message Box and Marshal arcGis Object in C#

Posted by Yogesh Sharma Blogs | C# Language Sep 14, 2011
In this blog you will learn how to create Customize Message box with form object and Marshal arcGis Object in C#.

Custom Message Box

using
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
 
namespace messagebox1
{
     public delegate void EventHandler(object sender, EventArgs e);
     public class Class1
     {
        Button btnOk;
        Button btnCancel;
        Form f;
        Label lbl;
        public String msg = String.Empty;
 
        public Class1(String mess)
        {
            msg = mess;
        }
        public void show()
        {
            f = new Form();
            f.Size = new Size(350, 100);
            f.MaximizeBox = false;
            f.MinimizeBox = false;
            f.HelpButton = false;
            f.Text = "Message..";
            f.BackColor = Color.Lavender;
             //btnOk = new Button();
             //btnOk.Size = new Size(75, 25);
            //this.btnOk.Location = new System.Drawing.Point(95, 45);
             //this.btnOk.BackColor = Color.LightBlue;
             //f.Controls.Add(btnOk);
             //this.btnOk.Click += new
             System.EventHandler(this.button1_Click);
            btnCancel = new Button();
            btnCancel.Size = new Size(75, 25);
            this.btnCancel.BackColor = Color.LightBlue;
            this.btnCancel.Location = new System.Drawing.Point(140, 50);
            this.btnCancel.Font = new System.Drawing.Font("Courier New", 9F,
            System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
            ((byte(0)));
            this.btnCancel.Text = "OK";
             f.Controls.Add(btnCancel);
             this.btnCancel.Click += new
             
System.EventHandler(this.button2_Click);
             lbl = new Label();
             lbl.Text = msg;
             lbl.Location = new System.Drawing.Point(30, 15);
             this.lbl.Font = new System.Drawing.Font("Courier New", 9F,
             
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.
             Point,
         
             ((byte)(0)));
             f.Controls.Add(lbl);
             f.Show(); 
        }
        public void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("hell");
        }
        public void button2_Click(object sender, EventArgs e)
        {
            f.Dispose();
            f = null;
        } 

    }

}

Marshal arcGis Object

public
void marshal_object(object o)
        {
            if (o != null)
            {
                 System.Runtime.InteropServices.Marshal.ReleaseComObject(o);
                o = null;
            }
        }

share this blog :
post comment