StatusStripコントロールに追加したToolStripStatusLabelはボーダースタイルを変更することができます。
まず、ボーダーを4辺のどこに表示するのかをBorderSidesプロパティで設定し、BorderStyleプロパティでボーダースタイルを設定します。
BorderSidesプロパティではボーダーを上だけに表示したり、4辺すべてに表示するといった設定ができます。
また、BorderStyleプロパティでは窪んだように見せたり浮き出たり見えるように設定することが可能です。
下記は、ボーダースタイルを設定する例です。
VBの例
' フォームロード時の処理 Private Sub Form5_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load '境界線を四辺に表示する ToolStripStatusLabel1.BorderSides = ToolStripStatusLabelBorderSides.All End Sub ' ボーダースタイル変更処理 Private Sub rdoAdjust_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rdoSunkenOuter.CheckedChanged, rdoSunkenInner.CheckedChanged, rdoSunken.CheckedChanged, rdoRaisedOuter.CheckedChanged, rdoRaisedInner.CheckedChanged, rdoRaised.CheckedChanged, rdoFlat.CheckedChanged, rdoEtched.CheckedChanged, rdoBump.CheckedChanged, rdoAdjust.CheckedChanged If rdoAdjust.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.Adjust ToolStripStatusLabel1.Text = "Adjust" ElseIf rdoBump.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.Bump ToolStripStatusLabel1.Text = "Bump" ElseIf rdoEtched.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.Etched ToolStripStatusLabel1.Text = "Etched" ElseIf rdoFlat.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.Flat ToolStripStatusLabel1.Text = "Flat" ElseIf rdoRaised.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.Raised ToolStripStatusLabel1.Text = "Raised" ElseIf rdoRaisedInner.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.RaisedInner ToolStripStatusLabel1.Text = "RaisedInner" ElseIf rdoRaisedOuter.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.RaisedOuter ToolStripStatusLabel1.Text = "RaisedOuter" ElseIf rdoSunken.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.Sunken ToolStripStatusLabel1.Text = "Sunken" ElseIf rdoSunkenInner.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.SunkenInner ToolStripStatusLabel1.Text = "SunkenInner" ElseIf rdoSunkenOuter.Checked = True Then ToolStripStatusLabel1.BorderStyle = Border3DStyle.SunkenOuter ToolStripStatusLabel1.Text = "SunkenOuter" End If End Sub
C#の例
// フォームロード時の処理 private void Form5_Load(object sender, EventArgs e) { // 境界線を四辺に表示する toolStripStatusLabel1.BorderSides = ToolStripStatusLabelBorderSides.All; } // ボーダースタイル変更処理 private void rdoAdjust_CheckedChanged(object sender, EventArgs e) { if (rdoAdjust.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.Adjust; toolStripStatusLabel1.Text = "Adjust"; } else if (rdoBump.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.Bump; toolStripStatusLabel1.Text = "Bump"; } else if (rdoEtched.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.Etched; toolStripStatusLabel1.Text = "Etched"; } else if (rdoFlat.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.Flat; toolStripStatusLabel1.Text = "Flat"; } else if (rdoRaised.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.Raised; toolStripStatusLabel1.Text = "Raised"; } else if (rdoRaisedInner.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.RaisedInner; toolStripStatusLabel1.Text = "RaisedInner"; } else if (rdoRaisedOuter.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.RaisedOuter; toolStripStatusLabel1.Text = "RaisedOuter"; } else if (rdoSunken.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.Sunken; toolStripStatusLabel1.Text = "Sunken"; } else if (rdoSunkenInner.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.SunkenInner; toolStripStatusLabel1.Text = "SunkenInner"; } else if (rdoSunkenOuter.Checked == true) { toolStripStatusLabel1.BorderStyle = Border3DStyle.SunkenOuter; toolStripStatusLabel1.Text = "SunkenOuter"; } }
Please follow and like us:
コメント