如何使用dll中的图像

发布于 2024-10-07 08:40:31 字数 1602 浏览 0 评论 0原文

我有一个自定义的网格视图。 它有一个属性“主题”。 这个属性有一些项目(枚举)可以改变我的gridview的apperacne,例如hedar背景图像,rowstyle,rowcolor等...。 此属性工作正常。但我必须添加一个文件夹(包含图像)来显示标题的背景图像。 我必须为用户(在他们的网站中使用我的 gridview)准备这个文件夹。 我希望用户(程序员)添加我的 dll(gridview)并更改网格的主题,而无需任何额外的工作。 如果您在我的代码中看到我必须通过网站中的 floder 添加背景图像样式引用(ThemeResource/HeaderSoftGamer.png)。自然用户(程序员)必须复制使用我的 gridview 的页面的此文件夹,

 public class MTGridView : GridView
{
    public enum ThemeCollection { HardBlue, Black, Girly , Sky , Samta };
    private ThemeCollection currentTheme;
    public ThemeCollection Theme
    {
        get
        {
            return currentTheme;
        }
        set
        {
            currentTheme = value;
        }

    }
     public MTGridView()
    {
          this.RowCreated += new GridViewRowEventHandler(MTGridView_RowCreated);
    }
     void MTGridView_RowCreated(object sender, GridViewRowEventArgs e)
    {

        switch (Theme)
        {
            case ThemeCollection.Sky:
                {

                    switch (e.Row.RowType)
                    {
                        case DataControlRowType.Header:
                            e.Row.Style.Add("background-color", "blue");
                            e.Row.Style.Add("font-family", "Tahoma");
                            e.Row.Style.Add("font-size", hs.ToString());
                            e.Row.Style.Add("color", "Black");
                            e.Row.Style.Add("background-image", "url(ThemeResource/HeaderSoftGamer.png)");
                         break;
                     }
                   }
              }
     }}

谢谢大家

i have a customized grid view.
it has a property "Theme".
this property has some item (enum) that change apperacne of my gridview such as hedar background image,rowstyle,rowcolor,etc... .
this property work fine.but i must add a folder (contained image) to show background image of header.
i must prepare this folder for users (that use my gridview in their website) .
i want just users(programmers) add my dll(gridview) and change theme of my grid without any additional work.
if you see in my code i must add backgroundimage style refrencde by a floder in web site(ThemeResource/HeaderSoftGamer.png).and naturally users(programmers) must copy this folder of page that use my gridview

 public class MTGridView : GridView
{
    public enum ThemeCollection { HardBlue, Black, Girly , Sky , Samta };
    private ThemeCollection currentTheme;
    public ThemeCollection Theme
    {
        get
        {
            return currentTheme;
        }
        set
        {
            currentTheme = value;
        }

    }
     public MTGridView()
    {
          this.RowCreated += new GridViewRowEventHandler(MTGridView_RowCreated);
    }
     void MTGridView_RowCreated(object sender, GridViewRowEventArgs e)
    {

        switch (Theme)
        {
            case ThemeCollection.Sky:
                {

                    switch (e.Row.RowType)
                    {
                        case DataControlRowType.Header:
                            e.Row.Style.Add("background-color", "blue");
                            e.Row.Style.Add("font-family", "Tahoma");
                            e.Row.Style.Add("font-size", hs.ToString());
                            e.Row.Style.Add("color", "Black");
                            e.Row.Style.Add("background-image", "url(ThemeResource/HeaderSoftGamer.png)");
                         break;
                     }
                   }
              }
     }}

thank all

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水水月牙 2024-10-14 08:40:31

您可以将图像保留在服务器上并从代码中使用它们,也可以提供完整的图像文件夹并要求他们将其包含在他们的项目中。我没有看到解决方法。

You can either keep your images on your server and use them from your code or give the complete image folder and ask them to include it with their project. I don't see a workaround for this..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文