using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void toggleTabs(object sender,EventArgs e)
{
PictureBox pctClicked = (PictureBox)sender; //Get the object that called this function
string[] senderPosition = pctClicked.Name.Split('_'; //We want to know what the number is. On the control's name I put an underscore and a number to represent it's position
tabControl1.SelectedIndex = Int32.Parse(senderPosition[1]) - 1; //The tab control has a selected index property so we can tell it what tab to goto with that
}
private void mousein(object sender, EventArgs e)
{
PictureBox pct_mousedIn = (PictureBox)sender;
pct_mousedIn.BackColor = Color.Green;
}
private void mouseOut(object sender, EventArgs e)
{
PictureBox pct_mouseOut = (PictureBox)sender;
pct_mouseOut.BackColor = Color.LimeGreen;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void toggleTabs(object sender,EventArgs e)
{
PictureBox pctClicked = (PictureBox)sender; //Get the object that called this function
string[] senderPosition = pctClicked.Name.Split('_'; //We want to know what the number is. On the control's name I put an underscore and a number to represent it's position
tabControl1.SelectedIndex = Int32.Parse(senderPosition[1]) - 1; //The tab control has a selected index property so we can tell it what tab to goto with that
}
private void mousein(object sender, EventArgs e)
{
PictureBox pct_mousedIn = (PictureBox)sender;
pct_mousedIn.BackColor = Color.Green;
}
private void mouseOut(object sender, EventArgs e)
{
PictureBox pct_mouseOut = (PictureBox)sender;
pct_mouseOut.BackColor = Color.LimeGreen;
}
}
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.