+ Private Sub DataSet_BeforeFetch(ByVal sender As Object, ByVal e As C1.Data.FetchEventArgs) Handles DataSet.BeforeFetch
+ If e.TableView Is Nothing Then
+ e.TableViews("maindata").FetchIndex = 0
+ End If
+ End Sub
+
+ private void dataset_DataSet_BeforeFetch(object sender, C1.Data.FetchEventArgs e)
+ {
+ if (e.TableView == null)
+ e.TableViews["maindata"].FetchIndex = 0;
+ }
+
+ procedure TForm.dataset_BeforeFetch(sender: System.Object; e: C1.Data.FetchEventArgs);
+ begin
+ if e.TableView = nil then
+ e.TableViews['maindata'].FetchIndex := 0;
+ end;
+
+ LicenseInfo _licInfo;
+ public LicensedControl()
+ {
+ // check license but don't nag yet
+ _licInfo = ProviderInfo.Validate(typeof(LicensedControl), this, false);
+
+ // perform licensing after control is fully loaded
+ Loaded += LicensedControl_Loaded;
+ }
+ void LicensedControl_Loaded(object sender, RoutedEventArgs e)
+ {
+ // nag after loading
+ if (_licInfo.ShouldNag)
+ {
+ ProviderInfo.ShowAboutBox(this);
+ }
+ }
+
+
+ private void c1ContextMenu1_Popup(object sender, EventArgs e)
+ {
+ Control c = c1ContextMenu1.SourceControl;
+ // Copy and Find is dispayed for textBox1
+ c1CommandCopy.Visible = (c == textBox1);
+ c1CommandFind.Visible = (c == textBox1);
+ // Change Picture is dispayed for pictureBox1
+ c1CommandChangePicture.Visible = (c == pictureBox1);
+ }
+
+
+ Private Sub C1TopicBar1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles C1TopicBar1.MouseMove
+ Dim ht As C1.Win.C1Command.C1TopicBarHitTestInfo = C1TopicBar1.HitTest(e.Location)
+ Label1.Text = ht.Type.ToString()
+ If (Not IsNothing(ht.Page)) Then
+ Label2.Text = ht.Page.Text
+ Else
+ Label2.Text = ""
+ End If
+ If (Not IsNothing(ht.Link)) Then
+ Label3.Text = ht.Link.Text
+ Else
+ Label3.Text = ""
+ End If
+ End Sub
+
+ c1DateEdit1.Calendar.CalendarDimensions = new Size(3, 1);
+ // Display current month at the center of the calendar.
+ // Other possible values:
+ // 0 - (Default) - at the Right
+ // 1 - Center
+ // 2 - Left
+ c1DateEdit1.Calendar.CurrentMonthDisplayOffset = 1;
+
+ private void c1DateEdit1_Calendar_MonthChanged(object sender, EventArgs e)
+ {
+ DateTime dt = c1DateEdit1.Calendar.FirstMonth;
+ c1DateEdit1.Calendar.AddBoldedDate(new DateTime(dt.Year, dt.Month, dt.Month));
+ }
+ "" Then
+ If sb.ToString() <> "" Then
+ sb.Append(" AND ")
+ End If
+ sb.Append(cond)
+ End If
+
+ Next dc
+ ' filter the data
+ Me.DataSet11.Tables(0).DefaultView.RowFilter = sb.ToString()
+ End Sub]]>
+ private void c1TrueDBGrid1_FetchCellStyle(object sender, C1.Win.C1TrueDBGrid.FetchCellStyleEventArgs e)
+ {
+ ViewRow row = this.c1TrueDBGrid1.Splits[0].Rows[e.Row];
+ if (row.RowType == RowTypeEnum.DataRow)
+ {
+ bool val = (bool)this.c1TrueDBGrid1[row.DataRowIndex, 3];
+ if (val == true)
+ e.CellStyle.BackColor = Color.Red;
+ }
+ }
+
+
+ public class CustPrintForm : C1.Win.C1TrueDBGrid.PrintForm
+ {
+ public CustPrintForm(): base()
+ {
+ }
+
+ protected override void Init()
+ {
+ base.Init();
+ FormBorderStyle = FormBorderStyle.Sizable;
+ this.ControlBox = true;
+ this.MinimizeBox = false;
+ this.MaximizeBox = false;
+ }
+ }
+
+ Public Sub InsertRow(myConnectionString As String)
+ " If the connection string is null, use a default.
+ If myConnectionString = "" Then
+ myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
+ End If
+ Dim myConnection As New MySqlConnection(myConnectionString)
+ Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
+ Dim myCommand As New MySqlCommand(myInsertQuery)
+ myCommand.Connection = myConnection
+ myConnection.Open()
+ myCommand.ExecuteNonQuery()
+ myCommand.Connection.Close()
+ End Sub
+
+
+ public void InsertRow(string myConnectionString)
+ {
+ // If the connection string is null, use a default.
+ if(myConnectionString == "")
+ {
+ myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
+ }
+ MySqlConnection myConnection = new MySqlConnection(myConnectionString);
+ string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
+ MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
+ myCommand.Connection = myConnection;
+ myConnection.Open();
+ myCommand.ExecuteNonQuery();
+ myCommand.Connection.Close();
+ }
+
+
+ Public Sub CreateMySqlCommand()
+ Dim myConnection As New MySqlConnection _
+ ("Persist Security Info=False;database=test;server=myServer")
+ myConnection.Open()
+ Dim myTrans As MySqlTransaction = myConnection.BeginTransaction()
+ Dim mySelectQuery As String = "SELECT * FROM MyTable"
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection, myTrans)
+ myCommand.CommandTimeout = 20
+ End Sub
+
+
+ public void CreateMySqlCommand()
+ {
+ MySqlConnection myConnection = new MySqlConnection("Persist Security Info=False;
+ database=test;server=myServer");
+ myConnection.Open();
+ MySqlTransaction myTrans = myConnection.BeginTransaction();
+ string mySelectQuery = "SELECT * FROM myTable";
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection,myTrans);
+ myCommand.CommandTimeout = 20;
+ }
+
+
+ public:
+ void CreateMySqlCommand()
+ {
+ MySqlConnection* myConnection = new MySqlConnection(S"Persist Security Info=False;
+ database=test;server=myServer");
+ myConnection->Open();
+ MySqlTransaction* myTrans = myConnection->BeginTransaction();
+ String* mySelectQuery = S"SELECT * FROM myTable";
+ MySqlCommand* myCommand = new MySqlCommand(mySelectQuery, myConnection, myTrans);
+ myCommand->CommandTimeout = 20;
+ };
+
+
+ Public Sub CreateMySqlCommand()
+ Dim myCommand As New MySqlCommand()
+ myCommand.CommandType = CommandType.Text
+ End Sub
+
+
+ public void CreateMySqlCommand()
+ {
+ MySqlCommand myCommand = new MySqlCommand();
+ myCommand.CommandType = CommandType.Text;
+ }
+
+
+ Public Sub CreateMySqlCommand()
+ Dim sql as String = "SELECT * FROM mytable"
+ Dim myCommand As New MySqlCommand(sql)
+ myCommand.CommandType = CommandType.Text
+ End Sub
+
+
+ public void CreateMySqlCommand()
+ {
+ string sql = "SELECT * FROM mytable";
+ MySqlCommand myCommand = new MySqlCommand(sql);
+ myCommand.CommandType = CommandType.Text;
+ }
+
+
+ Public Sub CreateMySqlCommand()
+ Dim conn as new MySqlConnection("server=myServer")
+ Dim sql as String = "SELECT * FROM mytable"
+ Dim myCommand As New MySqlCommand(sql, conn)
+ myCommand.CommandType = CommandType.Text
+ End Sub
+
+
+ public void CreateMySqlCommand()
+ {
+ MySqlConnection conn = new MySqlConnection("server=myserver")
+ string sql = "SELECT * FROM mytable";
+ MySqlCommand myCommand = new MySqlCommand(sql, conn);
+ myCommand.CommandType = CommandType.Text;
+ }
+
+
+ Public Sub CreateMySqlCommand()
+ Dim conn as new MySqlConnection("server=myServer")
+ conn.Open();
+ Dim txn as MySqlTransaction = conn.BeginTransaction()
+ Dim sql as String = "SELECT * FROM mytable"
+ Dim myCommand As New MySqlCommand(sql, conn, txn)
+ myCommand.CommandType = CommandType.Text
+ End Sub
+
+
+ public void CreateMySqlCommand()
+ {
+ MySqlConnection conn = new MySqlConnection("server=myserver")
+ conn.Open();
+ MySqlTransaction txn = conn.BeginTransaction();
+ string sql = "SELECT * FROM mytable";
+ MySqlCommand myCommand = new MySqlCommand(sql, conn, txn);
+ myCommand.CommandType = CommandType.Text;
+ }
+
+
+ Public Sub CreateMySqlCommand()
+ Dim myCommand As New MySqlCommand()
+ myCommand.CommandText = "SELECT * FROM Mytable ORDER BY id"
+ myCommand.CommandType = CommandType.Text
+ End Sub
+
+
+ public void CreateMySqlCommand()
+ {
+ MySqlCommand myCommand = new MySqlCommand();
+ myCommand.CommandText = "SELECT * FROM mytable ORDER BY id";
+ myCommand.CommandType = CommandType.Text;
+ }
+
+
+ Public Sub CreateMySqlCommand()
+ Dim myCommand As New MySqlCommand()
+ myCommand.CommandType = CommandType.Text
+ End Sub
+
+
+ public void CreateMySqlCommand()
+ {
+ MySqlCommand myCommand = new MySqlCommand();
+ myCommand.CommandType = CommandType.Text;
+ }
+
+
+ Public Sub CreateMySqlCommand()
+ Dim mySelectQuery As String = "SELECT * FROM mytable ORDER BY id"
+ Dim myConnectString As String = "Persist Security Info=False;database=test;server=myServer"
+ Dim myCommand As New MySqlCommand(mySelectQuery)
+ myCommand.Connection = New MySqlConnection(myConnectString)
+ myCommand.CommandType = CommandType.Text
+ End Sub
+
+
+ public void CreateMySqlCommand()
+ {
+ string mySelectQuery = "SELECT * FROM mytable ORDER BY id";
+ string myConnectString = "Persist Security Info=False;database=test;server=myServer";
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery);
+ myCommand.Connection = new MySqlConnection(myConnectString);
+ myCommand.CommandType = CommandType.Text;
+ }
+
+
+ Public Sub CreateMySqlCommand(myConnection As MySqlConnection, _
+ mySelectQuery As String, myParamArray() As MySqlParameter)
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
+ myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age"
+ myCommand.UpdatedRowSource = UpdateRowSource.Both
+ myCommand.Parameters.Add(myParamArray)
+ Dim j As Integer
+ For j = 0 To myCommand.Parameters.Count - 1
+ myCommand.Parameters.Add(myParamArray(j))
+ Next j
+ Dim myMessage As String = ""
+ Dim i As Integer
+ For i = 0 To myCommand.Parameters.Count - 1
+ myMessage += myCommand.Parameters(i).ToString() & ControlChars.Cr
+ Next i
+ Console.WriteLine(myMessage)
+ End Sub
+
+
+ public void CreateMySqlCommand(MySqlConnection myConnection, string mySelectQuery,
+ MySqlParameter[] myParamArray)
+ {
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
+ myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age";
+ myCommand.Parameters.Add(myParamArray);
+ for (int j=0; j<myParamArray.Length; j++)
+ {
+ myCommand.Parameters.Add(myParamArray[j]) ;
+ }
+ string myMessage = "";
+ for (int i = 0; i < myCommand.Parameters.Count; i++)
+ {
+ myMessage += myCommand.Parameters[i].ToString() + "\n";
+ }
+ MessageBox.Show(myMessage);
+ }
+
+
+ Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As MySqlConnection)
+ Dim myCommand As New MySqlCommand(myExecuteQuery, myConnection)
+ myCommand.Connection.Open()
+ myCommand.ExecuteNonQuery()
+ myConnection.Close()
+ End Sub
+
+
+ public void CreateMySqlCommand(string myExecuteQuery, MySqlConnection myConnection)
+ {
+ MySqlCommand myCommand = new MySqlCommand(myExecuteQuery, myConnection);
+ myCommand.Connection.Open();
+ myCommand.ExecuteNonQuery();
+ myConnection.Close();
+ }
+
+
+ Public Sub CreateMySqlDataReader(mySelectQuery As String, myConnection As MySqlConnection)
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
+ myConnection.Open()
+ Dim myReader As MySqlDataReader
+ myReader = myCommand.ExecuteReader()
+ Try
+ While myReader.Read()
+ Console.WriteLine(myReader.GetString(0))
+ End While
+ Finally
+ myReader.Close
+ myConnection.Close
+ End Try
+ End Sub
+
+
+ public void CreateMySqlDataReader(string mySelectQuery, MySqlConnection myConnection)
+ {
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
+ myConnection.Open();
+ MMySqlDataReader myReader;
+ myReader = myCommand.ExecuteReader();
+ try
+ {
+ while(myReader.Read())
+ {
+ Console.WriteLine(myReader.GetString(0));
+ }
+ }
+ finally
+ {
+ myReader.Close();
+ myConnection.Close();
+ }
+ }
+
+
+ Public Sub CreateMySqlCommand(myScalarQuery As String, myConnection As MySqlConnection)
+ Dim myCommand As New MySqlCommand(myScalarQuery, myConnection)
+ myCommand.Connection.Open()
+ myCommand.ExecuteScalar()
+ myConnection.Close()
+ End Sub
+
+
+ public void CreateMySqlCommand(string myScalarQuery, MySqlConnection myConnection)
+ {
+ MySqlCommand myCommand = new MySqlCommand(myScalarQuery, myConnection);
+ myCommand.Connection.Open();
+ myCommand.ExecuteScalar();
+ myConnection.Close();
+ }
+
+
+ public:
+ void CreateMySqlCommand(String* myScalarQuery, MySqlConnection* myConnection)
+ {
+ MySqlCommand* myCommand = new MySqlCommand(myScalarQuery, myConnection);
+ myCommand->Connection->Open();
+ myCommand->ExecuteScalar();
+ myConnection->Close();
+ }
+
+
+
+ public sub PrepareExample()
+ Dim cmd as New MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection)
+ cmd.Parameters.Add( "@val", 10 )
+ cmd.Prepare()
+ cmd.ExecuteNonQuery()
+
+ cmd.Parameters(0).Value = 20
+ cmd.ExecuteNonQuery()
+ end sub
+
+
+ private void PrepareExample()
+ {
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection);
+ cmd.Parameters.Add( "@val", 10 );
+ cmd.Prepare();
+ cmd.ExecuteNonQuery();
+
+ cmd.Parameters[0].Value = 20;
+ cmd.ExecuteNonQuery();
+ }
+
+
+
+ Public Sub InsertRow(myConnectionString As String)
+ ' If the connection string is null, use a default.
+ If myConnectionString = "" Then
+ myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
+ End If
+ Dim myConnection As New MySqlConnection(myConnectionString)
+ Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
+ Dim myCommand As New MySqlCommand(myInsertQuery)
+ myCommand.Connection = myConnection
+ myConnection.Open()
+ myCommand.ExecuteNonQuery()
+ myCommand.Connection.Close()
+ End Sub
+
+
+
+
+ public void InsertRow(string myConnectionString)
+ {
+ // If the connection string is null, use a default.
+ if(myConnectionString == "")
+ {
+ myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
+ }
+ MySqlConnection myConnection = new MySqlConnection(myConnectionString);
+ string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
+ MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
+ myCommand.Connection = myConnection;
+ myConnection.Open();
+ myCommand.ExecuteNonQuery();
+ myCommand.Connection.Close();
+ }
+
+
+
+ Public Sub CreateSqlConnection()
+ Dim myConnection As New MySqlConnection()
+ myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30"
+ myConnection.Open()
+ End Sub
+
+
+ public void CreateSqlConnection()
+ {
+ MySqlConnection myConnection = new MySqlConnection();
+ myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30";
+ myConnection.Open();
+ }
+
+
+ Public Sub CreateMySqlConnection()
+ Dim myConnString As String = _
+ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
+ Dim myConnection As New MySqlConnection( myConnString )
+ myConnection.Open()
+ MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
+ + ControlChars.NewLine + "Database: " + myConnection.Database )
+ myConnection.ChangeDatabase( "test2" )
+ MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.NewLine + "Database: " + myConnection.Database )
+ myConnection.Close()
+ End Sub
+
+
+
+ public void CreateMySqlConnection()
+ {
+ string myConnString =
+ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
+ MySqlConnection myConnection = new MySqlConnection( myConnString );
+ myConnection.Open();
+ MessageBox.Show( "Server Version: " + myConnection.ServerVersion
+ + "\nDatabase: " + myConnection.Database );
+ myConnection.ChangeDatabase( "test2" );
+ MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
+ + "\nDatabase: " + myConnection.Database );
+ myConnection.Close();
+ }
+
+
+ Public Sub CreateMySqlConnection(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.Cr + "State: " + myConnection.State.ToString())
+ myConnection.Close()
+ End Sub
+
+
+ public void CreateMySqlConnection(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
+ "\nState: " + myConnection.State.ToString());
+ myConnection.Close();
+ }
+
+
+ Public Sub CreateMySqlConnection(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.Cr + "State: " + myConnection.State.ToString())
+ myConnection.Close()
+ End Sub
+
+
+ public void CreateMySqlConnection(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
+ "\nState: " + myConnection.State.ToString());
+ myConnection.Close();
+ }
+
+ | Name | +Default | +Description | +
|---|---|---|
|
+ Connect Timeout |
+ 15 | ++ The length of time (in seconds) to wait for a connection to the server before + terminating the attempt and generating an error. + | +
|
+ Host |
+ localhost | +
+ |
+
| Port | +3306 | ++ The port MySQL is using to listen for connections. This value is ignored if the connection protocol + is anything but socket. + | +
| Protocol | +socket | +
+ Specifies the type of connection to make to the server. + pipe for a named pipe connection + unix for a Unix socket connection + memory to use MySQL shared memory + |
+
|
+ CharSet |
+ + | + Specifies the character set that should be used to encode all queries sent to the server. + Resultsets are still returned in the character set of the data returned. + | +
| Logging | +false | +When true, various pieces of information is output to any configured TraceListeners. | +
| Allow Batch | +true | +
+ When true, multiple SQL statements can be sent with one command execution. + -Note- + Starting with MySQL 4.1.1, batch statements should be separated by the server-defined seperator character. + Commands sent to earlier versions of MySQL should be seperated with ';'. + |
+
| Encrypt | +false | ++ When true, SSL/TLS encryption is used for all data sent between the + client and server if the server has a certificate installed. Recognized values + are true, false, yes, and no. + | +
|
+ Initial Catalog |
+ mysql | +The name of the database to use intially | +
|
+ Password |
+ + | The password for the MySQL account being used. | +
| Persist Security Info | +false | ++ When set to false or no (strongly recommended), security-sensitive + information, such as the password, is not returned as part of the connection if + the connection is open or has ever been in an open state. Resetting the + connection string resets all connection string values including the password. + Recognized values are true, false, yes, and no. + | +
|
+ User Id |
+ + | The MySQL login account being used. | +
| Shared Memory Name | +MYSQL | +The name of the shared memory object to use for communication if the connection protocol is set to memory. | +
| Allow Zero Datetime | +false | ++ True to have MySqlDataReader.GetValue() return a MySqlDateTime for date or datetime columns that have illegal values. + False will cause a DateTime object to be returned for legal values and an exception will be thrown for illegal values. + | +
| Convert Zero Datetime | +false | ++ True to have MySqlDataReader.GetValue() and MySqlDataReader.GetDateTime() + return DateTime.MinValue for date or datetime columns that have illegal values. + | +
|
+ Pipe Name |
+ mysql | +
+ When set to the name of a named pipe, the MySqlConnection will attempt to connect to MySQL
+ on that named pipe. This settings only applies to the Windows platform. + |
+
|
+ Use Performance Monitor |
+ false | ++ Posts performance data that can be tracked using perfmon + | +
| + Procedure Cache Size + | +25 | ++ How many stored procedure definitions can be held in the cache + | +
| + Ignore Prepare + | +true | ++ Instructs the provider to ignore any attempts to prepare commands. This option + was added to allow a user to disable prepared statements in an entire application + without modifying the code. A user might want to do this if errors or bugs are + encountered with MySQL prepared statements. + | +
| Use Procedure Bodies | +true | ++ Instructs the provider to attempt to call the procedure without first resolving the metadata. This + is useful in situations where the calling user does not have access to the mysql.proc table. To + use this mode, the parameters for the procedure must be added to the command in the same order + as they appear in the procedure definition and their types must be explicitly set. + | +
| Auto Enlist | +true | ++ Indicates whether the connection should automatically enlist in the current transaction, + if there is one. + | +
| Respect Binary Flags | +true | ++ Indicates whether the connection should respect all binary flags sent to the client + as part of column metadata. False will cause the connector to behave like + Connector/NET 5.0 and earlier. + | +
| BlobAsUTF8IncludePattern | +null | ++ Pattern that should be used to indicate which blob columns should be treated as UTF-8. + | +
| BlobAsUTF8ExcludePattern | +null | ++ Pattern that should be used to indicate which blob columns should not be treated as UTF-8. + | +
| Default Command Timeout | +30 | ++ The default timeout that new MySqlCommand objects will use unless changed. + | +
| Allow User Variables | +false | ++ Should the provider expect user variables in the SQL. + | +
| Interactive -or- Interactive Session | +false | ++ Should this session be considered interactive? + | +
| Functions Return String | +false | ++ Set this option to true to force the return value of SQL functions to be string. + | +
| Use Affected Rows | +false | ++ Set this option to true to cause the affected rows reported to reflect only the + rows that are actually changed. By default, the number of rows that are matched + is returned. + | +
| Name | +Default | +Description | +
|---|---|---|
| Connection Lifetime | +0 | +
+ When a connection is returned to the pool, its creation time is compared with
+ the current time, and the connection is destroyed if that time span (in seconds)
+ exceeds the value specified by Connection Lifetime. This is useful in
+ clustered configurations to force load balancing between a running server and a
+ server just brought online.
+ |
+
| Max Pool Size | +100 | +The maximum number of connections allowed in the pool. | +
| Min Pool Size | +0 | +The minimum number of connections allowed in the pool. | +
| Pooling | +true | ++ When true, the MySqlConnection object is drawn from the appropriate + pool, or if necessary, is created and added to the appropriate pool. Recognized + values are true, false, yes, and no. + | +
| Connection Reset | +false | ++ Specifies whether the database connection should be reset when being + drawn from the pool. Leaving this as false will yeild much faster + connection opens but the user should understand the side effects + of doing this such as temporary tables and user variables from the previous + session not being cleared out. + | +
| Cache Server Properties | +false | ++ Specifies whether the server variables are cached between pooled connections. + On systems where the variables change infrequently and there are lots of + connection attempts, this can speed up things dramatically. + | +
+ Public Sub CreateConnection()
+ Dim myConnection As New MySqlConnection()
+ myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass"
+ myConnection.Open()
+ End Sub 'CreateConnection
+
+
+ public void CreateConnection()
+ {
+ MySqlConnection myConnection = new MySqlConnection();
+ myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass";
+ myConnection.Open();
+ }
+
+
+ Public Sub CreateConnection()
+ Dim myConnection As New MySqlConnection()
+ myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass"
+ myConnection.Open()
+ End Sub 'CreateConnection
+
+
+ public void CreateConnection()
+ {
+ MySqlConnection myConnection = new MySqlConnection();
+ myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass";
+ myConnection.Open();
+ }
+
+
+ Public Sub RunTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Both records are written to database.")
+ Catch e As Exception
+ Try
+ myTrans.Rollback()
+ Catch ex As MySqlException
+ If Not myTrans.Connection Is Nothing Then
+ Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
+ " was encountered while attempting to roll back the transaction.")
+ End If
+ End Try
+
+ Console.WriteLine("An exception of type " + e.GetType().ToString() + _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub
+
+
+ public void RunTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
+
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
+ myTrans.Rollback();
+ }
+ catch (SqlException ex)
+ {
+ if (myTrans.Connection != null)
+ {
+ Console.WriteLine("An exception of type " + ex.GetType() +
+ " was encountered while attempting to roll back the transaction.");
+ }
+ }
+
+ Console.WriteLine("An exception of type " + e.GetType() +
+ " was encountered while inserting the data.");
+ Console.WriteLine("Neither record was written to database.");
+ }
+ finally
+ {
+ myConnection.Close();
+ }
+ }
+
+
+ Public Sub RunTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Both records are written to database.")
+ Catch e As Exception
+ Try
+ myTrans.Rollback()
+ Catch ex As MySqlException
+ If Not myTrans.Connection Is Nothing Then
+ Console.WriteLine("An exception of type " + ex.GetType().ToString() + _
+ " was encountered while attempting to roll back the transaction.")
+ End If
+ End Try
+
+ Console.WriteLine("An exception of type " + e.GetType().ToString() + _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub
+
+
+ public void RunTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
+
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
+ myTrans.Rollback();
+ }
+ catch (SqlException ex)
+ {
+ if (myTrans.Connection != null)
+ {
+ Console.WriteLine("An exception of type " + ex.GetType() +
+ " was encountered while attempting to roll back the transaction.");
+ }
+ }
+
+ Console.WriteLine("An exception of type " + e.GetType() +
+ " was encountered while inserting the data.");
+ Console.WriteLine("Neither record was written to database.");
+ }
+ finally
+ {
+ myConnection.Close();
+ }
+ }
+
+
+ Public Sub CreateMySqlConnection()
+ Dim myConnString As String = _
+ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"
+ Dim myConnection As New MySqlConnection( myConnString )
+ myConnection.Open()
+ MessageBox.Show( "Server Version: " + myConnection.ServerVersion _
+ + ControlChars.NewLine + "Database: " + myConnection.Database )
+ myConnection.ChangeDatabase( "test2" )
+ MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.NewLine + "Database: " + myConnection.Database )
+ myConnection.Close()
+ End Sub
+
+
+
+ public void CreateMySqlConnection()
+ {
+ string myConnString =
+ "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass";
+ MySqlConnection myConnection = new MySqlConnection( myConnString );
+ myConnection.Open();
+ MessageBox.Show( "Server Version: " + myConnection.ServerVersion
+ + "\nDatabase: " + myConnection.Database );
+ myConnection.ChangeDatabase( "test2" );
+ MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion
+ + "\nDatabase: " + myConnection.Database );
+ myConnection.Close();
+ }
+
+
+ Public Sub CreateMySqlConnection(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.Cr + "State: " + myConnection.State.ToString())
+ myConnection.Close()
+ End Sub
+
+
+ public void CreateMySqlConnection(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
+ "\nState: " + myConnection.State.ToString());
+ myConnection.Close();
+ }
+
+
+ Public Sub CreateMySqlConnection(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _
+ + ControlChars.Cr + "State: " + myConnection.State.ToString())
+ myConnection.Close()
+ End Sub
+
+
+ public void CreateMySqlConnection(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+ MessageBox.Show("ServerVersion: " + myConnection.ServerVersion +
+ "\nState: " + myConnection.State.ToString());
+ myConnection.Close();
+ }
+
+
+ Public Sub ReadMyData(myConnString As String)
+ Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders"
+ Dim myConnection As New MySqlConnection(myConnString)
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
+ myConnection.Open()
+ Dim myReader As MySqlDataReader
+ myReader = myCommand.ExecuteReader()
+ ' Always call Read before accessing data.
+ While myReader.Read()
+ Console.WriteLine((myReader.GetInt32(0) & ", " & myReader.GetString(1)))
+ End While
+ ' always call Close when done reading.
+ myReader.Close()
+ ' Close the connection when done with it.
+ myConnection.Close()
+ End Sub 'ReadMyData
+
+
+ public void ReadMyData(string myConnString) {
+ string mySelectQuery = "SELECT OrderID, CustomerID FROM Orders";
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
+ myConnection.Open();
+ MySqlDataReader myReader;
+ myReader = myCommand.ExecuteReader();
+ // Always call Read before accessing data.
+ while (myReader.Read()) {
+ Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
+ }
+ // always call Close when done reading.
+ myReader.Close();
+ // Close the connection when done with it.
+ myConnection.Close();
+ }
+
+
+ Public Sub ShowException()
+ Dim mySelectQuery As String = "SELECT column1 FROM table1"
+ Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;")
+ Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
+
+ Try
+ myCommand.Connection.Open()
+ Catch e As MySqlException
+ MessageBox.Show( e.Message )
+ End Try
+ End Sub
+
+
+ public void ShowException()
+ {
+ string mySelectQuery = "SELECT column1 FROM table1";
+ MySqlConnection myConnection =
+ new MySqlConnection("Data Source=localhost;Database=Sample;");
+ MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
+
+ try
+ {
+ myCommand.Connection.Open();
+ }
+ catch (MySqlException e)
+ {
+ MessageBox.Show( e.Message );
+ }
+ }
+
+
+ Public Shared Function SelectRows(myConnection As String, mySelectQuery As String, myTableName As String) As DataSet
+ Dim myConn As New MySqlConnection(myConnection)
+ Dim myDataAdapter As New MySqlDataAdapter()
+ myDataAdapter.SelectCommand = New MySqlCommand(mySelectQuery, myConn)
+ Dim cb As SqlCommandBuilder = New MySqlCommandBuilder(myDataAdapter)
+
+ myConn.Open()
+
+ Dim ds As DataSet = New DataSet
+ myDataAdapter.Fill(ds, myTableName)
+
+ ' Code to modify data in DataSet here
+
+ ' Without the MySqlCommandBuilder this line would fail.
+ myDataAdapter.Update(ds, myTableName)
+
+ myConn.Close()
+ End Function 'SelectRows
+
+
+ public static DataSet SelectRows(string myConnection, string mySelectQuery, string myTableName)
+ {
+ MySqlConnection myConn = new MySqlConnection(myConnection);
+ MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();
+ myDataAdapter.SelectCommand = new MySqlCommand(mySelectQuery, myConn);
+ MySqlCommandBuilder cb = new MySqlCommandBuilder(myDataAdapter);
+
+ myConn.Open();
+
+ DataSet ds = new DataSet();
+ myDataAdapter.Fill(ds, myTableName);
+
+ //code to modify data in DataSet here
+
+ //Without the MySqlCommandBuilder this line would fail
+ myDataAdapter.Update(ds, myTableName);
+
+ myConn.Close();
+
+ return ds;
+ }
+
+
+
+ Public Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet
+ Dim conn As New MySqlConnection(connection)
+ Dim adapter As New MySqlDataAdapter()
+ adapter.SelectCommand = new MySqlCommand(query, conn)
+ adapter.Fill(dataset)
+ Return dataset
+ End Function
+
+
+ public DataSet SelectRows(DataSet dataset,string connection,string query)
+ {
+ MySqlConnection conn = new MySqlConnection(connection);
+ MySqlDataAdapter adapter = new MySqlDataAdapter();
+ adapter.SelectCommand = new MySqlCommand(query, conn);
+ adapter.Fill(dataset);
+ return dataset;
+ }
+
+
+ Public Sub CreateSqlDataAdapter()
+ Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
+ "database=test")
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey
+
+ da.SelectCommand = New MySqlCommand("SELECT id, name FROM mytable", conn)
+ da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
+ "VALUES (@id, @name)", conn)
+ da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _
+ "WHERE id=@oldId", conn)
+ da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn)
+
+ da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id")
+ da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name")
+
+ da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id")
+ da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name")
+ da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+
+ da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ End Sub
+
+
+ public static void CreateSqlDataAdapter()
+ {
+ MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
+
+ da.SelectCommand = new MySqlCommand("SELECT id, name FROM mytable", conn);
+ da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
+ "VALUES (@id, @name)", conn);
+ da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " +
+ "WHERE id=@oldId", conn);
+ da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn);
+
+ da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id");
+ da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name");
+
+ da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id");
+ da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name");
+ da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+
+ da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ }
+
+
+ Public Sub CreateSqlDataAdapter()
+ Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
+ "database=test")
+ Dim cmd as new MySqlCommand("SELECT id, name FROM mytable", conn)
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter(cmd)
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey
+
+ da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
+ "VALUES (@id, @name)", conn)
+ da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _
+ "WHERE id=@oldId", conn)
+ da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn)
+
+ da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id")
+ da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name")
+
+ da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id")
+ da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name")
+ da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+
+ da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ End Sub
+
+
+ public static void CreateSqlDataAdapter()
+ {
+ MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
+ MySqlCommand cmd = new MySqlCommand("SELECT id, name FROM mytable", conn);
+ MySqlDataAdapter da = new MySqlDataAdapter(cmd);
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
+
+ da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
+ "VALUES (@id, @name)", conn);
+ da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " +
+ "WHERE id=@oldId", conn);
+ da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn);
+
+ da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id");
+ da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name");
+
+ da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id");
+ da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name");
+ da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+
+ da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ }
+
+
+ Public Sub CreateSqlDataAdapter()
+ Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _
+ "database=test")
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", conn)
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey
+
+ da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
+ "VALUES (@id, @name)", conn)
+ da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _
+ "WHERE id=@oldId", conn)
+ da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn)
+
+ da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id")
+ da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name")
+
+ da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id")
+ da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name")
+ da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+
+ da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ End Sub
+
+
+ public static void CreateSqlDataAdapter()
+ {
+ MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test");
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", conn);
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
+
+ da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
+ "VALUES (@id, @name)", conn);
+ da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " +
+ "WHERE id=@oldId", conn);
+ da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn);
+
+ da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id");
+ da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name");
+
+ da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id");
+ da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name");
+ da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+
+ da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ }
+
+
+ Public Sub CreateSqlDataAdapter()
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test")
+ Dim conn As MySqlConnection = da.SelectCommand.Connection
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey
+
+ da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _
+ "VALUES (@id, @name)", conn)
+ da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _
+ "WHERE id=@oldId", conn)
+ da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn)
+
+ da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id")
+ da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name")
+
+ da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id")
+ da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name")
+ da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+
+ da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original
+ End Sub
+
+
+ public static void CreateSqlDataAdapter()
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test");
+ MySqlConnection conn = da.SelectCommand.Connection;
+ da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
+
+ da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " +
+ "VALUES (@id, @name)", conn);
+ da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " +
+ "WHERE id=@oldId", conn);
+ da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn);
+
+ da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id");
+ da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name");
+
+ da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id");
+ da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name");
+ da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+
+ da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original;
+ }
+
+
+ Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
+
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter()
+ Dim cmd As MySqlCommand
+ Dim parm As MySqlParameter
+
+ ' Create the SelectCommand.
+ cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn)
+
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15)
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15)
+
+ da.SelectCommand = cmd
+
+ ' Create the DeleteCommand.
+ cmd = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn)
+
+ parm = cmd.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id")
+ parm.SourceVersion = DataRowVersion.Original
+
+ da.DeleteCommand = cmd
+
+ Return da
+ End Function
+
+
+ public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ MySqlCommand cmd;
+ MySqlParameter parm;
+
+ // Create the SelectCommand.
+ cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn);
+
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15);
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15);
+
+ da.SelectCommand = cmd;
+
+ // Create the DeleteCommand.
+ cmd = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn);
+
+ parm = cmd.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id");
+ parm.SourceVersion = DataRowVersion.Original;
+
+ da.DeleteCommand = cmd;
+
+ return da;
+ }
+
+
+ Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
+
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter()
+ Dim cmd As MySqlCommand
+ Dim parm As MySqlParameter
+
+ ' Create the SelectCommand.
+ cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn)
+
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15)
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15)
+
+ da.SelectCommand = cmd
+
+ ' Create the InsertCommand.
+ cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id, @name)", conn)
+
+ cmd.Parameters.Add( "@id", MySqlDbType.VarChar, 15, "id" )
+ cmd.Parameters.Add( "@name", MySqlDbType.VarChar, 15, "name" )
+ da.InsertCommand = cmd
+
+ Return da
+ End Function
+
+
+ public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ MySqlCommand cmd;
+ MySqlParameter parm;
+
+ // Create the SelectCommand.
+ cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn);
+
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15);
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15);
+
+ da.SelectCommand = cmd;
+
+ // Create the InsertCommand.
+ cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id,@name)", conn);
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15, "id" );
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15, "name" );
+
+ da.InsertCommand = cmd;
+
+ return da;
+ }
+
+
+ Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
+
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter()
+ Dim cmd As MySqlCommand
+ Dim parm As MySqlParameter
+
+ ' Create the SelectCommand.
+ cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn)
+
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15)
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15)
+
+ da.SelectCommand = cmd
+
+ ' Create the InsertCommand.
+ cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id, @name)", conn)
+
+ cmd.Parameters.Add( "@id", MySqlDbType.VarChar, 15, "id" )
+ cmd.Parameters.Add( "@name", MySqlDbType.VarChar, 15, "name" )
+ da.InsertCommand = cmd
+
+ Return da
+ End Function
+
+
+ public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ MySqlCommand cmd;
+ MySqlParameter parm;
+
+ // Create the SelectCommand.
+ cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn);
+
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15);
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15);
+
+ da.SelectCommand = cmd;
+
+ // Create the InsertCommand.
+ cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id,@name)", conn);
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15, "id" );
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15, "name" );
+
+ da.InsertCommand = cmd;
+
+ return da;
+ }
+
+
+ Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter
+
+ Dim da As MySqlDataAdapter = New MySqlDataAdapter()
+ Dim cmd As MySqlCommand
+ Dim parm As MySqlParameter
+
+ ' Create the SelectCommand.
+ cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn)
+
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15)
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15)
+
+ da.SelectCommand = cmd
+
+ ' Create the UpdateCommand.
+ cmd = New MySqlCommand("UPDATE mytable SET id=@id, name=@name WHERE id=@oldId", conn)
+
+ cmd.Parameters.Add( "@id", MySqlDbType.VarChar, 15, "id" )
+ cmd.Parameters.Add( "@name", MySqlDbType.VarChar, 15, "name" )
+
+ parm = cmd.Parameters.Add("@oldId", MySqlDbType.VarChar, 15, "id")
+ parm.SourceVersion = DataRowVersion.Original
+
+ da.UpdateCommand = cmd
+
+ Return da
+ End Function
+
+
+ public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn)
+ {
+ MySqlDataAdapter da = new MySqlDataAdapter();
+ MySqlCommand cmd;
+ MySqlParameter parm;
+
+ // Create the SelectCommand.
+ cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn);
+
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15);
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15);
+
+ da.SelectCommand = cmd;
+
+ // Create the UpdateCommand.
+ cmd = new MySqlCommand("UPDATE mytable SET id=@id, name=@name WHERE id=@oldId", conn);
+ cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15, "id" );
+ cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15, "name" );
+
+ parm = cmd.Parameters.Add( "@oldId", MySqlDbType.VarChar, 15, "id" );
+ parm.SourceVersion = DataRowVersion.Original;
+
+ da.UpdateCommand = cmd;
+
+ return da;
+ }
+
+
+ Public Sub AddParameters()
+ ' ...
+ ' create myDataSet and myDataAdapter
+ ' ...
+ myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"
+ myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239
+
+ myDataAdapter.Fill(myDataSet)
+ End Sub 'AddSqlParameters
+
+
+ public void AddSqlParameters()
+ {
+ // ...
+ // create myDataSet and myDataAdapter
+ // ...
+
+ myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters";
+ myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239;
+ myDataAdapter.Fill(myDataSet);
+
+ }
+
+
+ Public Sub RunTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Both records are written to database.")
+ Catch e As Exception
+ Try
+ myTrans.Rollback()
+ Catch ex As MySqlException
+ If Not myTrans.Connection Is Nothing Then
+ Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
+ " was encountered while attempting to roll back the transaction.")
+ End If
+ End Try
+
+ Console.WriteLine("An exception of type " & e.GetType().ToString() & _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub 'RunTransaction
+
+
+ public void RunTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
+
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
+ myTrans.Rollback();
+ }
+ catch (MySqlException ex)
+ {
+ if (myTrans.Connection != null)
+ {
+ Console.WriteLine("An exception of type " + ex.GetType() +
+ " was encountered while attempting to roll back the transaction.");
+ }
+ }
+
+ Console.WriteLine("An exception of type " + e.GetType() +
+ " was encountered while inserting the data.");
+ Console.WriteLine("Neither record was written to database.");
+ }
+ finally
+ {
+ myConnection.Close();
+ }
+ }
+
+
+ Public Sub RunSqlTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Success.")
+ Catch e As Exception
+ Try
+ myTrans.Rollback()
+ Catch ex As MySqlException
+ If Not myTrans.Connection Is Nothing Then
+ Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
+ " was encountered while attempting to roll back the transaction.")
+ End If
+ End Try
+
+ Console.WriteLine("An exception of type " & e.GetType().ToString() & _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub
+
+
+ public void RunSqlTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
+
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
+ myTrans.Rollback();
+ }
+ catch (MySqlException ex)
+ {
+ if (myTrans.Connection != null)
+ {
+ Console.WriteLine("An exception of type " + ex.GetType() +
+ " was encountered while attempting to roll back the transaction.");
+ }
+ }
+
+ Console.WriteLine("An exception of type " + e.GetType() +
+ " was encountered while inserting the data.");
+ Console.WriteLine("Neither record was written to database.");
+ }
+ finally
+ {
+ myConnection.Close();
+ }
+ }
+
+
+ Public Sub RunSqlTransaction(myConnString As String)
+ Dim myConnection As New MySqlConnection(myConnString)
+ myConnection.Open()
+
+ Dim myCommand As MySqlCommand = myConnection.CreateCommand()
+ Dim myTrans As MySqlTransaction
+
+ ' Start a local transaction
+ myTrans = myConnection.BeginTransaction()
+
+ ' Must assign both transaction object and connection
+ ' to Command object for a pending local transaction
+ myCommand.Connection = myConnection
+ myCommand.Transaction = myTrans
+
+ Try
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"
+ myCommand.ExecuteNonQuery()
+ myTrans.Commit()
+ Console.WriteLine("Success.")
+ Catch e As Exception
+ Try
+ myTrans.Rollback()
+ Catch ex As MySqlException
+ If Not myTrans.Connection Is Nothing Then
+ Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
+ " was encountered while attempting to roll back the transaction.")
+ End If
+ End Try
+
+ Console.WriteLine("An exception of type " & e.GetType().ToString() & _
+ "was encountered while inserting the data.")
+ Console.WriteLine("Neither record was written to database.")
+ Finally
+ myConnection.Close()
+ End Try
+ End Sub
+
+
+ public void RunSqlTransaction(string myConnString)
+ {
+ MySqlConnection myConnection = new MySqlConnection(myConnString);
+ myConnection.Open();
+
+ MySqlCommand myCommand = myConnection.CreateCommand();
+ MySqlTransaction myTrans;
+
+ // Start a local transaction
+ myTrans = myConnection.BeginTransaction();
+ // Must assign both transaction object and connection
+ // to Command object for a pending local transaction
+ myCommand.Connection = myConnection;
+ myCommand.Transaction = myTrans;
+
+ try
+ {
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')";
+ myCommand.ExecuteNonQuery();
+ myTrans.Commit();
+ Console.WriteLine("Both records are written to database.");
+ }
+ catch(Exception e)
+ {
+ try
+ {
+ myTrans.Rollback();
+ }
+ catch (MySqlException ex)
+ {
+ if (myTrans.Connection != null)
+ {
+ Console.WriteLine("An exception of type " + ex.GetType() +
+ " was encountered while attempting to roll back the transaction.");
+ }
+ }
+
+ Console.WriteLine("An exception of type " + e.GetType() +
+ " was encountered while inserting the data.");
+ Console.WriteLine("Neither record was written to database.");
+ }
+ finally
+ {
+ myConnection.Close();
+ }
+ }
+
+
+ public static AToolsType LoadSoap(Stream s)
+ {
+ try
+ {
+ AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ToolsAssembly.AssemblyResolver);
+ SoapFormatter b = new SoapFormatter();
+ b.AssemblyFormat = FormatterAssemblyStyle.Simple;
+ AToolsType t = b.Deserialize(s) as AToolsType;
+ return t;
+ }
+ finally
+ {
+ AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(ToolsAssembly.AssemblyResolver);
+ }
+ }
+
+
+
+ public static AToolsType LoadSoap(Stream s)
+ {
+ try
+ {
+ AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ToolsWindowsAssembly.AssemblyResolver);
+ SoapFormatter b = new SoapFormatter();
+ b.AssemblyFormat = FormatterAssemblyStyle.Simple;
+ AToolsType t = b.Deserialize(s) as AToolsType;
+ return t;
+ }
+ finally
+ {
+ AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(ToolsWindowsAssembly.AssemblyResolver);
+ }
+ }
+
+
+
+ public class Form1 : System.Windows.Forms.Form
+ {
+ private Syncfusion.Windows.Forms.Tools.TabControlAdv TabControlAdv1;
+ private System.Windows.Forms.Label tab2label1;
+ private System.Windows.Forms.Button tab3Button;
+ private System.Windows.Forms.MonthCalendar tab3monthCalendar1;
+ private System.Windows.Forms.DateTimePicker tab3dateTimePicker1;
+ private System.Windows.Forms.Label tab3label;
+ private System.Windows.Forms.Label tab2label2;
+ private System.Windows.Forms.TextBox tab2textBox1;
+ private System.Windows.Forms.ListBox tab1listBox1;
+ private System.Windows.Forms.ComboBox tab1comboBox1;
+
+ private System.Windows.Forms.Label tab1label1;
+ private Syncfusion.Windows.Forms.Tools.TabPageAdv tab1;
+ private Syncfusion.Windows.Forms.Tools.TabPageAdv tab3;
+ private Syncfusion.Windows.Forms.Tools.TabPageAdv tab2;
+ private System.ComponentModel.IContainer components;
+
+ public Form1()
+ {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+ }
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.tab2label1 = new System.Windows.Forms.Label();
+ this.tab1 = new Syncfusion.Tools.Windows.Forms.Tab.TabPageAdv();
+ this.tab1listBox1 = new System.Windows.Forms.ListBox();
+ this.tab1comboBox1 = new System.Windows.Forms.ComboBox();
+ this.tab1label1 = new System.Windows.Forms.Label();
+ this.tab3 = new Syncfusion.Tools.Windows.Forms.Tab.TabPageAdv();
+ this.tab3Button = new System.Windows.Forms.Button();
+ this.tab3monthCalendar1 = new System.Windows.Forms.MonthCalendar();
+ this.tab3dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
+ this.tab3label = new System.Windows.Forms.Label();
+ this.tab2 = new Syncfusion.Tools.Windows.Forms.Tab.TabPageAdv();
+ this.tab2label2 = new System.Windows.Forms.Label();
+ this.tab2textBox1 = new System.Windows.Forms.TextBox();
+ this.TabControlAdv1 = new Syncfusion.Tools.Windows.Forms.Tab.TabControlAdv();
+ this.tab1.SuspendLayout();
+ this.tab3.SuspendLayout();
+ this.tab2.SuspendLayout();
+ this.TabControlAdv1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // tab2label1
+ //
+ this.tab2label1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.tab2label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
+ this.tab2label1.Name = "tab2label1";
+ this.tab2label1.Size = new System.Drawing.Size(373, 48);
+ this.tab2label1.TabIndex = 0;
+ this.tab2label1.Text = "Tab2";
+ this.tab2label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.tab2label1.Paint += new System.Windows.Forms.PaintEventHandler(this.TabPageAdv1_Paint);
+ //
+ // tab1
+ //
+ this.tab1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.tab1.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.tab1listBox1,
+ this.tab1comboBox1,
+ this.tab1label1});
+ this.tab1.Location = new System.Drawing.Point(1, 29);
+ this.tab1.Name = "tab1";
+ this.tab1.Size = new System.Drawing.Size(373, 257);
+ this.tab1.TabIndex = 0;
+ this.tab1.Text = "Tab 1";
+ this.tab1.ToolTipText = "0asdfasdf";
+ //
+ // tab1listBox1
+ //
+ this.tab1listBox1.Items.AddRange(new object[] {
+ "Item 1",
+ "Item 2",
+ "Item 3"});
+ this.tab1listBox1.Location = new System.Drawing.Point(8, 88);
+ this.tab1listBox1.Name = "tab1listBox1";
+ this.tab1listBox1.Size = new System.Drawing.Size(192, 147);
+ this.tab1listBox1.TabIndex = 2;
+ //
+ // tab1comboBox1
+ //
+ this.tab1comboBox1.DropDownWidth = 192;
+ this.tab1comboBox1.Location = new System.Drawing.Point(8, 56);
+ this.tab1comboBox1.Name = "tab1comboBox1";
+ this.tab1comboBox1.Size = new System.Drawing.Size(192, 21);
+ this.tab1comboBox1.TabIndex = 1;
+ this.tab1comboBox1.Text = "comboBox1";
+ //
+ // tab1label1
+ //
+ this.tab1label1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.tab1label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
+ this.tab1label1.Name = "tab1label1";
+ this.tab1label1.Size = new System.Drawing.Size(371, 48);
+ this.tab1label1.TabIndex = 0;
+ this.tab1label1.Text = "Tab Page 1";
+ this.tab1label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // tab3
+ //
+ this.tab3.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.tab3Button,
+ this.tab3monthCalendar1,
+ this.tab3dateTimePicker1,
+ this.tab3label});
+ this.tab3.Location = new System.Drawing.Point(1, 29);
+ this.tab3.Name = "tab3";
+ this.tab3.Size = new System.Drawing.Size(373, 257);
+ this.tab3.TabIndex = 1;
+ this.tab3.Text = "Tab 3";
+ this.tab3.ToolTipText = "2asdfasdf";
+ this.tab3.Layout += new System.Windows.Forms.LayoutEventHandler(this.TabPageAdv2_Layout);
+ //
+ // tab3Button
+ //
+ this.tab3Button.Location = new System.Drawing.Point(264, 72);
+ this.tab3Button.Name = "tab3Button";
+ this.tab3Button.Size = new System.Drawing.Size(72, 24);
+ this.tab3Button.TabIndex = 3;
+ this.tab3Button.Text = "button1";
+ this.tab3Button.Click += new System.EventHandler(this.button1_Click);
+ //
+ // tab3monthCalendar1
+ //
+ this.tab3monthCalendar1.Location = new System.Drawing.Point(16, 96);
+ this.tab3monthCalendar1.Name = "tab3monthCalendar1";
+ this.tab3monthCalendar1.TabIndex = 2;
+ //
+ // tab3dateTimePicker1
+ //
+ this.tab3dateTimePicker1.Location = new System.Drawing.Point(8, 64);
+ this.tab3dateTimePicker1.Name = "tab3dateTimePicker1";
+ this.tab3dateTimePicker1.TabIndex = 1;
+ //
+ // tab3label
+ //
+ this.tab3label.Dock = System.Windows.Forms.DockStyle.Top;
+ this.tab3label.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
+ this.tab3label.Name = "tab3label";
+ this.tab3label.Size = new System.Drawing.Size(373, 48);
+ this.tab3label.TabIndex = 0;
+ this.tab3label.Text = "Tab3";
+ this.tab3label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // tab2
+ //
+ this.tab2.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.tab2label2,
+ this.tab2textBox1,
+ this.tab2label1});
+ this.tab2.Location = new System.Drawing.Point(1, 29);
+ this.tab2.Name = "tab2";
+ this.tab2.Size = new System.Drawing.Size(373, 257);
+ this.tab2.TabIndex = 2;
+ this.tab2.Text = "Tab2";
+ this.tab2.ToolTipText = "1asdfasdfasd";
+ //
+ // tab2label2
+ //
+ this.tab2label2.Location = new System.Drawing.Point(8, 96);
+ this.tab2label2.Name = "tab2label2";
+ this.tab2label2.Size = new System.Drawing.Size(112, 16);
+ this.tab2label2.TabIndex = 2;
+ this.tab2label2.Text = "Text Entry:";
+ //
+ // tab2textBox1
+ //
+ this.tab2textBox1.Location = new System.Drawing.Point(8, 120);
+ this.tab2textBox1.Multiline = true;
+ this.tab2textBox1.Name = "tab2textBox1";
+ this.tab2textBox1.Size = new System.Drawing.Size(368, 80);
+ this.tab2textBox1.TabIndex = 1;
+ this.tab2textBox1.Text = "textBox1";
+ //
+ // TabControlAdv1
+ //
+ this.TabControlAdv1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right);
+ this.TabControlAdv1.BackColor = System.Drawing.SystemColors.ActiveBorder;
+ this.TabControlAdv1.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.tab3,
+ this.tab2,
+ this.tab1});
+ this.TabControlAdv1.Cursor = System.Windows.Forms.Cursors.Default;
+ this.TabControlAdv1.HotTrack = true;
+ this.TabControlAdv1.ImageList = this.imageList1;
+ this.TabControlAdv1.ItemSize = new System.Drawing.Size(80, 30);
+ this.TabControlAdv1.Location = new System.Drawing.Point(40, 16);
+ this.TabControlAdv1.Name = "TabControlAdv1";
+ this.TabControlAdv1.ShowToolTips = true;
+ this.TabControlAdv1.Size = new System.Drawing.Size(376, 288);
+ this.TabControlAdv1.TabGap = 20;
+ this.TabControlAdv1.TabIndex = 4;
+ this.TabControlAdv1.TabStyle = typeof(Syncfusion.Tools.Windows.Forms.Tab.TabRenderer2D);
+ this.TabControlAdv1.TextAlignment = System.Drawing.StringAlignment.Near;
+ this.TabControlAdv1.UserMoveTabs = true;
+ this.TabControlAdv1.VSLikeScrollButton = true;
+ //
+ // Form1
+ //
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(688, 309);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.TabControlAdv1});
+ this.Name = "Form1";
+ this.Text = "Form1";
+ this.tab1.ResumeLayout(false);
+ this.tab3.ResumeLayout(false);
+ this.tab2.ResumeLayout(false);
+ this.TabControlAdv1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+ }
+
+
+ Private Function Form1() As Public
+ '
+ ' Required for Windows Form Designer support
+ '
+ InitializeComponent()
+ End Function
+
+ Private Sub InitializeComponent()
+ Me.components = New System.ComponentModel.Container()
+ Me.tab2label1 = New System.Windows.Forms.Label()
+ Me.tab1 = New Syncfusion.Tools.Windows.Forms.Tab.TabPageAdv()
+ Me.tab1listBox1 = New System.Windows.Forms.ListBox()
+ Me.tab1comboBox1 = New System.Windows.Forms.ComboBox()
+ Me.tab1label1 = New System.Windows.Forms.Label()
+ Me.tab3 = New Syncfusion.Tools.Windows.Forms.Tab.TabPageAdv()
+ Me.tab3Button = New System.Windows.Forms.Button()
+ Me.tab3monthCalendar1 = New System.Windows.Forms.MonthCalendar()
+ Me.tab3dateTimePicker1 = New System.Windows.Forms.DateTimePicker()
+ Me.tab3label = New System.Windows.Forms.Label()
+ Me.tab2 = New Syncfusion.Tools.Windows.Forms.Tab.TabPageAdv()
+ Me.tab2label2 = New System.Windows.Forms.Label()
+ Me.tab2textBox1 = New System.Windows.Forms.TextBox()
+ Me.TabControlAdv1 = New Syncfusion.Tools.Windows.Forms.Tab.TabControlAdv()
+ Me.tab1.SuspendLayout()
+ Me.tab3.SuspendLayout()
+ Me.tab2.SuspendLayout()
+ Me.TabControlAdv1.SuspendLayout()
+ Me.SuspendLayout()
+
+ '
+ ' tab2label1
+ '
+ Me.tab2label1.Dock = System.Windows.Forms.DockStyle.Top
+ Me.tab2label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (CType((0), System.Byte)))
+ Me.tab2label1.Name = "tab2label1"
+ Me.tab2label1.Size = New System.Drawing.Size(373, 48)
+ Me.tab2label1.TabIndex = 0
+ Me.tab2label1.Text = "Tab2"
+ Me.tab2label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
+ Me.tab2label1.Paint += New System.Windows.Forms.PaintEventHandler(Me.TabPageAdv1_Paint)
+
+ '
+ ' tab1
+ '
+ Me.tab1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
+ Me.tab1.Controls.AddRange(New System.Windows.Forms.Control()
+ {Me.tab1listBox1,Me.tab1comboBox1,Me.tab1label1})
+ Me.tab1.Location = New System.Drawing.Point(1, 29)
+ Me.tab1.Name = "tab1"
+ Me.tab1.Size = New System.Drawing.Size(373, 257)
+ Me.tab1.TabIndex = 0
+ Me.tab1.Text = "Tab 1"
+ Me.tab1.ToolTipText = "0asdfasdf"
+ '
+ ' tab1listBox1
+ '
+ Me.tab1listBox1.Items.AddRange(New System.Windows.Forms.Control()
+ {Me.tab1listBox1,Me.tab1comboBox1,Me.tab1label1})
+ Dim Object() As Me.tab1listBox1.Items.AddRange(New string()
+ {
+ "Item 1",
+ "Item 2",
+ "Item 3"
+ })
+ Me.tab1listBox1.Location = New System.Drawing.Point(8, 88)
+ Me.tab1listBox1.Name = "tab1listBox1"
+ Me.tab1listBox1.Size = New System.Drawing.Size(192, 147)
+ Me.tab1listBox1.TabIndex = 2
+ '
+ ' tab1comboBox1
+ '
+ Me.tab1comboBox1.DropDownWidth = 192
+ Me.tab1comboBox1.Location = New System.Drawing.Point(8, 56)
+ Me.tab1comboBox1.Name = "tab1comboBox1"
+ Me.tab1comboBox1.Size = New System.Drawing.Size(192, 21)
+ Me.tab1comboBox1.TabIndex = 1
+ Me.tab1comboBox1.Text = "comboBox1"
+ '
+ ' tab1label1
+ '
+ Me.tab1label1.Dock = System.Windows.Forms.DockStyle.Top
+ Me.tab1label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (CType((0), System.Byte)))
+ Me.tab1label1.Name = "tab1label1"
+ Me.tab1label1.Size = New System.Drawing.Size(371, 48)
+ Me.tab1label1.TabIndex = 0
+ Me.tab1label1.Text = "Tab Page 1"
+ Me.tab1label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
+
+ Me.tab3.Controls.AddRange(New System.Windows.Forms.Control()
+ {Me.tab3Button,Me.tab3monthCalendar1,Me.tab3dateTimePicker1,Me.tab3label})
+ Me.tab3.Location = New System.Drawing.Point(1, 29)
+ Me.tab3.Name = "tab3"
+ Me.tab3.Size = New System.Drawing.Size(373, 257)
+ Me.tab3.TabIndex = 1
+ Me.tab3.Text = "Tab 3"
+ Me.tab3.ToolTipText = "2asdfasdf"
+ Me.tab3.Lay+= New System.Windows.Forms.LayoutEventHandler(Me.TabPageAdv2_Layout)
+ '
+ ' tab3Button
+ '
+ Me.tab3Button.Location = New System.Drawing.Point(264, 72)
+ Me.tab3Button.Name = "tab3Button"
+ Me.tab3Button.Size = New System.Drawing.Size(72, 24)
+ Me.tab3Button.TabIndex = 3
+ Me.tab3Button.Text = "button1"
+ Me.tab3Button.Click += New System.EventHandler(Me.button1_Click)
+ '
+ ' tab3monthCalendar1
+ '
+ Me.tab3monthCalendar1.Location = New System.Drawing.Point(16, 96)
+ Me.tab3monthCalendar1.Name = "tab3monthCalendar1"
+ Me.tab3monthCalendar1.TabIndex = 2
+ '
+ ' tab3dateTimePicker1
+ '
+ Me.tab3dateTimePicker1.Location = New System.Drawing.Point(8, 64)
+ Me.tab3dateTimePicker1.Name = "tab3dateTimePicker1"
+ Me.tab3dateTimePicker1.TabIndex = 1
+ '
+ ' tab3label
+ '
+ Me.tab3label.Dock = System.Windows.Forms.DockStyle.Top
+ Me.tab3label.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, (CType((0), System.Byte)))
+ Me.tab3label.Name = "tab3label"
+ Me.tab3label.Size = New System.Drawing.Size(373, 48)
+ Me.tab3label.TabIndex = 0
+ Me.tab3label.Text = "Tab3"
+ Me.tab3label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
+ '
+ ' tab2
+ '
+ Me.tab2.Controls.AddRange(New System.Windows.Forms.Control()
+ {Me.tab2label2,Me.tab2textBox1,Me.tab2label1})
+ Me.tab2.Location = New System.Drawing.Point(1, 29)
+ Me.tab2.Name = "tab2"
+ Me.tab2.Size = New System.Drawing.Size(373, 257)
+ Me.tab2.TabIndex = 2
+ Me.tab2.Text = "Tab2"
+ Me.tab2.ToolTipText = "1asdfasdfasd"
+ '
+ ' tab2label2
+ '
+ Me.tab2label2.Location = New System.Drawing.Point(8, 96)
+ Me.tab2label2.Name = "tab2label2"
+ Me.tab2label2.Size = New System.Drawing.Size(112, 16)
+ Me.tab2label2.TabIndex = 2
+ Me.tab2label2.Text = "Text Entry:"
+ '
+ ' tab2textBox1
+ '
+ Me.tab2textBox1.Location = New System.Drawing.Point(8, 120)
+ Me.tab2textBox1.Multiline = True
+ Me.tab2textBox1.Name = "tab2textBox1"
+ Me.tab2textBox1.Size = New System.Drawing.Size(368, 80)
+ Me.tab2textBox1.TabIndex = 1
+ Me.tab2textBox1.Text = "textBox1"
+ '
+ ' TabControlAdv1
+ '
+ Me.TabControlAdv1.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
+ Or System.Windows.Forms.AnchorStyles.Left) _
+ Or System.Windows.Forms.AnchorStyles.Right)
+ Me.TabControlAdv1.Cursor = System.Windows.Forms.Cursors.Default
+ Me.TabControlAdv1.HotTrack = True
+ Me.TabControlAdv1.ImageList = Me.imageList1
+ Me.TabControlAdv1.ItemSize = New System.Drawing.Size(80, 30)
+ Me.TabControlAdv1.Location = New System.Drawing.Point(40, 16)
+ Me.TabControlAdv1.Name = "TabControlAdv1"
+ Me.TabControlAdv1.ShowToolTips = True
+ Me.TabControlAdv1.Size = New System.Drawing.Size(376, 288)
+ Me.TabControlAdv1.TabGap = 20
+ Me.TabControlAdv1.TabIndex = 4
+ Me.TabControlAdv1.TabStyle = Type.GetType(Syncfusion.Tools.Windows.Forms.Tab.TabRenderer2D)
+ Me.TabControlAdv1.TextAlignment = System.Drawing.StringAlignment.Near
+ Me.TabControlAdv1.UserMoveTabs = True
+ Me.TabControlAdv1.VSLikeScrollButton = True
+ '
+ ' Form1
+ '
+ Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
+ Me.ClientSize = New System.Drawing.Size(688, 309)
+ Me.Controls.AddRange(New System.Windows.Forms.Control()
+ {Me.TabControlAdv1})
+ Me.Name = "Form1"
+ Me.Text = "Form1"
+ Me.tab1.ResumeLayout(False)
+ Me.tab3.ResumeLayout(False)
+ Me.tab2.ResumeLayout(False)
+ Me.TabControlAdv1.ResumeLayout(False)
+ Me.ResumeLayout(False)
+ End Sub
+
+
+ //Loading TabState from xml file(TabState.xml located in Application folder)
+ AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, "TabState");
+ this.tabControlAdv1.LoadState(serializer);
+
+
+ 'Loading TabState from xml file(TabState.xml located in Application folder)
+ Dim serializer As New AppStateSerializer(SerializeMode.XMLFile, "TabState")
+ Me.tabControlAdv1.LoadState(serializer)
+
+
+ //Saving TabState to xml file(TabState.xml located in Application folder)
+ AppStateSerializer serializer =new AppStateSerializer(SerializeMode.XMLFile, "TabState");
+ this.tabControlAdv1.SaveState(serializer);
+ serializer.PersistNow();
+
+
+ 'Saving TabState to xml file(TabState.xml located in Application folder)
+ Dim serializer As New AppStateSerializer(SerializeMode.XMLFile, "TabState")
+ Me.tabControlAdv1.SaveState(serializer)
+ serializer.PersistNow()
+
+
+ public Form1()
+ {
+ this.tabPage1 = new TabPageAdv();
+ // Invokes the TabControlAdv() constructor to create the tabControl1 object.
+ this.tabControl1 = new TabControlAdv();
+
+ this.tabControl1.Controls.Add(tabPage1);
+ this.Controls.Add(tabControl1);
+ }
+
+
+ Public Sub New()
+ Me.tabPage1 = New TabPageAdv()
+ ' Invokes the TabControlAdv() constructor to create the tabControl1 object.
+ Me.tabControl1 = New TabControlAdv()
+ Me.tabControl1.Controls.Add(tabPage1)
+ Me.Controls.Add(tabControl1)
+ End Sub 'New
+
+
+ // Make sure to set the "3D" tab style, turn on the HotTrack property and handle
+ // the DrawItem event of the tab control.
+ private void InitializeComponent()
+ {
+ ....
+ this.TabControlAdv1.HotTrack = true;
+ this.TabControlAdv1.TabStyle = typeof(Syncfusion.Windows.Forms.Tools.TabRenderer3D);
+ this.TabControlAdv1.DrawItem += new Syncfusion.Windows.Forms.Tools.DrawTabEventHandler(this.Tab_DrawItemYahooMessengerLike);
+ ....
+ }
+ private void Tab_DrawItemYahooMessengerLike(object sender, DrawTabEventArgs drawItemInfo)
+ {
+ // Draw the default background and interior in all cases.
+ drawItemInfo.DrawBackground();
+ drawItemInfo.DrawInterior();
+
+ // The border should be drawn only when the item is selected or highlighted.
+ if(((int)drawItemInfo.State & ((int)DrawItemState.Selected | (int)DrawItemState.HotLight)) > 0)
+ {
+ // Draw the borders
+ drawItemInfo.DrawBorders();
+ }
+ }
+
+
+ ' Make sure to set the "3D" tab style, turn on the HotTrack property and handle
+ ' the DrawItem event of the tab control.
+ Private Sub InitializeComponent()
+ Me.TabControlAdv1.HotTrack = True
+ Me.TabControlAdv1.TabStyle = GetType(Syncfusion.Windows.Forms.Tools.TabRenderer3D)
+ Me.TabControlAdv1.DrawItem += New Syncfusion.Windows.Forms.Tools.DrawTabEventHandler(Me.Tab_DrawItemYahooMessengerLike)
+ End Sub 'InitializeComponent
+
+ Private Sub Tab_DrawItemYahooMessengerLike(sender As Object, drawItemInfo As DrawTabEventArgs)
+ ' Draw the default background and interior in all cases.
+ drawItemInfo.DrawBackground()
+ drawItemInfo.DrawInterior()
+
+ ' The border should be drawn only when the item is selected or highlighted.
+ If(CInt(drawItemInfo.State) And(CInt(DrawItemState.Selected) Or CInt(DrawItemState.HotLight))) > 0 Then
+ ' Draw the borders
+ drawItemInfo.DrawBorders()
+ End If
+ End Sub 'Tab_DrawItemYahooMessengerLike
+
+
+ private void InitMyTabs()
+ {
+ this.tabControl1 = new TabControlAdv();
+ this.tabPage1 = new TabPageAdv();
+ this.tabPage2 = new TabPageAdv();
+ this.tabPage3 = new TabPageAdv();
+
+ // Positions tabs on the left side of tabControl1.
+ // this.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Left;
+
+ // Sets the tabs to appear in 2D mode.
+ tabControl1.TabStyle = typeof(TabRenderer2D);
+
+ // Highlights TabPage.Text when the mouse passes over tabs.
+ this.tabControl1.HotTrack = true;
+
+ // Set the relative alignment between the images and text in a tab
+ this.tabControl1.ImageAlignmentR = RelativeImageAlignment.BelowText;
+
+ // Allows more than one row of tabs.
+ // this.tabControl1.Multiline = true;
+
+ // Creates a cushion of 22 pixels around TabPage.Text strings.
+ this.tabControl1.Padding = new System.Drawing.Point(22, 22);
+
+ // Makes the tab width definable.
+ this.tabControl1.SizeMode = Syncfusion.Windows.Forms.Tools.TabSizeMode.Fixed;
+
+ // Sizes the tabs of tabControl1.
+ this.tabControl1.ItemSize = new Size(90, 64); // Make sure to take into account the padding values.
+
+ // To rotate text when aligned vertically.
+ this.tabControl1.RotateTextWhenVertical = true;
+
+ // Allows the user to move the tabs by simply dragging and dropping
+ this.tabControl1.UserMoveTabs = true;
+
+ // Draws the scroll buttons Visual Studio MDI Tabs like.
+ this.tabControl1.VSLikeScrollButton = true;
+
+ this.tabControl1.Controls.AddRange(new Control[] {
+ this.tabPage1,
+ this.tabPage2,
+ this.tabPage3});
+ this.tabControl1.Location = new Point(16, 24);
+ this.tabControl1.SelectedIndex = 0;
+ this.tabControl1.Size = new Size(248, 232);
+
+ this.tabPage1.Text = "Tab1";
+ this.tabPage2.Text = "Tab2";
+ this.tabPage3.Text = "Tab3";
+
+ this.Size = new Size(300,300);
+ this.Controls.AddRange(new Control[] {
+ this.tabControl1});
+
+ // Selects tabPage1 using SelectedIndex.
+ this.tabControl1.SelectedIndex = 1;
+
+ // Shows ToolTipText when the mouse passes over tabs.
+ this.tabControl1.ShowToolTips = true;
+ }
+ Private Sub InitMyTabs()
+
+ Me.tabControl1 = New TabControlAdv()
+ Me.tabPage1 = New TabPageAdv()
+ Me.tabPage2 = New TabPageAdv()
+ Me.tabPage3 = New TabPageAdv()
+ ' Positions tabs on the left side of tabControl1.
+ ' this.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Left;
+ ' Sets the tabs to appear in 2D mode.
+ tabControl1.TabStyle = GetType(TabRenderer2D)
+ ' Highlights TabPage.Text when the mouse passes over tabs.
+ Me.tabControl1.HotTrack = True
+ ' Set the relative alignment between the images and text in a tab
+ Me.tabControl1.ImageAlignmentR = RelativeImageAlignment.BelowText
+ ' Allows more than one row of tabs.
+ ' this.tabControl1.Multiline = true;
+ ' Creates a cushion of 22 pixels around TabPage.Text strings.
+ Me.tabControl1.Padding = New System.Drawing.Point(22, 22)
+ ' Makes the tab width definable.
+ Me.tabControl1.SizeMode = Syncfusion.Windows.Forms.Tools.TabSizeMode.Fixed
+ ' Sizes the tabs of tabControl1.
+ Me.tabControl1.ItemSize = New Size(90, 64)
+ ' Make sure to take into account the padding values.
+ ' To rotate text when aligned vertically.
+ Me.tabControl1.RotateTextWhenVertical = True
+ ' Allows the user to move the tabs by simply dragging and dropping
+ Me.tabControl1.UserMoveTabs = True
+ ' Draws the scroll buttons Visual Studio MDI Tabs like.
+ Me.tabControl1.VSLikeScrollButton = True
+ Me.tabControl1.Controls.AddRange(New Control() {Me.tabPage1, Me.tabPage2, Me.tabPage3})
+ Me.tabControl1.Location = New Point(16, 24)
+ Me.tabControl1.SelectedIndex = 0
+ Me.tabControl1.Size = New Size(248, 232)
+ Me.tabPage1.Text = "Tab1"
+ Me.tabPage2.Text = "Tab2"
+ Me.tabPage3.Text = "Tab3"
+ Me.Size = New Size(300, 300)
+ Me.Controls.AddRange(New Control() {Me.tabControl1})
+ ' Selects tabPage1 using SelectedIndex.
+ Me.tabControl1.SelectedIndex = 1
+ ' Shows ToolTipText when the mouse passes over tabs.
+ Me.tabControl1.ShowToolTips = True
+
+ End Sub
+ public Form1()
+ {
+ this.tabControl1 = new TabControlAdv();
+
+ // Invokes the TabPage() constructor to create the tabPage1 object.
+ this.tabPage1 = new Syncfusion.Windows.Forms.Tools.TabPageAdv();
+ this.tabControl1.Controls.AddRange(new Control[] {
+ this.tabPage1});
+ this.tabControl1.Location = new Point(25, 25);
+ this.tabControl1.Size = new Size(250, 250);
+ this.ClientSize = new Size(300, 300);
+ this.Controls.AddRange(new Control[] {
+ this.tabControl1});
+ }
+
+
+ Public Sub New()
+ Me.tabControl1 = New TabControlAdv()
+ ' Invokes the TabPage() constructor to create the tabPage1 object.
+ Me.tabPage1 = New Syncfusion.Windows.Forms.Tools.TabPageAdv()
+ Me.tabControl1.Controls.AddRange(New Control() {Me.tabPage1})
+ Me.tabControl1.Location = New Point(25, 25)
+ Me.tabControl1.Size = New Size(250, 250)
+ Me.ClientSize = New Size(300, 300)
+ Me.Controls.AddRange(New Control() {Me.tabControl1})
+ End Sub 'New
+
+
+ public void MyTabs()
+ {
+ this.tabControl1 = new TabControlAdv();
+ // Invokes the TabPageAdv() constructor to create the tabPage1 object.
+ this.tabPage1 = new Syncfusion.Windows.Forms.ToolsTabPageAdv();
+ this.tabControl1.Controls.Add(tabPage1);
+ this.Controls.Add(tabControl1);
+ }
+
+ public Form1()
+ {
+ MyTabs();
+ }
+
+
+ public void MyTabs()
+ {
+ this.tabControl1 = new TabControlAdv();
+ string tabPageName = "myTabPage";
+
+ // Invokes the TabPageAdv() constructor to create the tabPage1 object.
+ this.tabPage1 = new Syncfusion.Windows.Forms.Tools.TabPageAdv(tabPageName);
+
+ this.tabControl1.Controls.Add(tabPage1);
+ this.Controls.Add(tabControl1);
+ }
+
+ public Form1()
+ {
+ MyTabs();
+ }
+
+
+ // InitializeComponent sample
+ this.buttonEdit1 = new Syncfusion.Windows.Forms.Tools.ButtonEdit();
+ this.buttonEditChildButton1 = new Syncfusion.Windows.Forms.Tools.ButtonEditChildButton();
+ this.buttonEdit1.SuspendLayout();
+ this.SuspendLayout();
+ this.buttonEdit1.Buttons.Add(this.buttonEditChildButton1);
+ this.buttonEdit1.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.buttonEditChildButton1});
+ this.buttonEdit1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.buttonEdit1.Location = new System.Drawing.Point(8, 16);
+ this.buttonEdit1.Name = "buttonEdit1";
+ this.buttonEdit1.SelectionLength = 0;
+ this.buttonEdit1.SelectionStart = 0;
+ this.buttonEdit1.ShowTextBox = true;
+ this.buttonEdit1.Size = new System.Drawing.Size(368, 22);
+ this.buttonEdit1.TabIndex = 0;
+ this.buttonEdit1.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
+ //
+ // buttonEditChildButton1
+ //
+ this.buttonEditChildButton1.ButtonAlign = Syncfusion.Windows.Forms.Tools.ButtonAlignment.Right;
+ this.buttonEditChildButton1.ButtonEditParent = this.buttonEdit1;
+ this.buttonEditChildButton1.ButtonType = Syncfusion.Windows.Forms.Tools.ButtonTypes.Browse;
+ this.buttonEditChildButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.buttonEditChildButton1.Location = new System.Drawing.Point(352, 0);
+ this.buttonEditChildButton1.Name = "buttonEditChildButton1";
+ this.buttonEditChildButton1.PreferredWidth = 16;
+ this.buttonEditChildButton1.Size = new System.Drawing.Size(16, 22);
+ this.buttonEditChildButton1.TabIndex = 1;
+ this.buttonEditChildButton1.Click += new System.EventHandler(this.buttonEditChildButton1_Click);
+ this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+ this.ClientSize = new System.Drawing.Size(400, 273);
+ this.Controls.AddRange(new System.Windows.Forms.Control[] { this.buttonEdit1});
+ this.Text = "Syncfusion ButtonEdit Demo";
+ this.buttonEdit1.ResumeLayout(false);
+ this.ResumeLayout(false);
+ ' InitializeComponent sample
+ Me.buttonEdit1 = New Syncfusion.Windows.Forms.Tools.ButtonEdit()
+ Me.buttonEditChildButton1 = New Syncfusion.Windows.Forms.Tools.ButtonEditChildButton()
+ Me.buttonEdit1.SuspendLayout()
+ Me.SuspendLayout()
+ Me.buttonEdit1.Buttons.Add(Me.buttonEditChildButton1)
+ Me.buttonEdit1.Controls.AddRange(New System.Windows.Forms.Control() {Me.buttonEditChildButton1})
+ Me.buttonEdit1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
+ Me.buttonEdit1.Location = New System.Drawing.Point(8, 16)
+ Me.buttonEdit1.Name = "buttonEdit1"
+ Me.buttonEdit1.SelectionLength = 0
+ Me.buttonEdit1.SelectionStart = 0
+ Me.buttonEdit1.ShowTextBox = True
+ Me.buttonEdit1.Size = New System.Drawing.Size(368, 22)
+ Me.buttonEdit1.TabIndex = 0
+ Me.buttonEdit1.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
+ '
+ ' buttonEditChildButton1
+ '
+ Me.buttonEditChildButton1.ButtonAlign = Syncfusion.Windows.Forms.Tools.ButtonAlignment.Right
+ Me.buttonEditChildButton1.ButtonEditParent = Me.buttonEdit1
+ Me.buttonEditChildButton1.ButtonType = Syncfusion.Windows.Forms.Tools.ButtonTypes.Browse
+ Me.buttonEditChildButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
+ Me.buttonEditChildButton1.Location = New System.Drawing.Point(352, 0)
+ Me.buttonEditChildButton1.Name = "buttonEditChildButton1"
+ Me.buttonEditChildButton1.PreferredWidth = 16
+ Me.buttonEditChildButton1.Size = New System.Drawing.Size(16, 22)
+ Me.buttonEditChildButton1.TabIndex = 1
+ AddHandler Me.buttonEditChildButton1.Click, New System.EventHandler(AddressOf buttonEditChildButton1_Click)
+ Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
+ Me.ClientSize = New System.Drawing.Size(400, 273)
+ Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.buttonEdit1})
+ Me.Text = "Syncfusion ButtonEdit Demo"
+ Me.buttonEdit1.ResumeLayout(False)
+ Me.ResumeLayout(False)
+ BeginBlock();
+ // add action1
+ // .....
+ BeginBlock();
+ //......
+ EndBlock();
+ // add actionN
+ CloseBlock();
+
+
+ // Create and initialize a ParentBarItem
+ this.editBarItem = new Syncfusion.Windows.Forms.Tools.ParentBarItem();
+ this.editMenu.Text = "Edit";
+ this.editMenu.Items.AddRange(new BarItem[]
+ { this.cutItem,
+ this.copyItem,});
+ // Associate the ParentBarItem with the PopupMenu
+ this.popupMenu1 = new Syncfusion.Windows.Forms.Tools.PopupMenu();
+ this.popupMenu1.ParentBarItem = this. editBarItem;
+
+ // Then associate it with a RichTextBox
+ this.popupMenusManager = new PopupMenusManager();
+ this.popupMenusManager.SetXPContextMenu(this.richTextBox1, this.popupMenu1);
+
+
+ ' Create and initialize a ParentBarItem
+ Me.editBarItem = New Syncfusion.Windows.Forms.Tools.ParentBarItem()
+ Me.editMenu.Text = "Edit"
+ Me.editMenu.Items.AddRange(New BarItem() {Me.cutItem, Me.copyItem})
+
+ ' Associate the ParentBarItem with the PopupMenu
+ Me.popupMenu1 = New Syncfusion.Windows.Forms.Tools.PopupMenu()
+ Me.popupMenu1.ParentBarItem = Me.editBarItem
+
+ ' Then associate it with a RichTextBox
+ Me.popupMenusManager = New PopupMenusManager()
+ Me.popupMenusManager.SetXPContextMenu(Me.richTextBox1, Me.popupMenu1)
+
+
+ public void InitMyFileMenu()
+ {
+ // Set the MergeType to Add so that the bar item is added to the
+ // merged menu/bar.
+ barItem1.MergeType = MenuMerge.Add;
+ // Set the MergeOrder to 1 so that this bar item is placed lower
+ // in the merged menu/bar order.
+ barItem1.MergeOrder = 1;
+ }
+
+
+ public void Popup(Object sender, EventArgs e)
+ {
+ // Determine if there is text selected in textBox1.
+ if(textBox1.SelectedText == "")
+ {
+ // Disable the menus since no text is selected in textBox1.
+ menuItemCut.Enabled = false;
+ menuItemCopy.Enabled = false;
+ menuItemDelete.Enabled = false;
+ }
+ else
+ {
+ // Text is selected in textBox1, so enable menu items.
+ menuItemCut.Enabled = true;
+ menuItemCopy.Enabled = true;
+ menuItemDelete.Enabled = true;
+ }
+ }
+
+
+ // The following event handler would be connected to three menu items.
+ private void MyMenuClick(Object sender, EventArgs e)
+ {
+ // Determine if clicked menu item is the Blue bar item.
+ if(sender == menuItemBlue)
+ {
+ // Set the checkmark for the menuItemBlue bar item.
+ menuItemBlue.Checked = true;
+ // Uncheck the menuItemRed and menuItemGreen bar items.
+ menuItemRed.Checked = false;
+ menuItemGreen.Checked = false;
+ // Set the color of the text in the TextBox control to Blue.
+ textBox1.ForeColor = Color.Blue;
+ }
+ else if(sender == menuItemRed)
+ {
+ // Set the checkmark for the menuItemRed bar item.
+ menuItemRed.Checked = true;
+ // Uncheck the menuItemBlue and menuItemGreen bar items.
+ menuItemBlue.Checked = false;
+ menuItemGreen.Checked = false;
+ // Set the color of the text in the TextBox control to Red.
+ textBox1.ForeColor = Color.Red;
+ }
+ else
+ {
+ // Set the checkmark for the menuItemGreen.
+ menuItemGreen.Checked = true;
+ // Uncheck the menuItemRed and menuItemBlue bar items.
+ menuItemBlue.Checked = false;
+ menuItemRed.Checked = false;
+ // Set the color of the text in the TextBox control to Blue.
+ textBox1.ForeColor = Color.Green;
+ }
+ }
+
+
+ public void SetupMyMenuItem()
+ {
+ // Set the caption for the bar item.
+ barItem1.Text = "New";
+ // Assign a shortcut key.
+ barItem1.Shortcut = Shortcut.CtrlN;
+ // Make the bar item visible.
+ barItem1.Visible = true;
+ }
+
+
+ public void SetupMyMenuItem()
+ {
+ // Set the caption for the bar item.
+ barItem1.Text = "New";
+ // Assign a shortcut key.
+ barItem1.Shortcut = Shortcut.CtrlN;
+ // Make the bar item visible.
+ barItem1.Visible = true;
+ }
+
+
+ Public Sub SetupMyMenuItem()
+ ' Set the caption for the bar item.
+ barItem1.Text = "New"
+ ' Assign a shortcut key.
+ barItem1.Shortcut = Shortcut.CtrlN
+ ' Make the bar item visible.
+ barItem1.Visible = True
+ End Sub 'SetupMyMenuItem
+
+
+ public void SetupMyMenuItem()
+ {
+ // Set the caption for the menu item.
+ menuItem1.Text = "New";
+ // Assign a shortcut key.
+ menuItem1.Shortcut = Shortcut.CtrlN;
+ // Make the menu item visible.
+ menuItem1.Visible = true;
+ }
+
+
+ Public Sub SetupMyMenuItem()
+ ' Set the caption for the menu item.
+ menuItem1.Text = "New"
+ ' Assign a shortcut key.
+ menuItem1.Shortcut = Shortcut.CtrlN
+ ' Make the menu item visible.
+ menuItem1.Visible = True
+ End Sub 'SetupMyMenuItem
+
+ To reset this property programmatically, specify null. In design time select "Reset" + from the context menu of the property grid entry of this property.
+This property is useful when you want to replace the default + shortcut text (for example, "Ctrl+D0", displayed when Shortcut.Ctrl0 is the shortcut), + with something else (say "Ctrl0", in the above example). +
+
+ // This code shows how the AutoComplete control
+ // is initialized and used
+ this.autoComplete1 = new AutoComplete();
+ this.textBox1 = new TextBox();
+ // Set buttonEdit1 properties
+ this.autoComplete1.AdjustHeightToItemCount = true;
+ // The AutoComplete control will add contents of the target control to
+ // its history list automatically (when the enter key is hit)
+ this.autoComplete1.AutoAddItem = true;
+ // The AutoComplete control will maintain its history items
+ this.autoComplete1.AutoSerialize = true;
+ // The category under which the history list will be persisted
+ this.autoComplete1.CategoryName = "websites";
+ // Specifies if any of the columns in the data source are to be treated as
+ // image index
+ this.autoComplete1.ImageColumnIndex = -1;
+ // The image list to be used as the image source
+ this.autoComplete1.ImageList = null;
+ // The preferred height for the drop down window
+ this.autoComplete1.PreferredHeight = 200;
+ // Add a event to customize data added to history
+ this.autoComplete1.BeforeAddItem += new AutoCompleteAddItemCancelEventHandler(this.autoComplete1_BeforeAddItem);
+ // Set Auto Complete
+ // properties for target TextBox
+ this.autoComplete1.SetAutoComplete(this.textBox1, AutoCompleteMode.Both);
+ // Added by designer - Add the TextBox to the Form
+ this.Controls.Add(textBox1);
+
+ ' This code shows how the AutoComplete control
+ ' is initialized and used
+ Me.AutoComplete1 = New AutoComplete()
+ Me.textBox1 = New TextBox()
+ ' Set AutoComplete1 properties
+ ' Set the ParentForm property of the AutoComplete control
+ Me.AutoComplete1.ParentForm = Me
+ Me.AutoComplete1.AdjustHeightToItemCount = True
+ ' The AutoComplete control will add contents of the target control to
+ ' its history list automatically (when the enter key is hit)
+ Me.AutoComplete1.AutoAddItem = True
+ ' The AutoComplete control will maintain its history items
+ Me.AutoComplete1.AutoSerialize = True
+ ' The category under which the history list will be persisted
+ Me.autoComplete1.CategoryName = "websites"
+ ' Specifies if any of the columns in the data source are to be treated as
+ ' image index
+ Me.AutoComplete1.ImageColumnIndex = -(1)
+ ' The image list to be used as the image source
+ Me.AutoComplete1.ImageList = Nothing
+ ' The preferred height for the drop down window
+ Me.AutoComplete1.PreferredHeight = 200
+ ' Add a event to customize data added to history
+ AddHandler Me.autoComplete1.BeforeAddItem, New AutoCompleteAddItemCancelEventHandler(AddressOf AutoComplete1_BeforeAddItem)
+ ' Set Auto Complete
+ ' properties for target TextBox
+ Me.AutoComplete1.SetAutoComplete(Me.textBox1, AutoCompleteMode.Both)
+ ' Added by designer - Add the TextBox to the Form
+ Me.Controls.Add(textBox1)
+
+ // Add a event to customize data added to history
+ this.autoComplete1.BeforeAddItem += new AutoCompleteAddItemCancelEventHandler(this.autoComplete1_BeforeAddItem);
+
+ // autoComplete1_BeforeAddItem
+ int columnCount = args.RowItem.Table.Columns.Count;
+ object [] itemarray = args.RowItem.ItemArray;
+
+ string itemText = (string)itemarray[0];// the url field
+ string nameText = (string)itemarray[1];// The name field
+
+ if(itemText.Substring(0,4) == "http")
+ {
+ if(nameText == null || nameText == String.Empty)
+ nameText = "Website";
+ }
+ else if(itemText.Substring(0,3) == "ftp")
+ {
+ if(nameText == null || nameText == String.Empty)
+ nameText = "FTP site";
+ }
+ else
+ args.Cancel = true;
+
+ itemarray[0] = itemText;
+ itemarray[1] = nameText;
+ args.RowItem.ItemArray = itemarray;
+
+
+ ' Add a event to customize data added to history
+ AddHandler Me.autoComplete1.BeforeAddItem, New AutoCompleteAddItemCancelEventHandler(AddressOf autoComplete1_BeforeAddItem)
+ ' autoComplete1_BeforeAddItem
+ Dim columnCount As Integer
+ columnCount = args.RowItem.Table.Columns.Count
+ Dim itemarray() As Object
+ itemarray = args.RowItem.ItemArray
+ Dim itemText As String
+ itemText = CType(itemarray(0), String)
+ ' the url field
+ Dim nameText As String
+ nameText = CType(itemarray(1), String)
+ ' The name field
+ If (itemText.Substring(0, 4) Is "http") Then
+ If ((nameText Is Nothing) _
+ OrElse (nameText Is String.Empty)) Then
+ nameText = "Website"
+ End If
+ Else
+ If (itemText.Substring(0, 3) Is "ftp") Then
+ If ((nameText Is Nothing) _
+ OrElse (nameText Is String.Empty)) Then
+ nameText = "FTP site"
+ End If
+ Else
+ args.Cancel = True
+ End If
+ End If
+ itemarray(0) = itemText
+ itemarray(1) = nameText
+ args.RowItem.ItemArray = itemarray
+
+
+ this.autoComplete1.SetAutoComplete(this.textBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteModes.AutoSuggest);
+
+
+ Me.autoComplete1.SetAutoComplete(Me.textBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteModes.AutoSuggest)
+
+
+ AutoCompleteMode mode = this.autoComplete1.GetAutoComplete(this.comboBox1);
+ if(mode == AutoCompleteMode.Disabled)
+ this.autoComplete1.SetAutoComplete(this.comboBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteMode.AutoSuggest);
+ else
+ this.autoComplete1.SetAutoComplete(this.comboBox1, AutoCompleteMode.Disabled);
+
+
+ Dim mode As AutoCompleteMode
+ mode = Me.autoComplete1.GetAutoComplete(Me.comboBox1)
+ If (mode = AutoCompleteMode.Disabled) Then
+ Me.autoComplete1.SetAutoComplete(Me.comboBox1, Syncfusion.Windows.Forms.Tools.AutoCompleteMode.AutoSuggest)
+ Else
+ Me.autoComplete1.SetAutoComplete(Me.comboBox1, AutoCompleteMode.Disabled)
+ End If
+
+
+ private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
+ {
+ if (e.KeyChar == '@')
+ {
+ this.autoComplete1.CloseDropDown();
+ }
+ }
+
+
+ Private Sub textBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
+ If e.KeyChar = "@"C Then
+ Me.autoComplete1.CloseDropDown
+ End If
+ End Sub
+
+
+ private void textBox1_GotFocus(object sender, EventArgs e)
+ {
+ this.autoComplete1.SingleClick = true;
+ }
+
+
+ Private Sub textBox1_GotFocus(ByVal sender As Object, ByVal e As EventArgs)
+ Me.autoComplete1.SingleClick = True
+
+
+ this.autoComplete1.DataSource =this.dataView1 ;
+ this.autoCompleteDataColumnInfo1 = new Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("EmployeeID", 100, true);
+ this.autoCompleteDataColumnInfo2 = new Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("LastName", 100, true);
+ this.autoCompleteDataColumnInfo3 = new Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("BirthDate", 100, true);
+ this.autoCompleteDataColumnInfo4 = new Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("City", 100, true);
+
+
+ Me.autoComplete1.DataSource =Me.dataView1
+ Me.autoCompleteDataColumnInfo1 = New Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("EmployeeID", 100, True)
+ Me.autoCompleteDataColumnInfo2 = New Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("LastName", 100, True)
+ Me.autoCompleteDataColumnInfo3 = New Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("BirthDate", 100, True)
+ Me.autoCompleteDataColumnInfo4 = New Syncfusion.Windows.Forms.Tools.AutoCompleteDataColumnInfo("City", 100, True)
+
+
+ private void ComboBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
+ {
+ if (CheckBox1.Checked) {
+ this.AutoComplete1.AutoCompletePopup.ShowPopup(this.PointToScreen(new Point(ComboBox1.Location.X, ComboBox1.Location.Y + ComboBox1.Height)));
+ }
+ }
+
+
+ Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
+ If CheckBox1.Checked Then
+ Me.AutoComplete1.AutoCompletePopup.ShowPopup(Me.PointToScreen(New Point(ComboBox1.Location.X, ComboBox1.Location.Y + ComboBox1.Height)))
+ End If///End Sub
+
+
+ this.autoComplete.AutoAddItem = true;
+ this.autoComplete.AutoSerialize = false;
+ this.autoComplete.CategoryName = "SomeCategory";
+
+
+ Me.autoComplete.AutoAddItem = True
+ Me.autoComplete.AutoSerialize = False
+ Me.autoComplete.CategoryName = "SomeCategory"
+
+
+ public class Form1 : System.Windows.Forms.Form
+ {
+ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
+ {
+ if (keyData == Keys.Escape)
+ {
+ if (this.ActiveControl == this.autoComplete1.ActiveFocusControl)
+ {
+ this.autoComplete1.CloseDropDown();
+ return true;
+ }
+ }
+ return base.ProcessCmdKey(ref msg, keyData);
+ }
+ }
+
+
+ Public Class Form1 Inherits System.Windows.Forms.Form
+ Protected Overloads Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
+ If keyData = Keys.Escape Then
+ If Me.ActiveControl = Me.autoComplete1.ActiveFocusControl Then
+ Me.autoComplete1.CloseDropDown
+ Return True
+ End If
+ End If
+ Return MyBase.ProcessCmdKey(msg, keyData)
+ End Function
+ End Class
+
+
+ private void UserControl1_Load(object sender, System.EventArgs e)
+ {
+ this.autoComplete1.ParentForm = this.ParentForm;
+ this.autoComplete1.DataSource = this.items;
+ }
+
+
+ Private Sub UserControl1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
+ Me.autoComplete1.ParentForm = Me.ParentForm Me.autoComplete1.DataSource = Me.items
+ End Sub
+
+
+ foreach(DataRow dr in this.autoComplete1.TableData.Rows)
+ {
+ Console.WriteLine ("Rows "+dr[0]);
+ }
+
+
+ For Each dr As DataRow In Me.autoComplete1.TableData.Rows
+ Console.WriteLine("Rows " + dr(0))
+ Next
+
+
+ private void Form1_Load(object sender, System.EventArgs e)
+ {
+ DataTable dt;
+ dt = new DataTable("select");
+ dt.Columns.Add("Countries");
+ dt.Columns.Add("states");
+ dt.Rows.Add(new object[] { "India " });
+ dt.Rows.Add(new object[] { "New York " });
+ dt.Rows.Add(new object[] { "Washington " });
+ dt.Rows.Add(new object[] { "London" });
+ dt.Rows.Add(new object[] { "Canada" });
+ autoComplete1.DataSource = dt;
+ }
+
+
+ Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
+ Private dt As DataTable
+ dt = New DataTable("select")
+ dt.Columns.Add("Countries")
+ dt.Columns.Add("states")
+ dt.Rows.Add(New Object() {"India "})
+ dt.Rows.Add(New Object() {"New York "})
+ dt.Rows.Add(New Object() {"Washington "})
+ dt.Rows.Add(New Object() {"London"})
+ dt.Rows.Add(New Object() {"Canada"})
+ autoComplete1.DataSource = dt
+ End Sub
+
+
+ //InitializeComponent
+ // Create the Calculator Control
+ this.calculatorControl1 = new CalculatorControl();
+ this.textBox1 = new TextBox();
+ // Set the value of the calculator control
+ this.calculatorControl1.DoubleValue = 0;
+ // Set the border style for the control
+ this.calculatorControl1.BorderStyle = Border3DStyle.Raised;
+ // The flat style for the buttons
+ this.calculatorControl1.FlatStyle = FlatStyle.Standard;
+ // Set the size of the calculator
+ this.calculatorControl1.Size = new System.Drawing.Size(288, 232);
+ // Add a event handler for the ValueCalculated event of the child button
+ this.calculatorControl1.ValueCalculated += new Syncfusion.Windows.Forms.Tools.CalculatorControl.ValueCalculatedEventHandler(this.CodeGen_calculatorControl1_ValueCalculated);
+ // Add the CalculatorControl control to the form
+ this.Controls.Add(this.calculatorControl1);
+
+ 'InitializeComponent
+ ' Create the Calculator Control
+ Me.calculatorControl1 = New CalculatorControl()
+ Me.textBox1 = New TextBox()
+ ' Set the value of the calculator control
+ Me.calculatorControl1.DoubleValue = 0
+ ' Set the border style for the control
+ Me.calculatorControl1.BorderStyle = Border3DStyle.Raised
+ ' The flat style for the buttons
+ Me.calculatorControl1.FlatStyle = FlatStyle.Standard
+ ' Set the size of the calculator
+ Me.calculatorControl1.Size = New System.Drawing.Size(288, 232)
+ ' Add a event handler for the ValueCalculated event of the child button
+ AddHandler Me.calculatorControl1.ValueCalculated, New Syncfusion.Windows.Forms.Tools.CalculatorControl.ValueCalculatedEventHandler(AddressOf CodeGen_calculatorControl1_ValueCalculated)
+ ' Add the CalculatorControl control to the form
+ Me.Controls.Add(Me.calculatorControl1)
+ this.calculatorControl1.ValueCalculated += new Syncfusion.Windows.Forms.Tools.CalculatorControl.ValueCalculatedEventHandler(this.CodeGen_calculatorControl1_ValueCalculated);
+ calculatorControl1_ValueCalculated
+ if(arg.ErrorCondition == false)
+ this.textBox1.Text = arg.Value.ToString();
+ else
+ this.textBox1.Text = arg.Message;
+
+ AddHandler Me.calculatorControl1.ValueCalculated, New Syncfusion.Windows.Forms.Tools.CalculatorControl.ValueCalculatedEventHandler(AddressOf CodeGen_calculatorControl1_ValueCalculated)
+ 'calculatorControl1_ValueCalculated
+ If (arg.ErrorCondition = False) Then
+ Me.textBox1.Text = arg.Value.ToString
+ Else
+ Me.textBox1.Text = arg.Message
+ End If
+ // CurrencyEdit control
+ this.currencyEdit1 = new Syncfusion.Windows.Forms.Tools.CurrencyEdit();
+ //
+ // currencyEdit1
+ //
+ this.currencyEdit1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.currencyEdit1.Location = new System.Drawing.Point(16, 80);
+ this.currencyEdit1.Name = "currencyEdit1";
+ this.currencyEdit1.SelectionLength = 0;
+ this.currencyEdit1.SelectionStart = 5;
+ this.currencyEdit1.ShowCalculator = true;
+ this.currencyEdit1.ShowTextBox = true;
+ this.currencyEdit1.Size = new System.Drawing.Size(304, 22);
+ this.currencyEdit1.TabIndex = 1;
+ this.currencyEdit1.Text = "$1.00";
+ this.currencyEdit1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
+ // Add the CurrencyEdit control to the form
+ this.Controls.Add(this.currencyEdit1);
+
+ ' CurrencyEdit control
+ Me.currencyEdit1 = New Syncfusion.Windows.Forms.Tools.CurrencyEdit
+ '
+ ' currencyEdit1
+ '
+ Me.currencyEdit1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
+ Me.currencyEdit1.Location = New System.Drawing.Point(16, 80)
+ Me.currencyEdit1.Name = "currencyEdit1"
+ Me.currencyEdit1.SelectionLength = 0
+ Me.currencyEdit1.SelectionStart = 5
+ Me.currencyEdit1.ShowCalculator = true
+ Me.currencyEdit1.ShowTextBox = true
+ Me.currencyEdit1.Size = New System.Drawing.Size(304, 22)
+ Me.currencyEdit1.TabIndex = 1
+ Me.currencyEdit1.Text = "$1.00"
+ Me.currencyEdit1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
+ ' Add the CurrencyEdit control to the form
+ Me.Controls.Add(Me.currencyEdit1)
+
+
+ Console.WriteLine("ValidationError in currencyTextBox1 InvalidText" + e.InvalidText);
+ Console.WriteLine("ValidationError in currencyTextBox1 StartPosition" + e.StartPosition );
+
+ Console.WriteLine(("ValidationError in currencyTextBox1 InvalidText" + e.InvalidText))
+ Console.WriteLine(("ValidationError in currencyTextBox1 StartPosition" + e.StartPosition))
+ Font newFont = new Font(this.fontCombo.Text, 10.0);
+
+
+ Font newFont = new Font(this.fontListBox.Text, 10.0);
+
+ This combo box is meant to be used in data bound mode where it will + show all the records and the different fields in the data source in a + multi column grid, in the dropdown.
+Data binding is done as usual through the
If you bind an array of objects of custom type then the public properties + in that type will correspond to each column in the dropdown multi-column grid.
+Note that in this version you cannot populate the
+ // InitializeComponent
+ // Create the Gradient Label
+ this.gradientLabel1 = new GradientLabel();
+ // Set formatting properties
+ this.gradientLabel1.Text = "Essential Suite Gradient Label";
+ this.gradientLabel1.BackgroundColor = new BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.HighlightText);
+ this.gradientLabel1.BorderStyle = Border3DStyle.Etched;
+ this.gradientLabel1.Font = new Font("Microsoft Sans Serif", 14.25F, (System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
+ this.gradientLabel1.Location = new Point(24, 16);
+ this.gradientLabel1.Name = "gradientLabel1";
+ this.gradientLabel1.Size = new Size(440, 56);
+ this.gradientLabel1.TextAlign = ContentAlignment.MiddleCenter;
+ // Add the GradientLabel control to the form
+ this.Controls.Add(this.gradientLabel1);
+
+ ' InitializeComponent
+ ' Create the GradientLabel control.
+ Me.gradientLabel1 = New GradientLabel()
+ ' Set formatting properties
+ Me.gradientLabel1.Text = "Essential Suite Gradient Label"
+ Me.gradientLabel1.BackgroundColor = New BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.HighlightText)
+ Me.gradientLabel1.BorderStyle = Border3DStyle.Etched
+ Me.gradientLabel1.Font = New Font("Microsoft Sans Serif", 14.25!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.gradientLabel1.Location = New Point(24, 16)
+ Me.gradientLabel1.Name = "gradientLabel1"
+ Me.gradientLabel1.Size = New Size(440, 56)
+ Me.gradientLabel1.TextAlign = ContentAlignment.MiddleCenter
+ ' Add the GradientLabel control to the form
+ Me.Controls.Add(Me.gradientLabel1)
+ This property will be ignored by the
+
Handles the
The CollapseAll method collapses all the
The state of a TreeNodeAdv persists. For example, suppose that + a parent tree node is expanded. If the child tree nodes were not + previously collapsed, they will appear in their previously-expanded + state. Calling the CollapseAll method ensures that all the tree nodes + appear in the collapsed state.
The ExpandAll method expands all the
The CancelEditMode method cancels the edit mode when the node is in the EditingMode.
+ private void button1_Click(object sender, System.EventArgs e)
+ {
+ //Call the tree control's "GetNodeCount" method with true to
+ //get the total number of nodes in the tree
+ int TotalNodesInTree = this.treeViewAdv1.GetNodeCount( true );
+ MessageBox.Show( "Total nodes in tree = " + TotalNodesInTree.ToString());
+ }
+ //Add nodes
+ private void button2_Click(object sender, System.EventArgs e)
+ {
+ this.treeViewAdv1.SelectedNode.Nodes.Add(new TreeNodeAdv());
+ }
+ //Remove nodes
+ private void button3_Click(object sender, System.EventArgs e)
+ {
+ this.treeViewAdv1.SelectedNode.Parent.Nodes.Remove(this.treeViewAdv1.SelectedNode);
+ }
+
+ Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
+ ' Call the tree control's "GetNodeCount" method with true to
+ ' get the total number of nodes in the tree
+ Dim TotalNodesInTree As Integer = Me.treeViewAdv1.GetNodeCount(True)
+ MessageBox.Show("Total nodes in tree = " & TotalNodesInTree.ToString())
+ End Sub
+ 'Add nodes
+ Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
+ Me.treeViewAdv1.SelectedNode.Nodes.Add(New TreeNodeAdv())
+ End Sub
+ 'Remove nodes
+ Private Sub button3_Click(ByVal sender As Object, ByVal e As System.EventArgs)
+ Me.treeViewAdv1.SelectedNode.Parent.Nodes.Remove(Me.treeViewAdv1.SelectedNode)
+ End Sub
+
+ If SortWithChildNodes property is set to true,the user can sort all the nodes including all the child nodes in the treeViewAdv.
+ The SortOrder of the Root should be specified for the sorting all nodes.
+ // Sorts only the root nodes.
+ private void button1_Click(object sender, System.EventArgs e)
+ {
+ this.treeViewAdv1.Nodes.Sort();
+ }
+ // Sort all the root nodes and the child nodes in the TreeviewAdv
+ private void button2_Click_1(object sender, System.EventArgs e)
+ {
+ this.treeViewAdv1.Root.SortOrder=SortOrder.Ascending;
+ this.treeViewAdv1.SortWithChildNodes=true;
+ this.treeViewAdv1.Root.Sort();
+ }
+
+ 'Sorts only the root nodes.
+ Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
+ Me.treeViewAdv1.Nodes.Sort()
+ End Sub
+ 'Sort all the root nodes and the child nodes in the TreeviewAdv
+ Private Sub button2_Click_1(ByVal sender As Object, ByVal e As System.EventArgs)
+ Me.treeViewAdv1.Root.SortOrder=SortOrder.Ascending
+ Me.treeViewAdv1.SortWithChildNodes=True
+ Me.treeViewAdv1.Root.Sort()
+ End Sub
+ The Item property in the argument is an array of MultiColumnTreeView nodes that + are currently selected.
+ You can choose to initiate an ole drag-and-drop operation in this event handler. +
+ // MultiColumnTreeView.ItemDrag event listener
+ private void treeViewAdv1_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
+ {
+ // Begin a drag and drop operation of the selected nodes (or some other data).
+ TreeNodeAdv[] nodes = e.Item as TreeNodeAdv[];
+ DragDropEffects result = this.DoDragDrop(nodes, DragDropEffects.Copy | DragDropEffects.Move);
+ // more app logic based on result...
+ }
+
+ ' MultiColumnTreeView.ItemDrag event listener
+ Private Sub treeViewAdv1_ItemDrag(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles treeViewAdv2.ItemDrag
+ ' Begin a drag and drop operation of the selected nodes (or some other data).
+ Dim nodes As TreeNodeAdv() = CType(e.Item, TreeNodeAdv())
+ Dim result As DragDropEffects = Me.DoDragDrop(nodes, DragDropEffects.Copy Or DragDropEffects.Move)
+ ' more app logic based on result...
+ End Sub 'treeViewAdv1_ItemDrag '
+ The
The TreeNodeAdv label is set by setting the
You can specify images for the node using the
The order in which the tree node's contents are drawn is as follows:
+
+ The "State image" will be one of OpenImgIndex, ClosedImgIndex and NoChildrenImgIndex.
+
+ Selecting specific tree nodes and iterating through the
+ Tree nodes can be expanded to display the next level of child tree nodes.
+ The user can expand the tree node by pressing the plus (+) button next to the
+ TreeNodeAdv, if one is displayed or you can expand the TreeNodeAdv by calling the
+
+ The following example displays customer information in a
+ // Create a new ArrayList to hold the Customer objects.
+ private ArrayList customerArray = new ArrayList();
+ private void FillMyTreeView()
+ {
+ // Add customers to the ArrayList of Customer objects.
+ for(int x=0; x!=1000; x++)
+ {
+ customerArray.Add(new Customer("Customer" + x.ToString()));
+ }
+ // Add orders to each Customer object in the ArrayList.
+ foreach(Customer customer1 in customerArray)
+ {
+ for(int y=0; y!=15; y++)
+ {
+ customer1.CustomerOrders.Add(new Order("Order" + y.ToString()));
+ }
+ }
+
+ // Display a wait cursor while the TreeNodeAdvs are being created.
+ Cursor.Current = new Cursor("C:\\Cursors\\MyWait.cur");
+ // Clear the TreeViewAdv each time the method is called.
+ treeViewAdv1.Nodes.Clear();
+ // Add a root TreeNodeAdv for each Customer object in the ArrayList.
+ foreach(Customer customer2 in customerArray)
+ {
+ treeViewAdv1.Nodes.Add(new TreeNodeAdv(customer2.CustomerName));
+ // Add a child treenode for each Order object in the current Customer object.
+ foreach(Order order1 in customer2.CustomerOrders)
+ {
+ treeViewAdv1.Nodes[customerArray.IndexOf(customer2)].Nodes.Add(
+ new TreeNodeAdv(customer2.CustomerName + "." + order1.OrderID));
+ }
+ }
+ // Reset the cursor to the default for all controls.
+ Cursor.Current = Cursors.Default;
+ }
+
+ ' Create a new ArrayList to hold the Customer objects.
+ Private customerArray As New ArrayList()
+ Private Sub FillMyTreeView()
+ ' Add customers to the ArrayList of Customer objects.
+ Dim x As Integer
+ For x = 0 To 999
+ customerArray.Add(New Customer("Customer" + x.ToString()))
+ Next x
+
+ ' Add orders to each Customer object in the ArrayList.
+ Dim customer1 As Customer
+ For Each customer1 In customerArray
+ Dim y As Integer
+ For y = 0 To 14
+ customer1.CustomerOrders.Add(New Order("Order" + y.ToString()))
+ Next y
+ Next customer1
+
+ ' Display a wait cursor while the TreeNodeAdvs are being created.
+ Cursor.Current = New Cursor("C:\Cursors\MyWait.cur")
+
+ ' Clear the TreeViewAdv each time the method is called.
+ treeViewAdv1.Nodes.Clear()
+
+ ' Add a root TreeNodeAdv for each Customer object in the ArrayList.
+ Dim customer2 As Customer
+ For Each customer2 In customerArray
+ treeViewAdv1.Nodes.Add(New TreeNodeAdv(customer2.CustomerName))
+
+ ' Add a child TreeNodeAdv for each Order object in the current Customer object.
+ Dim order1 As Order
+ For Each order1 In customer2.CustomerOrders
+ treeViewAdv1.Nodes(customerArray.IndexOf(customer2)).Nodes.Add( _
+ New TreeNodeAdv(customer2.CustomerName + "." + order1.OrderID))
+ Next order1
+ Next customer2
+
+ ' Reset the cursor to the default for all controls.
+ Cursor.Current = System.Windows.Forms.Cursors.Default
+
+ ' Begin repainting the TreeView.
+ treeViewAdv1.EndUpdate()
+ End Sub 'FillMyTreeView
+ You can also use the
Note that setting this property will fire the
+ treeNodeAdv.NodeStyle.CheckState = CheckState.Checked;
+
+ treeNodeAdv.NodeStyle.CheckState = CheckState.Checked
+ Any Object derived type may be assigned to this property. If this property is + being set through the Windows Forms designer, only text may be assigned.
When the tree node is cloned, if this object is cloneable (implements ICloneable + interface) then it will be.
You can also use the more flexible
The path consists of the labels of all of the tree nodes that must be
+ navigated to get to this tree node, starting at the root tree node. The node
+ labels are separated by the delimiter character specified in the
+
This collection contains references to all selected nodes in the TreeViewAdv.
+ Adding a
Whenever a node is selected/deselected, either by user action or in code, + it is automatically added/removed from the SelectedNodes collection.
+This collection is read-only, which means you can add and remove elements but cannot change + the existing elements.
+You can listen to new selections being added to this collection using the collection's
+
Use this class (will be referred to as "tracker" below) only when you want to support dropping adjacent (above or below) to a node.
+ Otherwise simply listen to the
+ The usage semantics for the tracker is as follows: +
+ By default (when value is negative), the top 1/3 of the node will be considered the top edge.
+ This value will be used when you allow dropping before a node using
+ the
+ By default (when value is negative), the bottom 1/3 of the node will be considered the bottom edge.
+ This value will be used when you allow dropping below a node using the
+
+ // InitializeComponent
+ System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
+ // Create the splash control
+ this.splashControl1 = new SplashControl();
+ // Setting AutoMode to true will automatically launch
+ // splash screen - no additional code is required
+ this.splashControl1.AutoMode = true;
+ // The start position for the splash screen
+ this.splashControl1.DesktopAlignment = Syncfusion.Windows.Forms.Tools.SplashPanel.SplashAlignment.Center;
+ // The host form for the splash control
+ this.splashControl1.HostForm = this;
+ // Specifies if the splash screen should appear animated
+ this.splashControl1.ShowAnimation = false;
+ // The Splash image - specified through the designer
+ this.splashControl1.SplashImage = ((System.Drawing.Bitmap)(resources.GetObject("splashControl1.SplashImage")));
+ // The time period for which the splash should appear
+ this.splashControl1.TimerInterval = 10000;
+
+ ' InitializeComponent
+ Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(MainForm))
+ ' Create the splash control
+ Me.splashControl1 = New SplashControl()
+ ' Setting AutoMode to true will automatically launch
+ ' splash screen - no additional code is required
+ Me.splashControl1.AutoMode = True
+ ' The start position for the splash screen
+ Me.splashControl1.DesktopAlignment = Syncfusion.Windows.Forms.Tools.SplashPanel.SplashAlignment.Center
+ ' The host form for the splash control
+ Me.splashControl1.HostForm = Me
+ ' Specifies if the splash screen should appear animated
+ Me.splashControl1.ShowAnimation = False
+ ' The Splash image - specified through the designer
+ Me.splashControl1.SplashImage = CType(resources.GetObject("splashControl1.SplashImage"), System.Drawing.Bitmap)
+ ' The time period for which the splash should appear
+ Me.splashControl1.TimerInterval = 10000
+
+ private void splashControl1_SplashClosed(object sender, System.EventArgs e)
+ {
+ MessageBox.Show("The Splash screen has closed.");
+ }
+
+ Private Sub splashControl1_SplashClosed(ByVal sender As Object, ByVal e As System.EventArgs)
+ MessageBox.Show("The Splash screen has closed.")
+ End Sub
+
+ // Create the splash panel
+ this.splashPanel1 = new SplashPanel();
+ this.button1 = new Button();
+ // The animation speed
+ this.splashPanel1.AnimationSpeed = 10;
+ // The background
+ this.splashPanel1.BackgroundColor = new BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.HighlightText, System.Drawing.SystemColors.Highlight);
+ // The border style
+ this.splashPanel1.BorderStyle = System.Windows.Forms.Border3DStyle.Bump;
+ // The child controls - added through the designer
+ this.splashPanel1.Controls.AddRange(new System.Windows.Forms.Control[] {
+ this.linkLabel1});
+ // The startup location for the splash panel
+ this.splashPanel1.DesktopAlignment = SplashPanel.SplashAlignment.SystemTray;
+ // Specifies whether the window should appear animated
+ this.splashPanel1.ShowAnimation = true;
+ // The interval for which the panel is to be displayed
+ this.splashPanel1.TimerInterval = 5000;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+
+
+ ' Create the splash panel
+ Me.splashPanel1 = New SplashPanel()
+ Me.button1 = New Button()
+ ' The animation speed
+ Me.splashPanel1.AnimationSpeed = 10
+ ' The background
+ Me.splashPanel1.BackgroundColor = New BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.HighlightText, System.Drawing.SystemColors.Highlight)
+ ' The border style
+ Me.splashPanel1.BorderStyle = System.Windows.Forms.Border3DStyle.Bump
+ ' The child controls - added through the designer
+ Me.splashPanel1.Controls.AddRange(New System.Windows.Forms.Control() {Me.linkLabel1})
+ ' The startup location for the splash panel
+ Me.splashPanel1.DesktopAlignment = SplashPanel.SplashAlignment.SystemTray
+ ' Specifies whether the window should appear animated
+ Me.splashPanel1.ShowAnimation = True
+ ' The interval for which the panel is to be displayed
+ Me.splashPanel1.TimerInterval = 5000
+ AddHandler Me.button1.Click, New System.EventHandler(AddressOf button1_Click)
+
+
+ this.splashPanel1.SplashClosing += new Syncfusion.Windows.Forms.Tools.SplashClosedEventHandler(this.splashPanel1_SplashClosing);
+ // splashPanel1_SplashClosing event handler
+ MessageBox.Show("SplashPanel closing event handler");
+
+ AddHandler Me.splashPanel1.SplashClosing, New Syncfusion.Windows.Forms.Tools.SplashClosedEventHandler(AddressOf splashPanel1_SplashClosing)
+ ' splashPanel1_SplashClosing event handler
+ MessageBox.Show("SplashPanel closing event handler")
+ StatusBarAdv statusBarAdv1;
+ Create the StatusBarAdv control
+ this.statusBarAdv1 = new StatusBarAdv();
+
+
+ Dim statusBarAdv1 As StatusBarAdv
+ � Create the StatusBarAdv control
+ Me.statusBarAdv1 = New StatusBarAdv()
+
+ Set the properties of the StatusBarAdv control.
+
+ this.statusBarAdv1.Alignment = Syncfusion.Windows.Forms.Tools.FlowAlignment.Far;
+ this.statusBarAdv1.Border3DStyle = System.Windows.Forms.Border3DStyle.RaisedInner;
+ this.statusBarAdv1.BorderColor = System.Drawing.Color.Black;
+ this.statusBarAdv1.BorderSides = System.Windows.Forms.Border3DSide.All;
+ this.statusBarAdv1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.statusBarAdv1.CustomLayoutBounds = new System.Drawing.Rectangle(0, 0, 0, 0);
+ this.statusBarAdv1.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.statusBarAdv1.GradientColors = new System.Drawing.Color[0];
+ this.statusBarAdv1.Location = new System.Drawing.Point(0, 318);
+ this.statusBarAdv1.Name = "statusBarAdv1";
+ this.statusBarAdv1.Size = new System.Drawing.Size(856, 24);
+ this.statusBarAdv1.Spacing = new System.Drawing.Size(5, 2);
+ this.statusBarAdv1.TabIndex = 12;
+
+ Add StatusBarAdvPanel controls to the StatusBarAdv control.
+
+ StatusBarAdvPanel statuBarAdvPanel1 = new StatusBarAdvPanel()
+ StatusBarAdvPanel statuBarAdvPanel2 = new StatusBarAdvPanel();
+ StatusBarAdvPanel statuBarAdvPanel3 = new StatusBarAdvPanel();
+ this.statusBarAdv1.Panels = new StatusBarAdvPanel[]
+ {
+ this.statusBarAdvPanel1,
+ this.statusBarAdvPanel2,
+ this.statusBarAdvPanel3});
+ statusBarAdvPanel1
+ this.statusBarAdvPanel1.BorderColor = System.Drawing.Color.Black;
+ this.statusBarAdvPanel1.BorderSides = System.Windows.Forms.Border3DSide.All;
+ this.statusBarAdvPanel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.statusBarAdvPanel1.GradientColors = new System.Drawing.Color[0];
+ this.statusBarAdvPanel1.Location = new System.Drawing.Point(541, 2);
+ this.statusBarAdvPanel1.Name = "statusBarAdvPanel1";
+ this.statusBarAdvPanel1.Size = new System.Drawing.Size(100, 20);
+ this.statusBarAdvPanel1.TabIndex = 1;
+ this.statusBarAdvPanel1.Text = "statusBarAdvPanel1";
+ this.statusBarAdvPanel1.Type = StatusBarAdvPanelType.CapsLockState;
+ statusBarAdvPanel2
+ this.statusBarAdvPanel2.BorderColor = System.Drawing.Color.Black;
+ this.statusBarAdvPanel2.BorderSides = System.Windows.Forms.Border3DSide.All;
+ this.statusBarAdvPanel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.statusBarAdvPanel2.GradientColors = new System.Drawing.Color[0];
+ this.statusBarAdvPanel2.Location = new System.Drawing.Point(646, 2);
+ this.statusBarAdvPanel2.Name = "statusBarAdvPanel2";
+ this.statusBarAdvPanel2.Size = new System.Drawing.Size(100, 20);
+ this.statusBarAdvPanel2.TabIndex = 2;
+ this.statusBarAdvPanel2.Text = "statusBarAdvPanel2";
+ this.statusBarAdvPanel2.Type = StatusBarAdvPanelType.NumLockState;
+ statusBarAdvPanel3
+ this.statusBarAdvPanel3.BorderColor = System.Drawing.Color.Black;
+ this.statusBarAdvPanel3.BorderSides = System.Windows.Forms.Border3DSide.All;
+ this.statusBarAdvPanel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
+ this.statusBarAdvPanel3.GradientColors = new System.Drawing.Color[0];
+ this.statusBarAdvPanel3.Location = new System.Drawing.Point(751, 2);
+ this.statusBarAdvPanel3.Name = "statusBarAdvPanel3";
+ this.statusBarAdvPanel3.Size = new System.Drawing.Size(100, 20);
+ this.statusBarAdvPanel3.TabIndex = 3;
+ this.statusBarAdvPanel3.Text = "statusBarAdvPanel3";
+ this.statusBarAdvPanel3.Type = StatusBarAdvPanelType.LongTime;
+
+ Add the StatusBarAdv control to the form
+
+ Add the StatusBarAdv control to the form
+ this.Controls.Add(this.statusBarAdv1);
+
+
+ �Add the StatusBarAdv control to the form
+ Me.Controls.Add(Me.statusBarAdv1)
+
+
+ private void tabControlAdv1_SelectedIndexChanging(object sender, Syncfusion.Windows.Forms.Tools.SelectedIndexChangingEventArgs args)
+ {
+ TabPageAdv newPage = this.tabControlAdv1.TabPages[args.NewSelectedIndex];
+ if(newPage == this.tab1)
+ {
+ MessageBox.Show("Cannot select tab page 1");
+ args.Cancel = true;
+ }
+ }
+
+
+ Private Sub tabControlAdv1_SelectedIndexChanging(ByVal sender As Object, ByVal args As Syncfusion.Windows.Forms.Tools.SelectedIndexChangingEventArgs)
+ Dim NewPage As TabPageAdv = Me.tabControlAdv1.TabPages(args.NewSelectedIndex)
+ If NewPage = Me.tab1 Then
+ MessageBox.Show("Cannot select tab page 1")
+ args.Cancel = True
+ End If
+ End Sub
+
+ The
The TreeNodeAdv label is set by setting the
You can specify images for the node using the
The order in which the tree node's contents are drawn is as follows:
+
+
+ The "State image" will be one of OpenImgIndex, ClosedImgIndex and NoChildrenImgIndex.
+
+ Selecting specific tree nodes and iterating through the
+ Tree nodes can be expanded to display the next level of child tree nodes.
+ The user can expand the tree node by pressing the plus (+) button next to the
+ TreeNodeAdv, if one is displayed or you can expand the TreeNodeAdv by calling the
+
+ The following example displays customer information in a
+ // Create a new ArrayList to hold the Customer objects.
+ private ArrayList customerArray = new ArrayList();
+
+ private void FillMyTreeView()
+ {
+ // Add customers to the ArrayList of Customer objects.
+ for(int x=0; x!=1000; x++)
+ {
+ customerArray.Add(new Customer("Customer" + x.ToString()));
+ }
+ // Add orders to each Customer object in the ArrayList.
+ foreach(Customer customer1 in customerArray)
+ {
+ for(int y=0; y!=15; y++)
+ {
+ customer1.CustomerOrders.Add(new Order("Order" + y.ToString()));
+ }
+ }
+
+ // Display a wait cursor while the TreeNodeAdvs are being created.
+ Cursor.Current = new Cursor("C:\\Cursors\\MyWait.cur");
+ // Clear the TreeViewAdv each time the method is called.
+ treeViewAdv1.Nodes.Clear();
+ // Add a root TreeNodeAdv for each Customer object in the ArrayList.
+ foreach(Customer customer2 in customerArray)
+ {
+ treeViewAdv1.Nodes.Add(new TreeNodeAdv(customer2.CustomerName));
+ // Add a child treenode for each Order object in the current Customer object.
+ foreach(Order order1 in customer2.CustomerOrders)
+ {
+ treeViewAdv1.Nodes[customerArray.IndexOf(customer2)].Nodes.Add(
+ new TreeNodeAdv(customer2.CustomerName + "." + order1.OrderID));
+ }
+ }
+ // Reset the cursor to the default for all controls.
+ Cursor.Current = Cursors.Default;
+ }
+
+
+ ' Create a new ArrayList to hold the Customer objects.
+ Private customerArray As New ArrayList()
+ Private Sub FillMyTreeView()
+ ' Add customers to the ArrayList of Customer objects.
+ Dim x As Integer
+ For x = 0 To 999
+ customerArray.Add(New Customer("Customer" + x.ToString()))
+ Next x
+
+ ' Add orders to each Customer object in the ArrayList.
+ Dim customer1 As Customer
+ For Each customer1 In customerArray
+ Dim y As Integer
+ For y = 0 To 14
+ customer1.CustomerOrders.Add(New Order("Order" + y.ToString()))
+ Next y
+ Next customer1
+
+ ' Display a wait cursor while the TreeNodeAdvs are being created.
+ Cursor.Current = New Cursor("C:\Cursors\MyWait.cur")
+
+ ' Clear the TreeViewAdv each time the method is called.
+ treeViewAdv1.Nodes.Clear()
+
+ ' Add a root TreeNodeAdv for each Customer object in the ArrayList.
+ Dim customer2 As Customer
+ For Each customer2 In customerArray
+ treeViewAdv1.Nodes.Add(New TreeNodeAdv(customer2.CustomerName))
+
+ ' Add a child TreeNodeAdv for each Order object in the current Customer object.
+ Dim order1 As Order
+ For Each order1 In customer2.CustomerOrders
+ treeViewAdv1.Nodes(customerArray.IndexOf(customer2)).Nodes.Add( _
+ New TreeNodeAdv(customer2.CustomerName + "." + order1.OrderID))
+ Next order1
+ Next customer2
+
+ ' Reset the cursor to the default for all controls.
+ Cursor.Current = System.Windows.Forms.Cursors.Default
+
+ ' Begin repainting the TreeView.
+ treeViewAdv1.EndUpdate()
+ End Sub 'FillMyTreeView
+
+ You can also use the
Note that setting this property will fire the
+ treeNodeAdv.NodeStyle.CheckState = CheckState.Checked;
+
+
+ treeNodeAdv.NodeStyle.CheckState = CheckState.Checked
+
+ Any Object derived type may be assigned to this property. If this property is + being set through the Windows Forms designer, only text may be assigned.
+When the tree node is cloned, if this object is cloneable (implements ICloneable + interface) then it will be.
+You can also use the more flexible
The path consists of the labels of all of the tree nodes that must be
+ navigated to get to this tree node, starting at the root tree node. The node
+ labels are separated by the delimiter character specified in the
+
This collection contains references to all selected nodes in the TreeViewAdv.
+ Adding a
Whenever a node is selected/deselected, either by user action or in code, + it is automatically added/removed from the SelectedNodes collection.
+This collection is read-only, which means you can add and remove elements but cannot change + the existing elements.
+You can listen to new selections being added to this collection using the collection's
+
The CollapseAll method collapses all the
The state of a TreeNodeAdv persists. For example, suppose that + a parent tree node is expanded. If the child tree nodes were not + previously collapsed, they will appear in their previously-expanded + state. Calling the CollapseAll method ensures that all the tree nodes + appear in the collapsed state.
+The ExpandAll method expands all the
The CancelEditMode method cancels the edit mode when the node is in the EditingMode.
+
+ private void button1_Click(object sender, System.EventArgs e)
+ {
+ //Call the tree control's "GetNodeCount" method with true to
+ //get the total number of nodes in the tree
+ int TotalNodesInTree = this.treeViewAdv1.GetNodeCount( true );
+ MessageBox.Show( "Total nodes in tree = " + TotalNodesInTree.ToString());
+ }
+ //Add nodes
+ private void button2_Click(object sender, System.EventArgs e)
+ {
+ this.treeViewAdv1.SelectedNode.Nodes.Add(new TreeNodeAdv());
+ }
+ //Remove nodes
+ private void button3_Click(object sender, System.EventArgs e)
+ {
+ this.treeViewAdv1.SelectedNode.Parent.Nodes.Remove(this.treeViewAdv1.SelectedNode);
+ }
+
+
+ Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
+ ' Call the tree control's "GetNodeCount" method with true to
+ ' get the total number of nodes in the tree
+ Dim TotalNodesInTree As Integer = Me.treeViewAdv1.GetNodeCount(True)
+ MessageBox.Show("Total nodes in tree = " & TotalNodesInTree.ToString())
+ End Sub
+ 'Add nodes
+ Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
+ Me.treeViewAdv1.SelectedNode.Nodes.Add(New TreeNodeAdv())
+ End Sub
+ 'Remove nodes
+ Private Sub button3_Click(ByVal sender As Object, ByVal e As System.EventArgs)
+ Me.treeViewAdv1.SelectedNode.Parent.Nodes.Remove(Me.treeViewAdv1.SelectedNode)
+ End Sub
+
+ The Item property in the argument is an array of TreeViewAdv nodes that + are currently selected.
++ You can choose to initiate an ole drag-and-drop operation in this event handler. +
+
+ // TreeViewAdv.ItemDrag event listener
+ private void treeViewAdv1_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
+ {
+ // Begin a drag and drop operation of the selected nodes (or some other data).
+ TreeNodeAdv[] nodes = e.Item as TreeNodeAdv[];
+ DragDropEffects result = this.DoDragDrop(nodes, DragDropEffects.Copy | DragDropEffects.Move);
+ // more application logic based on result...
+ }
+
+
+ ' TreeViewAdv.ItemDrag event listener
+ Private Sub treeViewAdv1_ItemDrag(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles treeViewAdv2.ItemDrag
+ ' Begin a drag and drop operation of the selected nodes (or some other data).
+ Dim nodes As TreeNodeAdv() = CType(e.Item, TreeNodeAdv())
+ Dim result As DragDropEffects = Me.DoDragDrop(nodes, DragDropEffects.Copy Or DragDropEffects.Move)
+ ' more application logic based on result...
+ End Sub 'treeViewAdv1_ItemDrag '
+
+
+ If SortWithChildNodes property is set to true,the user can sort all the nodes including all the child nodes in the treeViewAdv.
+ The SortOrder of the Root should be specified for the sorting all nodes.
+ //Sorts only the root nodes.
+ private void button1_Click(object sender, System.EventArgs e)
+ {
+ this.treeViewAdv1.Nodes.Sort();
+ }
+ //Sort all the root nodes and the child nodes in the TreeviewAdv
+ private void button2_Click_1(object sender, System.EventArgs e)
+ {
+ this.treeViewAdv1.Root.SortOrder=SortOrder.Ascending;
+ this.treeViewAdv1.SortWithChildNodes=true;
+ this.treeViewAdv1.Root.Sort();
+ }
+
+
+ 'Sorts only the root nodes.
+ Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
+ Me.treeViewAdv1.Nodes.Sort()
+ End Sub
+ 'Sort all the root nodes and the child nodes in the TreeviewAdv
+ Private Sub button2_Click_1(ByVal sender As Object, ByVal e As System.EventArgs)
+ Me.treeViewAdv1.Root.SortOrder=SortOrder.Ascending
+ Me.treeViewAdv1.SortWithChildNodes=True
+ Me.treeViewAdv1.Root.Sort()
+ End Sub
+
+
+ TreeViewPrintDocument printDocument = new TreeViewPrintDocument(this.treeViewAdv1);
+ printDocument.Print();
+
+ Use the following code for print preview:
+
+ TreeViewPrintDocument printDocument = new TreeViewPrintDocument(this.treeViewAdv1);
+ printDocument.PrintPreview();
+
+ Use this class (will be referred to as "tracker" below) only when you want to support dropping adjacent (above or below) to a node.
+ Otherwise simply listen to the
+ The usage semantics for the tracker is as follows: +
+
+ By default (when value is negative), the top 1/3 of the node will be considered the top edge.
+ This value will be used when you allow dropping before a node using
+ the
+ By default (when value is negative), the bottom 1/3 of the node will be considered the bottom edge.
+ This value will be used when you allow dropping below a node using the
+
The specified Label, if not a child of the BannerPanel will then be made a + child of the BannerPanel.
+The specified Label, if not a child of the BannerPanel will then be made a + child of the BannerPanel.
+
+ XPTaskBarBox taskBarBox1 = new XPTaskBarBox();
+ taskBarBox1.HeaderBackColor = Color.Blue;
+ taskBarBox1.ImageList = this.imageList1;
+ taskBarBox1.Text = "Header Text";
+ taskBarBox1.ItemBackColor = Color.WhiteSmoke;
+ taskBarBox1.Items.Add(new XPTaskBarItem("Item 1", Color.Black, 0, "Tag1"));
+ taskBarBox1.Items.Add(new XPTaskBarItem("Item 2", Color.Black, 0, "Tag2"));
+ taskBarBox1.ItemClick += new XPTaskBarItemClickHandler(xpTaskBarBox_ItemClick);
+ XPTaskBarBox taskBarBox2 = new XPTaskBarBox();
+ taskBarBox2.HeaderBackColor = Color.Blue;
+ taskBarBox2.ImageList = this.imageList1;
+ taskBarBox2.Text = "Another Header Text";
+ taskBarBox2.ItemBackColor = Color.WhiteSmoke;
+ taskBarBox2.Items.Add(new XPTaskBarItem("Item 3", Color.Black, 0, "Tag3"));
+ taskBarBox2.ItemClick += new XPTaskBarItemClickHandler(this.xpTaskBarBox_ItemClick);
+ this.xpTaskBar1.Controls.Add(taskBarBox1);
+ this.xpTaskBar1.Controls.Add(taskBarBox2);
+ Dim taskBarBox1 As XPTaskBarBox
+ taskBarBox1 = New XPTaskBarBox()
+ taskBarBox1.HeaderBackColor = Color.Blue
+ taskBarBox1.ImageList = Me.imageList1
+ taskBarBox1.Text = "Header Text"
+ taskBarBox1.ItemBackColor = Color.WhiteSmoke
+ taskBarBox1.Items.Add(New XPTaskBarItem("Item 1", Color.Black, 0, "Tag1"))
+ taskBarBox1.Items.Add(New XPTaskBarItem("Item 2", Color.Black, 0, "Tag2"))
+ AddHandler taskBarBox1.ItemClick, New XPTaskBarItemClickHandler(AddressOf taskMenuBox_ItemClick)
+ Dim taskBarBox2 As XPTaskBarBox
+ taskBarBox2 = New XPTaskBarBox()
+ taskBarBox2.HeaderBackColor = Color.Blue
+ taskBarBox2.ImageList = Me.imageList1
+ taskBarBox2.Text = "Another Header Text"
+ taskBarBox2.ItemBackColor = Color.WhiteSmoke
+ taskBarBox2.Items.Add(New XPTaskBarItem("Item 3", Color.Black, 0, "Tag3"))
+ AddHandler taskBarBox2.ItemClick, New XPTaskBarItemClickHandler(AddressOf taskMenuBox_ItemClick)
+ Me.xpTaskBar1.Controls.Add(taskBarBox1)
+ Me.xpTaskBar1.Controls.Add(taskBarBox2)Call this method whenever you want to save the current expanded state of + the task bar boxes in the Isolated Storage.
+Note that you do not have to call this method to persist state. You could
+ use the
Call this method whenever you want to save the current expanded state of + the task bar boxes in a custom location (instead of the default Isolated Storage).
+Note that you do not have to call this method to persist state. You could
+ use the
Call this method whenever you want to load the saved expanded states of + the task bar boxes from the Isolated Storage.
+Note that you do not have to call this method to persist state. You could
+ use the
Call this method whenever you want to load the saved expanded states of + the task bar boxes from a specific location.
+Note that you do not have to call this method to persist state. You could
+ use the
When this property is true, the expanded states of the child task bar boxes are + cached as the users expands/collapses them and when this control is disposed, the cached + state is persisted in the Isolated Storage.
++ When the application loads again and when child task bar boxes are added to this control, + the saved state is reapplied on the task bar boxes. +
++ State is saved in the Isolated Storage of the system, scoped by the current user identity. +
+You can also optionally, explicitly control the persistent store and/or
+ the time of persistence using explicit calls to
+ private void xpTaskBarBox_ProvideHeaderBackgroundBrush(object sender, Syncfusion.Windows.Forms.Tools.ProvideBrushEventArgs args)
+ {
+ // Blend settings
+ float[] relativeIntensities = {0.0f, 0.0f, 1.0f};
+ float[] relativePositions = {0.0F, 0.5f, 1.0F};
+ Blend blend = new Blend();
+ blend.Factors = relativeIntensities;
+ blend.Positions = relativePositions;
+
+ XPTaskBarBox box = sender as XPTaskBarBox;
+
+ // Header back brush
+ LinearGradientBrush lgBrush = new LinearGradientBrush(args.Bounds,
+ Color.White, box.HeaderBackColor, 0, true);
+ lgBrush.Blend = blend;
+ args.Brush = lgBrush;
+ }
+
+ private void xpTaskBarBox_ProvideItemsBackgroundBrush(object sender, Syncfusion.Windows.Forms.Tools.ProvideBrushEventArgs args)
+ {
+ // Blend settings
+ float[] relativeIntensities = {0.0f, 0.0f, 1.0f};
+ float[] relativePositions = {0.0F, 0.5f, 1.0F};
+ Blend blend = new Blend();
+ blend.Factors = relativeIntensities;
+ blend.Positions = relativePositions;
+
+ // Items back brush
+ LinearGradientBrush lgBrush = new LinearGradientBrush(args.Bounds,
+ Color.WhiteSmoke, Color.Silver, 91, false);
+ lgBrush.Blend = blend;
+ args.Brush = lgBrush;
+ }
+ Private Sub xpTaskBarBox_ProvideHeaderBackgroundBrush(ByVal sender As Object, ByVal args As ProvideBrushEventArgs)
+
+ ' Blend settings
+ Dim relativeIntensities() As Single
+ relativeIntensities = New Single() {0.0!, 0.0!, 1.0!}
+ Dim relativePositions() As Single
+ relativePositions = New Single() {0.0!, 0.5!, 1.0!}
+ Dim blend As Blend
+ blend = New Blend()
+ blend.Factors = relativeIntensities
+ blend.Positions = relativePositions
+ Dim box As XPTaskBarBox
+ box = CType(sender, XPTaskBarBox)
+ ' Header back brush
+ Dim lgBrush As LinearGradientBrush
+ lgBrush = New LinearGradientBrush(args.Bounds, Color.White, box.HeaderBackColor, 0, True)
+ lgBrush.Blend = blend
+ args.Brush = lgBrush
+
+ End Sub
+ Private Sub xpTaskBarBox_ProvideItemsBackgroundBrush(ByVal sender As Object, ByVal args As ProvideBrushEventArgs)
+
+ ' Blend settings
+ Dim relativeIntensities() As Single
+ relativeIntensities = New Single() {0.0!, 0.0!, 1.0!}
+ Dim relativePositions() As Single
+ relativePositions = New Single() {0.0!, 0.5!, 1.0!}
+ Dim blend As Blend
+ blend = New Blend()
+ blend.Factors = relativeIntensities
+ blend.Positions = relativePositions
+ ' Items back brush
+ Dim lgBrush As LinearGradientBrush
+ lgBrush = New LinearGradientBrush(args.Bounds, Color.WhiteSmoke, Color.Silver, 91, False)
+ lgBrush.Blend = blend
+ args.Brush = lgBrush
+
+ End Sub
+ private void xpTaskBarBox_ProvideHeaderBackgroundBrush(object sender, Syncfusion.Windows.Forms.Tools.ProvideBrushEventArgs args)
+ {
+ // Blend settings
+ float[] relativeIntensities = {0.0f, 0.0f, 1.0f};
+ float[] relativePositions = {0.0F, 0.5f, 1.0F};
+ Blend blend = new Blend();
+ blend.Factors = relativeIntensities;
+ blend.Positions = relativePositions;
+
+ XPTaskBarBox box = sender as XPTaskBarBox;
+
+ // Header back brush
+ LinearGradientBrush lgBrush = new LinearGradientBrush(args.Bounds,
+ Color.White, box.HeaderBackColor, 0, true);
+ lgBrush.Blend = blend;
+ args.Brush = lgBrush;
+ }
+
+ private void xpTaskBarBox_ProvideItemsBackgroundBrush(object sender, Syncfusion.Windows.Forms.Tools.ProvideBrushEventArgs args)
+ {
+ // Blend settings
+ float[] relativeIntensities = {0.0f, 0.0f, 1.0f};
+ float[] relativePositions = {0.0F, 0.5f, 1.0F};
+ Blend blend = new Blend();
+ blend.Factors = relativeIntensities;
+ blend.Positions = relativePositions;
+
+ // Items back brush
+ LinearGradientBrush lgBrush = new LinearGradientBrush(args.Bounds,
+ Color.WhiteSmoke, Color.Silver, 91, false);
+ lgBrush.Blend = blend;
+ args.Brush = lgBrush;
+ }
+ Private Sub xpTaskBarBox_ProvideHeaderBackgroundBrush(ByVal sender As Object, ByVal args As ProvideBrushEventArgs)
+
+ ' Blend settings
+ Dim relativeIntensities() As Single
+ relativeIntensities = New Single() {0.0!, 0.0!, 1.0!}
+ Dim relativePositions() As Single
+ relativePositions = New Single() {0.0!, 0.5!, 1.0!}
+ Dim blend As Blend
+ blend = New Blend()
+ blend.Factors = relativeIntensities
+ blend.Positions = relativePositions
+ Dim box As XPTaskBarBox
+ box = CType(sender, XPTaskBarBox)
+ ' Header back brush
+ Dim lgBrush As LinearGradientBrush
+ lgBrush = New LinearGradientBrush(args.Bounds, Color.White, box.HeaderBackColor, 0, True)
+ lgBrush.Blend = blend
+ args.Brush = lgBrush
+
+ End Sub
+ Private Sub xpTaskBarBox_ProvideItemsBackgroundBrush(ByVal sender As Object, ByVal args As ProvideBrushEventArgs)
+
+ ' Blend settings
+ Dim relativeIntensities() As Single
+ relativeIntensities = New Single() {0.0!, 0.0!, 1.0!}
+ Dim relativePositions() As Single
+ relativePositions = New Single() {0.0!, 0.5!, 1.0!}
+ Dim blend As Blend
+ blend = New Blend()
+ blend.Factors = relativeIntensities
+ blend.Positions = relativePositions
+ ' Items back brush
+ Dim lgBrush As LinearGradientBrush
+ lgBrush = New LinearGradientBrush(args.Bounds, Color.WhiteSmoke, Color.Silver, 91, False)
+ lgBrush.Blend = blend
+ args.Brush = lgBrush
+
+ End Sub
+ private void xpTaskBarBox_ItemClick(object sender, Syncfusion.Windows.Forms.Tools.XPTaskBarItemClickArgs e)
+ {
+ this.aboutDrawingLabel.BorderStyle = BorderStyle.None;
+ this.aboutLable.BorderStyle = BorderStyle.None;
+ this.aboutItemsLabel.BorderStyle = BorderStyle.None;
+
+ switch(e.XPTaskBarItem.Tag as string)
+ {
+ case "about":
+ this.aboutLable.BorderStyle = BorderStyle.FixedSingle;
+ break;
+ case "about items":
+ this.aboutItemsLabel.BorderStyle = BorderStyle.FixedSingle;
+ break;
+ case "about drawing":
+ this.aboutDrawingLabel.BorderStyle = BorderStyle.FixedSingle;
+ break;
+ case "aboutSyncfusion":
+ this.ShowAboutDialog();
+ break;
+ }
+ }
+ Private Sub xpTaskBarBox_ItemClick(ByVal sender As Object, ByVal e As XPTaskBarItemClickArgs)
+
+ Me.aboutDrawingLabel.BorderStyle = BorderStyle.None
+ Me.aboutLable.BorderStyle = BorderStyle.None
+ Me.aboutItemsLabel.BorderStyle = BorderStyle.None
+ Select Case CType(e.XPTaskBarItem.Tag, String)
+ Case "about"
+ Me.aboutLable.BorderStyle = BorderStyle.FixedSingle
+ 'End Section
+ Case "about items"
+ Me.aboutItemsLabel.BorderStyle = BorderStyle.FixedSingle
+ 'End Section
+ Case "about drawing"
+ Me.aboutDrawingLabel.BorderStyle = BorderStyle.FixedSingle
+ 'End Section
+ Case "aboutSyncfusion"
+ Me.ShowAboutDialog()
+ 'End Section
+ End Select
+
+ End Sub+ The Essential Tools CommandBars framework implements a hosting environment that can be used for + creating toolbars, statusbars and rebars similar to those that are present + in the Microsoft Visual Studio.NET IDE and the Microsoft Office XP product suite. + A CommandBar, similar to Win32/MFC control bars, is purely a container control that + is responsible only for it's layout state and it is the client window, such as a ToolBar, + StatusBar or any other Windows Forms control, that provides the CommandBar with it's + functional identity. +
+CommandBars have two basic states - a docked state and a floating state. + In the docked state, the CommandBars are usually aligned along one of the borders + (left, right, top or bottom) of the host form. Depending upon the preferences set, + the bar can either take up an entire row as in the case of a menu or share it's + space with other bars within a particular row as with toolbars and rebars. By default, + a docked CommandBar has a gripper and a drop-down button with a customizable click event. + The gripper can be used to reposition the bar within a row, move it between rows and to drag + it out of the frame and float as a separate window. In the docked mode, when the row + width is adequate, the CommandBars are usually sized to their maximum length. However, + reducing the frame width/height will, based on the user-setting, force the CommandBar to + reduce in size while retaining the same height or wrap thereby increasing the bar height. + The wrapping mode is particularly useful for toolbars and is fully customizable. + In the floating state, the CommandBar is parented by a floating window + that can dragged around the desktop. A floating CommandBar can be redocked to it's host + by either double-clicking it or by dragging it over one of the edges of the host form. +
+
+ The CommandBarController class, as the name implies, serves as a form-scope controller for all the CommandBars.
+ Attributes that are common across all CommandBars within a host form, such as the
+
+ private void InitializeCommandBars()
+ {
+ // Create the CommandBarController
+ this.commandBarController1 = new Syncfusion.Windows.Forms.Tools.CommandBarController();
+ ((System.ComponentModel.ISupportInitialize)(this.commandBarController1)).BeginInit();
+
+ // Set the CommandBarController's host form
+ this.commandBarController1.HostForm = this;
+ this.commandBarController1.PersistState = true;
+
+ // Create the CommandBar control
+ this.commandBarAddress = new Syncfusion.Windows.Forms.Tools.CommandBar();
+
+ // Set the CommandBar Layout/Behavior/Appearance attributes
+ this.commandBarAddress.DockBorder = Syncfusion.Windows.Forms.Tools.DockBorder.Top;
+ this.commandBarAddress.HideDropDownButton = true;
+ this.commandBarAddress.MaxLength = 400;
+ this.commandBarAddress.MinHeight = 26;
+ this.commandBarAddress.MinLength = 50;
+ this.commandBarAddress.Name = "commandBarAddress";
+ this.commandBarAddress.RowIndex = 1;
+ this.commandBarAddress.RowOffset = 1;
+ this.commandBarAddress.Text = "Address";
+
+ // Create the ComboBox control and add it to the CommandBars Controls collection
+ this.comboBox1 = new System.Windows.Forms.ComboBox();
+ this.commandBarAddress.Controls.AddRange(new System.Windows.Forms.Control[] {this.comboBox1});
+
+ // Add the CommandBar to the CommandBarController.CommandBars collection
+ this.commandBarController1.CommandBars.Add(this.commandBarAddress);
+
+ ((System.ComponentModel.ISupportInitialize)(this.commandBarController1)).EndInit();
+ }
+ Private Sub InitializeCommandBars()
+
+ ' Create the CommandBarController
+ Me.commandBarController1 = New Syncfusion.Windows.Forms.Tools.CommandBarController(Me.components)
+ CType(Me.commandBarController1, System.ComponentModel.ISupportInitialize).BeginInit()
+
+ ' Set the CommandBarController's host form
+ Me.commandBarController1.HostForm = Me
+ Me.commandBarController1.PersistState = True
+
+ ' Create the CommandBar control
+ Me.commandBarAddress = New Syncfusion.Windows.Forms.Tools.CommandBar()
+
+ ' Set the CommandBar Layout/Behavior/Appearance attributes
+ Me.commandBarAddress.DockState = Syncfusion.Windows.Forms.Tools.CommandBarDockState.Top
+ Me.commandBarAddress.MaxLength = 400
+ Me.commandBarAddress.MinHeight = 26
+ Me.commandBarAddress.MinLength = 50
+ Me.commandBarAddress.Name = "commandBarAddress"
+ Me.commandBarAddress.RowIndex = 1
+ Me.commandBarAddress.RowOffset = 1
+ Me.commandBarAddress.Text = "Address"
+
+ ' Create the ComboBox control and add it to the CommandBars Controls collection
+ Me.comboBox1 = New System.Windows.Forms.ComboBox()
+ Me.commandBarAddress.Controls.AddRange(New System.Windows.Forms.Control() {Me.comboBox1})
+
+ ' Add the CommandBar to the CommandBarControllers CommandBars // collection
+ Me.commandBarController1.CommandBars.Add(Me.commandBarAddress)
+
+ CType(Me.commandBarController1, System.ComponentModel.ISupportInitialize).EndInit()
+
+ End Sub+ This enumeration has the FlagsAttribute that allows a bitwise combination of its member values. +
++ The CommandBar class is a part of the Essential Tools CommandBars framework and allows + Windows Forms developers to add to their applications dockable command bars similar to + those that are present in the Microsoft Visual Studio.NET and Office XP environments. +
++ The CommandBar, similar to to the MFC/Win32 control bars, is a container control that primarily + serves as a host for some other Windows Forms control. The CommandBar class implements the hosting + and layout logic while the contained control provides the functional significance. +
+
+ See
+ A
+ ControlBars are supported through the XPMenus framework and can be added to any form that has been initialized
+ with a
+ NOTE: The main caption for floating windows is rendered by the Win32 system and cannot be customized. +
++ The Essential Tools Docking Windows framework enables developers to add docking windows, similar + to those found in the Microsoft Visual Studio.NET IDE, to their Windows Forms applications. At the + most basic level a docking window may be defined as a control that attaches itself to a host form's + border, is capable of being dragged around and docked to different edges within the form and can also be + dragged off the host form and floated as an individual top-level window. The docking + framework allows just about any child control on a form to be made into a fully qualified + docking window. The framework, in addition to the core docking interactions, implements + some highly advanced features such as multiple docking levels, nested docking, tabbed docking, + tear-off tabs, autohide mode, state persistence etc. To facilitate the addition of these + complex features, the DockingManager has a full-fledged WYSIWYG visual designer that enables + developers to create the exact docking layout that they desire without having to write a single line of code. +
+The DockingManager class is the central component of the Essential Tools Docking Windows implementation. + The class coordinates and facilitates the multitude of complex interactions that take place between + a dockable control and it's host form as well as between the dockable controls themselves. + DockingManagers are form-centric and adding an instance of the component to a form makes the + form into a 'dock-enabled' host. The DockingManager is implemented as an Extender Provider and + upon adding it to a Form or UserControl, the controls that are immediate children of the container qualify for + the docking services provided by the docking framework. +
+
+ The 'EnableDocking' (
+ NOTE: The layout initialization code shown here is required only when docking window is being used programmatically. + When using the designer, the layout state will automatically be written to the application's resource file. +
+
+ private void InitializeDockingWindows()
+ {
+ // Create the DockingManager instance and set this form as the host form.
+ this.dockingManager = new Syncfusion.Windows.Forms.Tools.DockingManager(this.components);
+ this.dockingManager.BeginInit();
+ this.dockingManager.HostForm = this;
+
+ // Disable state persistence
+ this.dockingManager.PersistState = false;
+ // Enable display of the default context menus
+ this.dockingManager.EnableContextMenu = true;
+ // Set the imagelist that will provide the icons for the docking windows.
+ this.dockingManager.ImageList = this.ilDocking;
+
+ // Dock listbox1 to the left border of the form and with an initial
+ // width of 175 units.
+ // NOTE - Calling DockControl() on a control for the first time,
+ // will initialize it as a docking window. This is the equivalent of
+ // the DockingManager.SetEnableDocking() call.
+ this.dockingManager.DockControl(this.listBox1, this,
+ Syncfusion.Windows.Forms.Tools.Syncfusion.Windows.Forms.Tools.DockingStyle.Left, 175);
+ // Set the text to be displayed in the dockingwindow caption
+ this.dockingManager.SetDockLabel(this.listBox1, "ListBox 1");
+ // The image index used for this control
+ this.dockingManager.SetDockIcon(this.listBox1, 0);
+
+ // Now dock listbox2 as a tab onto listbox1
+ this.dockingManager.DockControl(this.listBox2, this.listBox1,
+ Syncfusion.Windows.Forms.Tools.Syncfusion.Windows.Forms.Tools.DockingStyle.Tabbed, 175);
+ this.dockingManager.SetDockLabel(this.listBox2, "ListBox 2");
+ this.dockingManager.SetDockIcon(this.listBox2, 1);
+
+ // Dock the treeView to the right border of the form with a width of 150.
+ this.dockingManager.DockControl(this.treeView1, this, Syncfusion.Windows.Forms.Tools.DockingStyle.Right, 150);
+ // Set treeView1 to start off in the AutoHide position.
+ this.dockingManager.SetAutoHideMode(this.treeView1, true);
+ this.dockingManager.SetDockLabel(this.treeView1, "TreeView");
+ this.dockingManager.SetDockIcon(this.treeView1, 2);
+
+ // Set checkedListBox1 to be initially in a floating position.
+ Rectangle rcfrm = this.Bounds;
+ this.dockingManager.FloatControl(this.checkedListBox1,
+ new Rectangle(rcfrm.Right+25,rcfrm.Bottom-250,175,300));
+ this.dockingManager.SetDockLabel(this.checkedListBox1, "Checked ListBox");
+ this.dockingManager.SetDockIcon(this.checkedListBox1, 3);
+ this.dockingManager.EndInit();
+ }
+ Private Sub InitializeDockingWindows()
+
+ ' Create the DockingManager instance and set this form as the host form.
+ Me.dockingManager = New Syncfusion.Windows.Forms.Tools.DockingManager(Me.components)
+ Me.dockingManager.BeginInit()
+ Me.dockingManager.HostForm = Me
+
+ ' Disable state persistence
+ Me.dockingManager.PersistState = False
+ ' Enable display of the default context menus
+ Me.dockingManager.EnableContextMenu = True
+ ' Set the imagelist that will provide the icons for the docking windows.
+ Me.dockingManager.ImageList = Me.ilDocking
+
+ ' Dock listbox1 to the left border of the form and with an initial
+ ' width of 175 units.
+ ' NOTE - Calling DockControl() on a control for the first time,
+ ' will initialize it as a docking window. This is the equivalent of
+ ' the DockingManager.SetEnableDocking() call.
+ Me.dockingManager.DockControl(Me.listBox1, Me, Syncfusion.Windows.Forms.Tools.Syncfusion.Windows.Forms.Tools.DockingStyle.Left, 175)
+ ' Set the text to be displayed in the dockingwindow caption
+ Me.dockingManager.SetDockLabel(Me.listBox1, "ListBox 1")
+ ' The image index used for this control
+ Me.dockingManager.SetDockIcon(Me.listBox1, 0)
+
+ ' Now dock listbox2 as a tab onto listbox1
+ Me.dockingManager.DockControl(Me.listBox2, Me.listBox1, Syncfusion.Windows.Forms.Tools.Syncfusion.Windows.Forms.Tools.DockingStyle.Tabbed, 175)
+ Me.dockingManager.SetDockLabel(Me.listBox2, "ListBox 2")
+ Me.dockingManager.SetDockIcon(Me.listBox2, 1)
+
+ ' Dock the treeView to the right border of the form with a width of 150.
+ Me.dockingManager.DockControl(Me.treeView1, Me, Syncfusion.Windows.Forms.Tools.DockingStyle.Right, 150)
+ ' Set treeView1 to start off in the AutoHide position.
+ Me.dockingManager.SetAutoHideMode(Me.treeView1, True)
+ Me.dockingManager.SetDockLabel(Me.treeView1, "TreeView")
+ Me.dockingManager.SetDockIcon(Me.treeView1, 2)
+
+ ' Set checkedListBox1 to be initially in a floating position.
+ Dim rcfrm As Rectangle
+ rcfrm = Me.Bounds
+ Me.dockingManager.FloatControl(Me.checkedListBox1, New Rectangle((rcfrm.Right + 25), (rcfrm.Bottom - 250), 175, 300))
+ Me.dockingManager.SetDockLabel(Me.checkedListBox1, "Checked ListBox")
+ Me.dockingManager.SetDockIcon(Me.checkedListBox1, 3)
+ Me.dockingManager.EndInit()
+
+ End Sub
+ private void dockingManager1_AutoHideAnimationStart(object sender, Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs arg)
+ {
+ if (arg.DockBorder == DockStyle.Left || arg.DockBorder == DockStyle.Right)
+ Syncfusion.Windows.Forms.Tools.DockingManager.AnimationStep = arg.Bounds.Width;
+ else
+ Syncfusion.Windows.Forms.Tools.DockingManager.AnimationStep = arg.Bounds.Height;
+ }
+
+
+ Private Sub DockingManager1_AutoHideAnimationStart(ByVal sender As System.Object, ByVal arg As Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs) Handles DockingManager1.AutoHideAnimationStart
+ If (arg.DockBorder = DockStyle.Left Or arg.DockBorder = DockStyle.Right) Then
+ Syncfusion.Windows.Forms.Tools.DockingManager.AnimationStep = arg.Bounds.Width
+ Else
+ Syncfusion.Windows.Forms.Tools.DockingManager.AnimationStep = arg.Bounds.Height
+ End If
+ End Sub
+
+
+ dockingManager1.LockHostFormUpdate();
+ dockingManager1.LoadDockState();
+ dockingManager1.UnlockHostFormUpdate();
+
+
+ DockingManager1.LockHostFormUpdate()
+ DockingManager1.LoadDockState()
+ DockingManager1.UnlockHostFormUpdate()
+
+
+ //Loading DockState from IsolatedStorage
+ AppStateSErializer appstser=new AppStateSerializer(SerializeMode.IsolatedStorage, null);
+ dockingManager1.LoadDockState(appstser);
+ //Loading DockState from xml file(DockState.xml located in Application folder)
+ AppStateSerializer appstser =new AppStateSerializer(SerializeMode.XMLFile, "DockState");
+ dockingManager1.LoadDockState(appstser);
+
+
+ 'Loading DockState from IsolatedStorage
+ Dim appstser As New AppStateSerializer(SerializeMode.IsolatedStorage, Nothing)
+ dockingManager1.LoadDockState(appstser)
+ 'Loading DockState from xml file(DockState.xml located in Application folder)
+ Dim appstser As New AppStateSerializer(SerializeMode.XMLFile, "DockState")
+ dockingManager1.LoadDockState(appstser)
+
+
+ //Saving DockState to IsolatedStorage
+ AppStateSErializer appstser=new AppStateSerializer(SerializeMode.IsolatedStorage, null);
+ dockingManager1.SaveDockState(appstser);
+ appstser.PersistNow();
+ //Saving DockState to xml file(DockState.xml located in Application folder)
+ AppStateSerializer appstser =new AppStateSerializer(SerializeMode.XMLFile, "DockState");
+ dockingManager1.SaveDockState(appstser);
+ appstser.PersistNow();
+
+
+ 'Saving DockState to IsolatedStorage
+ Dim appstser As New AppStateSerializer(SerializeMode.IsolatedStorage, Nothing)
+ dockingManager1.SaveDockState(appstser)
+ appstser.PersistNow()
+ 'Saving DockState to xml file(DockState.xml located in Application folder)
+ Dim appstser As New AppStateSerializer(SerializeMode.XMLFile, "DockState")
+ dockingManager1.SaveDockState(appstser)
+ appstser.PersistNow()
+
+
+ //Float control panel1 in specified manner.
+ dockingManager1.FloatControl(panel1,new Rectangle(1,1,200,200));
+
+
+ 'Float control panel1 in specified manner.
+ DockingManager1.FloatControl(Panel1,new Rectangle(1,1,200,200))
+
+
+ //Float control panel1 in specified manner.
+ dockingManager1.FloatControl(panel1,new Rectangle(1,1,200,200),true);
+
+
+ 'Float control panel1 in specified manner.
+ DockingManager1.FloatControl(Panel1,new Rectangle(1,1,200,200),true)
+
+
+ //Code to dock a control to left of HostForm with width 100
+ dockingManager1.DockControl(panel1,this,Syncfusion.Windows.Forms.Tools.DockingStyle.Left,100);
+ //Code to dock a control(panel1) to top of another docked control(panel2).
+ dockingManager1.DockControl(panel1,panel2,Syncfusion.Windows.Forms.Tools.DockingStyle.Top,100);//panel1 will take space from panel2 at the top
+ //Code to dock a control(panel1) into another docked control(panel2) in tabbed style
+ dockingManager1.DockControl(panel1,panel2,Syncfusion.Windows.Forms.Tools.DockingStyle.Tabbed,100);
+
+
+ 'Code to dock a control to left side of HostForm with width 100
+ DockingManager1.DockControl(Panel1,this,Syncfusion.Windows.Forms.Tools.DockingStyle.Left,100);
+ 'Code to dock a control(Panel1) to top of another docked control(Panel2).
+ DockingManager1.DockControl(panel1,panel2,Syncfusion.Windows.Forms.Tools.DockingStyle.Top,100);//Panel1 will take space from Panel2 at the top
+ 'Code to dock a control(Panel1) into another docked control(Panel2) in tabbed style
+ DockingManager1.DockControl(Panel1,Panel2,Syncfusion.Windows.Forms.Tools.DockingStyle.Tabbed,100);
+
+
+ //Code to dock a control to left of HostForm with width 100
+ dockingManager1.DockControl(panel1,this,Syncfusion.Windows.Forms.Tools.DockingStyle.Left,100);
+ //Code to dock a control(panel1) to top of another docked control(panel2).
+ dockingManager1.DockControl(panel1,panel2,Syncfusion.Windows.Forms.Tools.DockingStyle.Top,100);//panel1 will take space from panel2 at the top
+ //Code to dock a control(panel1) into another docked control(panel2) in tabbed style
+ dockingManager1.DockControl(panel1,panel2,Syncfusion.Windows.Forms.Tools.DockingStyle.Tabbed,100);
+ //Code to Dock a control(panel1) into another docked control(panel2) in tabbed style with whole tab group
+ dockingManager1.DockControl(panel1,panel2,DockingStyle.Tabbed,150,false);
+
+
+ 'Code to dock a control to left side of HostForm with width 100
+ DockingManager1.DockControl(Panel1,this,Syncfusion.Windows.Forms.Tools.DockingStyle.Left,100);
+ 'Code to dock a control(Panel1) to top of another docked control(Panel2).
+ DockingManager1.DockControl(panel1,panel2,Syncfusion.Windows.Forms.Tools.DockingStyle.Top,100);//Panel1 will take space from Panel2 at the top
+ 'Code to dock a control(Panel1) into another docked control(Panel2) in tabbed style
+ DockingManager1.DockControl(Panel1,Panel2,Syncfusion.Windows.Forms.Tools.DockingStyle.Tabbed,100);
+ 'Code to Dock a control(Panel1) into another docked control(Panel2) in tabbed style with whole tab group
+ DockingManager1.DockControl(Panel1,Panel2,DockingStyle.Tabbed,150,false);
+
+
+ private void dockingManager1_DragAllow(object sender, Syncfusion.Windows.Forms.Tools.DragAllowEventArgs arg){
+ //Check the control which is going to be dragged and cancel according to that
+ if(arg.Control==panel1)
+ arg.Cancel=true;
+ }
+
+
+ Private Sub dockingManager1_DragAllow(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DragAllowEventArgs) Handles dockingManager1.DragAllow
+ 'Check the control which is going to be dragged and cancel according to that
+ If(arg.Control==panel1)Then
+ arg.Cancel=true;
+ EndIf
+ End Sub
+
+
+ private void dockingManager1_DockVisibilityChanging(object sender, Syncfusion.Windows.Forms.Tools.DockVisibilityChangingEventArgs arg){
+ //Check the control and cancel closing.
+ if (arg.Control == panel1)
+ arg.Cancel = true;
+ }
+
+
+ Private Sub dockingManager1_DockVisibilityChanging(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockContextMenuEventArgs) Handles dockingManager1.DockVisibilityChanging
+ 'Check the control and cancel closing.
+ if (arg.Control == Panel1) Then
+ arg.Cancel = true;
+ End If
+ End Sub
+
+
+ private void dockingManager1_AutoHideAnimationStart(object sender, Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs arg)
+ {
+ if (arg.DockBorder == DockStyle.Left || arg.DockBorder == DockStyle.Right)
+ Syncfusion.Windows.Forms.Tools.DockingManager.AnimationStep = arg.Bounds.Width;
+ else
+ Syncfusion.Windows.Forms.Tools.DockingManager.AnimationStep = arg.Bounds.Height;
+ }
+
+
+ Private Sub DockingManager1_AutoHideAnimationStart(ByVal sender As System.Object, ByVal arg As Syncfusion.Windows.Forms.Tools.AutoHideAnimationEventArgs) Handles DockingManager1.AutoHideAnimationStart
+ If (arg.DockBorder = DockStyle.Left Or arg.DockBorder = DockStyle.Right) Then
+ Syncfusion.Windows.Forms.Tools.DockingManager.AnimationStep = arg.Bounds.Width
+ Else
+ Syncfusion.Windows.Forms.Tools.DockingManager.AnimationStep = arg.Bounds.Height
+ End If
+ End Sub
+
+
+ private void docMgr_DockContextMenu(object sender, Syncfusion.Windows.Forms.Tools.DockContextMenuEventArgs arg){
+ //Checking the control and assigning an empty menu
+ if (arg.Owner == panel1)
+ arg.ContextMenu = new Syncfusion.Windows.Forms.Tools.XPMenus.PopupMenu();
+ }
+
+
+ Private Sub dockingManager1_DockContextMenu(ByVal sender As Object, ByVal arg As Syncfusion.Windows.Forms.Tools.DockContextMenuEventArgs) Handles dockingManager1.DockContextMenu
+ 'Checking the control and assigning an empty menu
+ If (arg.Owner == panel1) Then
+ arg.ContextMenu = new Syncfusion.Windows.Forms.Tools.XPMenus.PopupMenu()
+ End If
+ End Sub
+
+
+ private void dockingManager1_NewDockStateEndLoad(object sender, EventArgs e)
+ {
+ DockStateLoadEventArgs dsle = (DockStateLoadEventArgs)e;
+ Console.WriteLine(dsle.LoadResult.ToString());
+ }
+
+
+ Private Sub DockingManager_NewDockStateEndLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles DockingManager.NewDockStateEndLoad
+ Dim dsle As DockStateLoadEventArgs = CType(e, DockStateLoadEventArgs)
+ Console.WriteLine(dsle.LoadResult)
+ End Sub
+
+
+ void dockingManager1_ProvideGraphicsItems(object sender, Syncfusion.Windows.Forms.Tools.ProvideGraphicsItemsEventArgs arg)
+ {
+ if (arg.Control == panel1) //Checks if the control is panel1
+ {
+ if (arg.IsActiveCaption)//Different drawing for active and inactive states
+ {
+ arg.CaptionBackground = Brushes.Blue;
+ arg.CaptionFont = new Font("Times New Roman", 10);
+ arg.CaptionForeground = Color.White;
+ }
+ else{
+ arg.CaptionBackground = Brushes.Gray;
+ arg.CaptionFont = new Font("Times New Roman", 10);
+ arg.CaptionForeground = Color.White;
+ }
+ }
+ }
+
+
+ Private Sub DockingManager1_ProvideGraphicsItems(ByVal sender As System.Object, ByVal arg As Syncfusion.Windows.Forms.Tools.ProvideGraphicsItemsEventArgs) Handles DockingManager1.ProvideGraphicsItems
+ If arg.Control Is Panel1 Then ' Checks if the control is panel1
+ If arg.IsActiveCaption then 'Different drawing for active and inactive states
+ arg.CaptionBackground = Brushes.Blue
+ arg.CaptionFont = New Font("Times New Roman", 10)
+ arg.CaptionForeground = Color.White
+ Else
+ arg.CaptionBackground = Brushes.Gray
+ arg.CaptionFont = New Font("Times New Roman", 10)
+ arg.CaptionForeground = Color.White
+ End If
+ End If
+ End Sub
+
+
+ dockingManager1.BrowsingKey = Keys.F10;
+ dockingManager1.BrowsingKey=((System.Windows.Forms.Keys)(Enum.Parse(typeof(Keys), "F12, Shift, Control"))); //This will set Ctrl+Shift+F12 as browsing key
+
+
+ DockingManager1.BrowsingKey = Keys.F10
+ Me.DockingManager1.BrowsingKey = CType(Enum.Parse(typeof(Keys), "F12, Shift, Control"),System.Windows.Forms.Keys) 'This will set Ctrl+Shift+F12 as browsing key
+
+
+ IEnumerator ienum = this.dockingManager1.Controls;
+ ArrayList dockedctrls = new ArrayList();
+ while(ienum.MoveNext())
+ dockedctrls.Add(ienum.Current);
+ foreach(Control ctrl in dockedctrls)
+ Console.WriteLine(ctrl.ToString());
+
+
+ Dim ienum As IEnumerator = Me.dockingManager1.Controls
+ Dim dockedctrls As ArrayList = New ArrayList()
+ Do While ienum.MoveNext()
+ dockedctrls.Add(ienum.Current)
+ Loop
+ Dim ctrl As Control
+ For Each ctrl In dockedctrls
+ Console.WriteLine(ctrl.ToString())
+ Next
+
+
+ The DockToFill option should not be set when the host form is an MDIContainer or if it contains an instance of the
+
+ NOTE: This property applies only when the DockingManager is hosted, either directly or indirectly through a ContainerControl, in an MDI child form. +
++ NOTE: This property applies only when the DockingManager is hosted in a ContainerControl. +
++ NOTE: The DockingClientPanel should not be used in MDIContainer forms as the equivalent functionality is provided by + the MDIClient window. +
+
+ this.tabbedMDIManager = new TabbedMDIManager();
+ this.tabbedMDIManager.AttachToMdiContainer(this);
+
+ Me.tabbedMDIManager = New TabbedMDIManager()
+ Me.tabbedMDIManager.AttachToMdiContainer(Me)
+
+ // Append menus to the standard mdi tab context menu
+ ParentBarItem contextMenuItem = new ParentBarItem();
+ BarItem newDocItem = new BarItem();
+ newDocItem.Click += new System.EventHandler(this.addDoc1_Click);
+ newDocItem.Text = "Custom Item: Insert New Doc";
+ newDocItem.MergeOrder = 30;
+ contextMenuItem.Items.Add(newDocItem);
+ BarItem exitItem = new BarItem();
+ exitItem.Click += new System.EventHandler(this.FileExit_Clicked);
+ exitItem.Text = "CustomItem: Exit";
+ exitItem.MergeOrder = 30;
+ contextMenuItem.Items.Add(exitItem);
+ contextMenuItem.BeginGroupAt(newDocItem);
+ // Items in this ParentBarItem will be merged with the standard context menu ParentBarItem of the mdi tab.
+ tabbedMDIManager.ContextMenuItem = contextMenuItem;
+ ' Append menus to the standard mdi tab context menu
+ Dim contextMenuItem As ParentBarItem
+ contextMenuItem = New ParentBarItem()
+ Dim newDocItem As BarItem
+ newDocItem = New BarItem()
+ AddHandler newDocItem.Click, New System.EventHandler(AddressOf addDoc1_Click)
+ newDocItem.Text = "Custom Item: Insert New Doc"
+ newDocItem.MergeOrder = 30
+ contextMenuItem.Items.Add(newDocItem)
+ Dim exitItem As BarItem
+ exitItem = New BarItem()
+ AddHandler exitItem.Click, New System.EventHandler(AddressOf FileExit_Clicked)
+ exitItem.Text = "CustomItem: Exit"
+ exitItem.MergeOrder = 30
+ contextMenuItem.Items.Add(exitItem)
+ contextMenuItem.BeginGroupAt(newDocItem)
+ ' Items in this ParentBarItem will be merged with the standard context menu ParentBarItem of the mdi tab.
+ tabbedMDIManager.ContextMenuItem = contextMenuItem
+ foreach(Form form in this.tabbedMDIManager.MdiChildren)
+ {
+ children += form.Text + "\r\n";
+ }
+ Dim form As Form
+ For Each form In Me.tabbedMDIManager.MdiChildren
+ ' Process form
+ Next
+ public MainForm() {
+ //
+ // Required for Windows Form Designer support
+ //
+ InitializeComponent();
+ tabbedMDIManager = new TabbedMDIManager();
+ //tabbedMDIManager.UseIconsInTabs = false;
+ //Add Window Menu
+ this.miWindow = mainMenu.MenuItems.Add("Window");
+ miWindow.MergeOrder = 10;
+ miWindow.MenuItems.Add("Cascade", new System.EventHandler(this.WindowCascade_Clicked));
+ miWindow.MenuItems.Add("Tile Horizontal", new System.EventHandler(this.WindowTileH_Clicked));
+ miWindow.MenuItems.Add("Tile Vertical", new System.EventHandler(this.WindowTileV_Clicked));
+ miWindow.MenuItems.Add("MDI Tabbed", new System.EventHandler(this.TabbedWindows_Clicked));
+ // Let the TabbedMDIManager insert the Mdi Child windows list
+ this.tabbedMDIManager.MdiListMenuItem = miWindow;
+
+ // Append menus to the standard mdi tab context menu
+ ParentBarItem contextMenuItem = new ParentBarItem();
+ BarItem newDocItem = new BarItem();
+ newDocItem.Click += new System.EventHandler(this.addDoc1_Click);
+ newDocItem.Text = "Custom Item: Insert New Doc";
+ newDocItem.MergeOrder = 30;
+ contextMenuItem.Items.Add(newDocItem);
+ BarItem exitItem = new BarItem();
+ exitItem.Click += new System.EventHandler(this.FileExit_Clicked);
+ exitItem.Text = "CustomItem: Exit";
+ exitItem.MergeOrder = 30;
+ contextMenuItem.Items.Add(exitItem);
+ contextMenuItem.BeginGroupAt(newDocItem);
+ // Items in this ParentBarItem will be merged with the standard context menu ParentBarItem of the mdi tab.
+ tabbedMDIManager.ContextMenuItem = contextMenuItem;
+ }
+ // Convenient way to toggle TabbedMDI mode.
+ private bool TabbedMDIOn
+ {
+ get { return this.tabWindowsOn; }
+ set
+ {
+ if(!(this.tabWindowsOn == value))
+ {
+ this.tabWindowsOn = value;
+ if(this.tabWindowsOn)
+ {
+ this.tabbedMDIManager.AttachToMdiContainer(this);
+ }
+ else
+ {
+ this.tabbedMDIManager.DetachFromMdiContainer(this, false); // false to not invoke the Cascade mode after detaching.
+ }
+ }
+ }
+ }
+ //Add a document
+ private void AddDocument(Form doc) {
+ doc.MdiParent = this;
+ doc.Show();
+ }
+ private void MainForm_Load(object sender, System.EventArgs e)
+ {
+ // Add 4 documents
+ this.addDoc1_Click(this, EventArgs.Empty);
+ this.addDoc1_Click(this, EventArgs.Empty);
+ this.addDoc1_Click(this, EventArgs.Empty);
+ this.addDoc1_Click(this, EventArgs.Empty);
+ // Turn on MDI Tabbed Documents mode.
+ // Call this after loading the mdi children to restore their previous state.
+ this.TabbedMDIOn = true;
+ }
+ private int document1Count = 0 ;
+ private void addDoc1_Click(object sender, System.EventArgs e)
+ {
+ document1Count++ ;
+ Document1 doc = new Document1("DocumentOne " + document1Count.ToString());
+ AddDocument(doc);
+ }
+ //Window->Cascade Menu item handler
+ protected void WindowCascade_Clicked(object sender, System.EventArgs e) {
+ this.TabbedMDIOn = false;
+ this.LayoutMdi(MdiLayout.Cascade);
+ }
+ Public Sub New()
+ MyBase.New()
+ '
+ ' Required for Windows Form Designer support
+ '
+ InitializeComponent()
+ tabbedMDIManager = New TabbedMDIManager()
+ 'tabbedMDIManager.UseIconsInTabs = false;
+ 'Add Window Menu
+ Me.miWindow = mainMenu.MenuItems.Add("Window")
+ miWindow.MergeOrder = 10
+ miWindow.MenuItems.Add("Cascade", New System.EventHandler(AddressOf WindowCascade_Clicked))
+ miWindow.MenuItems.Add("Tile Horizontal", New System.EventHandler(AddressOf WindowTileH_Clicked))
+ miWindow.MenuItems.Add("Tile Vertical", New System.EventHandler(AddressOf WindowTileV_Clicked))
+ miWindow.MenuItems.Add("MDI Tabbed", New System.EventHandler(AddressOf TabbedWindows_Clicked))
+
+ ' Let the TabbedMDIManager insert the Mdi Child windows list
+ Me.tabbedMDIManager.MdiListMenuItem = miWindow
+
+ ' Append menus to the standard mdi tab context menu
+ Dim contextMenuItem As ParentBarItem
+ contextMenuItem = New ParentBarItem()
+ Dim newDocItem As BarItem
+ newDocItem = New BarItem()
+ AddHandler newDocItem.Click, New System.EventHandler(AddressOf addDoc1_Click)
+ newDocItem.Text = "Custom Item: Insert New Doc"
+ newDocItem.MergeOrder = 30
+ contextMenuItem.Items.Add(newDocItem)
+ Dim exitItem As BarItem
+ exitItem = New BarItem()
+ AddHandler exitItem.Click, New System.EventHandler(AddressOf FileExit_Clicked)
+ exitItem.Text = "CustomItem: Exit"
+ exitItem.MergeOrder = 30
+ contextMenuItem.Items.Add(exitItem)
+ contextMenuItem.BeginGroupAt(newDocItem)
+ ' Items in this ParentBarItem will be merged with the standard context menu ParentBarItem of the mdi tab.
+ tabbedMDIManager.ContextMenuItem = contextMenuItem
+ End Sub
+ ' Convenient way to toggle TabbedMDI mode.
+ Property TabbedMDIOn() As Boolean
+ Get
+ Return Me.tabWindowsOn
+ End Get
+ Set(ByVal Value As Boolean)
+ If (Not (Me.tabWindowsOn = Value)) Then
+ Me.tabWindowsOn = Value
+ If Me.tabWindowsOn Then
+ Me.tabbedMDIManager.AttachToMdiContainer(Me)
+ Else
+ Me.tabbedMDIManager.DetachFromMdiContainer(Me, False)
+ End If
+ End If
+ End Set
+ End Property
+ Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
+ MyBase.Dispose(disposing)
+ If (Not (components) Is Nothing) Then
+ components.Dispose()
+ End If
+ End Sub
+ Private Sub AddDocument(ByVal doc As Form)
+ doc.MdiParent = Me
+ doc.Show()
+ End Sub
+ Private Sub MainForm_Load(ByVal sender As Object, ByVal e As EventArgs)
+ ' Add 4 documents
+ Me.addDoc1_Click(Me, EventArgs.Empty)
+ Me.addDoc1_Click(Me, EventArgs.Empty)
+ Me.addDoc1_Click(Me, EventArgs.Empty)
+ Me.addDoc1_Click(Me, EventArgs.Empty)
+ ' Turn on MDI Tabbed Documents mode.
+ ' Call this after loading the mdi children to restore their previous state.
+ Me.TabbedMDIOn = True
+ End Sub
+ Private Sub addDoc1_Click(ByVal sender As Object, ByVal e As EventArgs)
+ document1Count = (document1Count + 1)
+ Dim doc As Document1
+ doc = New Document1(("DocumentOne " + document1Count.ToString))
+ AddDocument(doc)
+ End Sub
+ ' Window->Cascade Menu item handler
+ Protected Sub WindowCascade_Clicked(ByVal sender As Object, ByVal e As EventArgs)
+ Me.TabbedMDIOn = False
+ Me.LayoutMdi(MdiLayout.Cascade)
+ End SubIf a child form's ControlBox property is set to false, then the control box buttons will be drawn + inactive rather than hidden, in accordance with the .NET menus behavior.
+If you want to alter this behavior and instead want the control box to be hidden, set this property + to false.
+
+ private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
+ {
+ if(e.Button != MouseButtons.Right)
+ return;
+
+ PopupMenu popup = new PopupMenu();
+ ParentBarItem parentItem = new ParentBarItem();
+
+ barItem1.Checked = true;
+ barItem1.Click += new EventHandler(ItemClicked);
+ barItem2.Click += new EventHandler(ItemClicked);
+
+ barItem3.Click += new EventHandler(ItemClicked);
+
+ parentItem.Items.Add(barItem1);
+ parentItem.Items.Add(barItem2);
+ parentItem.Items.Add(barItem3);
+
+ popup.ParentBarItem = parentItem;
+ popup.Show(this, new Point(e.X, e.Y));
+ }
+
+
+ private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
+ {
+ PopupMenu popup = new PopupMenu();
+ ParentBarItem parentItem = new ParentBarItem();
+ parentItem.CloseOnClick = false;
+
+ barItem1.Checked = true;
+ barItem1.Click += new EventHandler(ItemClicked);
+ barItem2.Checked = true;
+ barItem2.Click += new EventHandler(ItemClicked);
+
+ barItem3.Checked = true;
+ barItem3.Click += new EventHandler(ItemClicked);
+
+ parentItem.Items.Add(barItem1);
+ parentItem.Items.Add(barItem2);
+ parentItem.Items.Add(barItem3);
+
+ popup.ParentBarItem = parentItem;
+ popup.Show(this, new Point(e.X, e.Y));
+ }
+ private void ItemClicked(object sender, EventArgs e)
+ {
+ BarItem itemClicked = sender as BarItem;
+ itemClicked.Checked = !itemClicked.Checked;
+ }
+
+
+ // Listen to the AfterClone event of the ChildFrameBarManager and
+ // set the cloned BarManager's ImageList and LargeImageList.
+ // This is necessary because cloning an ImageList (il1.ImageStream = il2.ImageStream;) seems to be broken in 1.1.
+ private void childFrameBarManager_AfterClone(object sender, Syncfusion.Windows.Forms.Tools.XPMenus.BarManagerClonedEventArgs args)
+ {
+ System.Resources.ResourceManager resources = new System.Resources.ResourceManager(this.GetType());
+
+ // Load the images from the resource and set it to the ImageLists.
+ // You can typically copy the right-hand side portion of the following statements from the
+ // designer generated code in the InitializeComponent method.
+ // imgList16 and imgList24 are the names of the ImageList instances in this Form.
+ args.ClonedBarManager.ImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgList16.ImageStream")));
+ args.ClonedBarManager.LargeImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgList24.ImageStream")));
+ }
+
+
+ ' Listen to the AfterClone event of the ChildFrameBarManager and
+ ' set the cloned BarManager's ImageList and LargeImageList.
+ ' This is necessary because cloning an ImageList (il1.ImageStream = il2.ImageStream;) seems to be broken in 1.1.
+ Private Sub childFrameBarManager_AfterClone(ByVal sender As Object, ByVal args As Syncfusion.Windows.Forms.Tools.XPMenus.BarManagerClonedEventArgs)
+ Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(Me.GetType())
+
+ ' Load the images from the resource and set it to the ImageLists.
+ ' You can typically copy the right-hand side portion of the following statements from the
+ ' designer generated code in the InitializeComponent method.
+ args.ClonedBarManager.ImageList.ImageStream = (CType((resources.GetObject("imgList16.ImageStream")), System.Windows.Forms.ImageListStreamer))
+ args.ClonedBarManager.LargeImageList.ImageStream = (CType((resources.GetObject("imgList24.ImageStream")), System.Windows.Forms.ImageListStreamer))
+ End Sub
+
+ This is usually called for a
+ This event is provided to workaround a 1.1 framework bug which prevents us from cloning an + ImageList (The code "imageList.ImageStream = anotherImageList.ImageStream" doesn't work in 1.1). +
+
+ Use this method in the context of "Automatic MDI Merging" (see
+ this.popupMenusManager1.SetXPContextMenu(this.richTextBox1, this.popupMenu2);
+
+
+ Me.popupMenusManager1.SetXPContextMenu(Me.richTextBox1, Me.popupMenu2)
+
+ This
+ To use this component, just create it passing the PropertyGrid in the constructor. + The context menu will then start appearing for that PropertyGrid. There is no + design time support for this component. +
+
+ In code, you can initialize an XPToolBar as follows:
+ XPToolBar xpToolBar1;
+ // Create a new tool bar control.
+
+ XPToolBar xptoolbar2 = new XPToolBar();
+ // Add some one or more instances of BarItem to it.
+ xptoolbar2.Items.AddRange(new BarItem[]{this.barItem1, this.barItem2, this.barItem3});
+ // Setup a separator.
+ xptoolbar2.BeginGroupAt(this.barItem2);
+
+ // Set its position and add it to the Form.
+ xptoolbar2.Dock = DockStyle.Top;
+ xptoolbar2.Size = new Size(200, 30);
+ this.Controls.Add(xptoolbar2);
+
+
+ Dim xpToolBar1 As XPToolBar
+ ' Create a new tool bar control.
+ Dim xptoolbar2 As New XPToolBar()
+
+ ' Add some one or more instances of BarItem to it.
+ xptoolbar2.Items.AddRange(New BarItem() {Me.barItem1, Me.barItem2, Me.barItem3})
+ ' Setup a separator.
+ xptoolbar2.BeginGroupAt(Me.barItem2)
+
+ ' Set its position and add it to the Form.
+ xptoolbar2.Dock = DockStyle.Top
+ xptoolbar2.Size = New Size(200, 30)
+ Me.Controls.Add(xptoolbar2)
+
+
+ private void Form_Load(object sender, System.EventArgs e)
+ {
+ this.barControl1.Items.Add(this.barItem1);
+ this.barControl1.Items.Add(this.barItem2);
+ this.barControl1.Items.Add(this.parentBarItem1);
+ }
+
+