当前位置: 代码迷 >> VB Dotnet >> 请教根据4个多选框new 一个font 一共24种组合,要如何写?24句if else会死人的
  详细解决方案

请教根据4个多选框new 一个font 一共24种组合,要如何写?24句if else会死人的

热度:115   发布时间:2016-04-25 02:11:06.0
请问根据4个多选框new 一个font 一共24种组合,要怎么写?24句if else会死人的。
假设 
我想根据多选框的选择情况 去创建一个新的字体

dim fontstyle
‘已知
fontstyle = 0 ’ 正常字体
fontstyle = 1 ’ 加粗
fontstyle = 2 ’ 倾斜
fontstyle = 3 ’ 中心线
fontstyle = 4 ’ 下划线
fontstyle = 5 ’ 加粗+倾斜
’......................
‘一直到24    ‘ 加粗+倾斜+中心线+下划线
’加上0  一共有25中情况 
dim font = new font(“新宋体”,24,fontstyle)
a = 多选框1(加粗)
b = 多选框2(倾斜)
c = 多选框3(中心线)
d = 多选框4(下划线)
我要怎么根据4个多选框的按钮得出fontstyle的值
大概意思是
case a,b,c,d都没选择
    fontstyle=0
case a选择,b,c,d都没选择
 fontstyle = 1
大概是这意思 我是新手,没有系统的学过,不知道怎么去表达我的意思,希望大家能看明白我想要什么效果  

总之就是根据 多选框的情况 
new 一个新的font 出来
如果有简易办法更好,小弟在此谢过
另外求vb.net分解和合成gif的源码!
------解决思路----------------------

        public enum FontStyle
        {
            Style_One = 1,
            Style_Two = 2,
            Style_Three = 4,
            Style_Four = 16
        }

            FontStyle fontStyle = FontStyle.Style_One 
------解决思路----------------------
 FontStyle.Style_Four;
            if ((fontStyle & FontStyle.Style_One) != 0)
            {
                MessageBox.Show("存在Style_One");
            }
            if ((fontStyle & FontStyle.Style_Four) != 0)
            {
                MessageBox.Show("存在Style_Four");
            }
  相关解决方案