Crystal Reports ViewerのBusinessObjectロゴを消す

Crystal Reports XI R2でWindowsアプリケーションを作成すると、Crystal Reports Viewerの右上に、「BusinessObject」というロゴが表示されます。これ、プロパティーの設定とかじゃ消えないんですね。WEBアプリケーションの方は、プロパティーの設定で消えるみたいなんですけどね。
で、非常に気になるわけです。なんで、BusinessObjectの宣伝しないといけないのかと・・・。

というわけで、コードで消してみることにします。

  1.  private void toolStripButton_Click(object sender, EventArgs e)
  2.          {
  3.              List<system.Windows.Forms.ToolStripLabel> lbls = new List<toolStripLabel>();
  4.              // コントロールオブジェクトに分解
  5.              foreach (Control ctl in crystalReportViewer.Controls)
  6.              {
  7.                  // ツールバーを取得
  8.                  if (ctl.GetType().Equals(typeof(System.Windows.Forms.ToolStrip)))
  9.                  {
  10.                      System.Windows.Forms.ToolStrip strip = (System.Windows.Forms.ToolStrip)ctl;
  11.                      // ツールバーをアイテムに分解
  12.                      foreach (ToolStripItem item in strip.Items)
  13.                      {
  14.                          MessageBox.Show(item.GetType().ToString());//アイテムの名前を列挙 実行時は不要
  15.                          // ラベルを取得
  16.                              if (item.GetType().Equals(typeof(System.Windows.Forms.ToolStripLabel)))
  17.                          {
  18.                            lbls.Add((ToolStripLabel)item);
  19.                          }
  20.                      }
  21.                  }
  22.              }
  23.              // ラベル2個中の、2番目がロゴを表示
  24.                lbls[1].Visible = false;//取りあえず非表示にしてみる
  25.              MessageBox.Show("非表示にしました。");
  26.  }

これを何かのイベントで呼び出せば、ロゴを非表示にできます。違うロゴを表示することはできませんでした。どうしても、BussinesObjectロゴが表示されてしまい、そのイメージに重なって別の指定したイメージが表示されてしまう状態です。解決するには、別のアプローチが必要かも知れない・・・。

まあ、非表示にできたからいいや。

Leave a Reply

XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>