小编dav*_*ove的帖子

无法加载文件或程序集“myApp.XmlSerializers”或其依赖项之一

MyApp 使用从 ActiveX 控件派生的类。在开发盒上一切正常,但在测试盒上,当我在类的实例上调用 CreateControl() 时,我得到了这个。

Could not load file or assembly 'MyApp.XmlSerializers' or one of its dependencies. The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)

我似乎在测试系统上遗漏了一些东西,但我不知道是什么。我尝试在类和对象浏览器中查找“XmlSerializers”,但一无所获。我在工作的开发盒上查找了 MyApp.XmlSerializers.dll,但没有,因此在非工作的测试盒上找不到它并不奇怪。

我该如何追赶这个?

戴夫

.net c# .net-4.5

6
推荐指数
0
解决办法
3699
查看次数

TabControl中宽度相等的选项卡

我在选项卡控件的顶部有4个选项卡.我希望每个标签使用TabControl宽度的25%.

使用XAML这样做的正确方法是什么?

这是我尝试过的:

<Grid  HorizontalAlignment="Left" Height="458" Margin="10,65,0,0" VerticalAlignment="Top" Width="276">
    <TabControl Grid.IsSharedSizeScope="True" HorizontalAlignment="Stretch">
        <TabItem Header="Cameras">
            <Grid Background="#FFE5E5E5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="tabControl"/>
                </Grid.ColumnDefinitions>
            </Grid>
        </TabItem>
        <TabItem Header="MultiCam">
            <Grid Background="#FFE5E5E5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="tabControl"/>
                </Grid.ColumnDefinitions>
            </Grid>
        </TabItem>
        <TabItem Header="Search">
            <Grid Background="#FFE5E5E5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="tabControl"/>
                </Grid.ColumnDefinitions>
            </Grid>
        </TabItem>
        <TabItem Header="Admin" Margin="-2,-2,-10,-1">
            <Grid Background="#FFE5E5E5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="tabControl"/>
                </Grid.ColumnDefinitions>
            </Grid>
        </TabItem>
    </TabControl>
</Grid>
Run Code Online (Sandbox Code Playgroud)

wpf xaml

6
推荐指数
1
解决办法
5506
查看次数

如何从EXE项目中引用类?

我的任务是复活VB6项目,自从我与VB6合作以来已经过了很长时间。

这是我的问题。

项目A是一个ActiveX EXE项目。在同一个项目组中,还有另一个ActiveX EXE项目。项目B。项目B包含clsCommon (clsCommon.cls)项目A需要使用的内容,例如:

Private clsCommonA as ProjectB.clsCommon 
Run Code Online (Sandbox Code Playgroud)

当我尝试将项目B的输出exe(而不是vbp)添加到项目A的引用中时,出现错误 Project 'Project B.vbd' can not be referenced because it's project type is EXE.

有人可以提醒我如何在EXE中引用类吗?(在输出为ActiveX DLL的项目组中的项目中引用类时,我没有遇到任何麻烦)

顺便说一句:我认为这甚至可能仅是因为20年前的某个开发人员显然已经进行了这项工作。

vb6

6
推荐指数
1
解决办法
109
查看次数

在编辑视图中超级简单地实现多选列表框

在这里使用MVC4与EF和CF(严重)

我有一个这样的课:

public class Feature
{
    public int ID { get; set; }
    public string Desc { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

一个像这样:

public class Device   //change to Devices
{
    public int ID { get; set; }
    public string Name { get; set; }
    public virtual ICollection<Feature> Features { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

在Device模型的Edit视图中,我希望有一个ListBox,其中包含Feature模型的所有元素(显示的Desc属性),其中包含预先选择的device.Features集合中包含的那些功能.

然后,当用户在"编辑"视图上单击"保存"时,ListBox中所选项目的当前集合将写回设备的"功能"集合.

对于这个技巧,控制器代码和cshtml是什么样的?

谢谢你的时间,戴夫

ef-code-first asp.net-mvc-4

4
推荐指数
1
解决办法
2万
查看次数

如何将谓词作为参数C#传递

如果没有传递谓词,如何将谓词传递给方法,又如何使谓词起作用?我以为也许是这样,但这似乎并不正确。

private bool NoFilter() { return true; }

private List<thing> GetItems(Predicate<thing> filter = new Predicate<thing>(NoFilter))
{
    return rawList.Where(filter).ToList();
}
Run Code Online (Sandbox Code Playgroud)

c# delegates predicate

4
推荐指数
1
解决办法
7328
查看次数

将 Image.Source 传递给 XAML 样式

我正在尝试实现一个按钮样式,该样式具有使用该样式时指定的图像和标题。

这是我的风格:

<Style x:Key="ButtonStyle" TargetType="Button">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Grid Margin="0,0,0,0" Background="#FF9E9FA3">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Image Source="{TemplateBinding Tag}" Grid.Column="0"/>
                    <Label Content="{TemplateBinding Content}" Grid.Column="1" FontSize="15" VerticalAlignment="Center"/>
                </Grid>             
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)

我这样使用它:

<Button Tag="edit.png" Content="Edit" Style="{StaticResource ButtonStyle}" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button Tag="save.png" Content="Save" Style="{StaticResource ButtonStyle}" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center"/>
Run Code Online (Sandbox Code Playgroud)

内容按预期工作,两个按钮显示标签中的正确文字,但图像不显示。如果我直接使用 ControlTemplate(无样式)并将 {TemplateBinding} 替换为图像文件名,则图像确实会出现。

显然我使用了错误的标签或错误的图像。

帮助?

wpf xaml

2
推荐指数
1
解决办法
2248
查看次数

如何将静态数组的元素传递给非静态方法?

我有一个静态数组,我需要将它的任意元素传递给非静态方法.

我怎么做?

public class MyClass
{
    public static int[] staticArray = { 3, 11, 43, 683, 2731 };

    public void SomeMethod(int value)
    {
        //...stuff...
    }

    public static void staticMethod()
    {
         SomeMethod(staticArray[2]);    //error here
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试这样的东西时,我得到了错误An object reference is required for the non-static field, method, or property.

c# static

1
推荐指数
1
解决办法
1224
查看次数

从函数返回变长数组

已经在C#-land了一段时间,我无法弄清楚如何在C++中做到这一点(在Arduino草图中)

我想从库中调用一个函数来返回一个未知长度的字节列表.有点像:

byte devices[] = MyLib::EnumerateDevices();
Run Code Online (Sandbox Code Playgroud)

在图书馆:

byte[] MyLib::EnumerateDevices()
{       
   int count = 0;       

   //some code that modifies count

   static byte *temp = new byte[count];  // Assume count is 2 here

   temp[0] = 42;
   temp[1] = 44;       

   return temp;
}
Run Code Online (Sandbox Code Playgroud)

显然,我有所有指针和derefs要么丢失,要么在错误的地方......

救命?

戴夫

c++ arduino

1
推荐指数
1
解决办法
3177
查看次数

Alpha 通道无法按预期使用 WriteableBitmap

我当前的代码是将一个小的 Pbgra32 位图 blit'ing 到一个更大的 Pbgra32 位图上。工作正常。我现在想做的就是让那个较小的部分透明。为此,在 blit 之前,我将较小的值传递给一种方法,该方法应通过保留 RGB 值来编辑每个像素,同时将 0x7F 写入每个像素的 A 值。

然而,我得到的不是 50% 透明的图像,而是一个灰色的方块。我究竟做错了什么?

private void MakeTransparent(ref WriteableBitmap bmp)
    {
        int width = bmp.PixelWidth;
        int height = bmp.PixelHeight;
        int stride = bmp.BackBufferStride;
        int bytesPerPixel = (bmp.Format.BitsPerPixel + 7)/8;

        unsafe
        {
            bmp.Lock();
            byte* pImgData = (byte*) bmp.BackBuffer;

            int cRowStart = 0;
            int cColStart = 0;
            for (int row = 0; row < height; row++)
            {
                cColStart = cRowStart;
                for (int col = 0; col < width; col++) …
Run Code Online (Sandbox Code Playgroud)

c# bitmap writeablebitmap writeablebitmapex

1
推荐指数
1
解决办法
1222
查看次数

如何将Vue数据绑定到下拉列表

我正在学习Vue,在这里不能说出我做错了什么。数据正在从服务器返回(5条记录),但没有放入<select>;中。我所得到的只是一个单一的选择,说{{dept.DName}}

<html>
<head><link href="Content/bootstrap.min.css" rel="stylesheet" />
    <meta charset="utf-8" />
    <title></title>
</head>
<body class="container">
<div>
    <select id="deptList">
        <option v-model="selected" v-for="dept in app.depts" v-bind:value="dept.Did">
            {{dept.DName}}
        </option>
    </select>    
</div>
<script src="Scripts/jquery-1.9.1.min.js"></script>
<script src="Scripts/moment.min.js"></script>
<script src="https://unpkg.com/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-resource@1.3.4"></script>
<script src="Scripts/vue-controller.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

脚本/vue-controller.js包含:

var app = new Vue({
    data: {
        el: "body",
        depts: [],
        emps: [],
        selected: ""
    },
    methods: {
        getDepts: function () {
            console.log("I'm a little teapot");  // this appears in the log
            this.$http.get("/Dept/Index").then(function(response) {
                this.depts = …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuejs2

1
推荐指数
1
解决办法
5637
查看次数

如何将void指针强制转换为int [3]?

我需要调用第三方库并传入一个int [3]作为void*,就像这样[工作]:

int pattern[3] = {2,4,10};
if ( OSTaskCreate( BlinkLED,
        ( void * ) pattern,
        ( void * ) &BlinkTaskStack[USER_TASK_STK_SIZE],
        ( void * ) BlinkTaskStack,
        MAIN_PRIO - 1 ) != OS_NO_ERR )
{
    iprintf( "*** Error creating blink task\r\n" );
}
Run Code Online (Sandbox Code Playgroud)

但是现在我需要解析一个字符串来获取模式数组,而我似乎无法正确使用它.

首先,我将字符串传递给解析器并返回数组:

int (&ParseBlinkOnCommand(char rxbuffer[3]))[3]
{
   // Code parses rxbuffer and creates the 3 ints needed

   int pattern[3] = {repeats, onTicks, offTicks};  
   return pattern;
}
Run Code Online (Sandbox Code Playgroud)

然后我尝试将它传递给OSTaskCreate,就像我之前做的那样:

int pattern2[3] = ParseBlinkOnCommand(rxbuffer);                    
if ( OSTaskCreate( BlinkLED,
        ( void * ) pattern2, …
Run Code Online (Sandbox Code Playgroud)

c++ arrays

0
推荐指数
1
解决办法
95
查看次数