按钮单击选项卡控件将出现在csharp windows应用程序中 [英] button click tab control will come in csharp windows application

查看:76
本文介绍了按钮单击选项卡控件将出现在csharp windows应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击图片按钮时,会出现标签控件

如何在csharp中执行此操作

windows应用程序

When i click image button the tab control will appear
how to do that in csharp
windows application

推荐答案

查看此代码



See this code

public frmForm()
{
     InitializeComponent();
     tabControl1.Appearance = TabAppearance.Buttons;
     tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed;
     tabControl1.DrawItem += new DrawItemEventHandler(tabControl1_DrawItem);
}

private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
{
    //Load the image
    Image img = Image.FromFile(String.Format("{0}\\{1}.jpg",Application.StartupPath,tabControl1.TabPages[e.Index].Name));
    //Resize image
    img = new Bitmap(img, e.Bounds.Size);
    //Draw on Tab Button
    e.Graphics.DrawImage(img, e.Bounds.Location);
}


这篇关于按钮单击选项卡控件将出现在csharp windows应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆