.net c+中的动画师+/cli winforms?
我在codeproject中找到了这篇文章 我想在第二个表单(myform1.h)中使用animator 我在解决方案下的引用中添加了animator.dll。没有编译错误,但我看到运行时错误 中发生类型为“System.TypeLoadException”的未处理异常 Animator.exe 其他信息:无法加载类型“AnimatorNS.Animation” 来自程序集“Animator,Version=0.0.0.0,Culture=neutral,PublicKeyToken=null” 这是我的密码.net c+中的动画师+/cli winforms?,.net,winforms,dll,c++-cli,.net,Winforms,Dll,C++ Cli,我在codeproject中找到了这篇文章 我想在第二个表单(myform1.h)中使用animator 我在解决方案下的引用中添加了animator.dll。没有编译错误,但我看到运行时错误 中发生类型为“System.TypeLoadException”的未处理异常 Animator.exe 其他信息:无法加载类型“AnimatorNS.Animation” 来自程序集“Animator,Version=0.0.0.0,Culture=neutral,PublicKeyToken=null
#pragma once
#include"MyForm1.h"
namespace Animator {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Summary for MyForm
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
private: AnimatorNS::Animator^ animator1;
private: System::ComponentModel::IContainer^ components;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
AnimatorNS::Animation^ animation1 = (gcnew AnimatorNS::Animation());
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(MyForm::typeid));
this->button1 = (gcnew System::Windows::Forms::Button());
this->animator1 = (gcnew AnimatorNS::Animator(this->components));
this->SuspendLayout();
//
// button1
//
this->animator1->SetDecoration(this->button1, AnimatorNS::DecorationType::None);
this->button1->Location = System::Drawing::Point(56, 93);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(133, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"Show form";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click);
//
// animator1
//
this->animator1->AnimationType = AnimatorNS::AnimationType::Scale;
this->animator1->Cursor = nullptr;
animation1->AnimateOnlyDifferences = true;
animation1->BlindCoeff = (cli::safe_cast<System::Drawing::PointF>(resources->GetObject(L"animation1.BlindCoeff")));
animation1->LeafCoeff = 0;
animation1->MaxTime = 1;
animation1->MinTime = 0;
animation1->MosaicCoeff = (cli::safe_cast<System::Drawing::PointF>(resources->GetObject(L"animation1.MosaicCoeff")));
animation1->MosaicShift = (cli::safe_cast<System::Drawing::PointF>(resources->GetObject(L"animation1.MosaicShift")));
animation1->MosaicSize = 0;
animation1->Padding = System::Windows::Forms::Padding(0);
animation1->RotateCoeff = 0;
animation1->RotateLimit = 0;
animation1->ScaleCoeff = (cli::safe_cast<System::Drawing::PointF>(resources->GetObject(L"animation1.ScaleCoeff")));
animation1->SlideCoeff = (cli::safe_cast<System::Drawing::PointF>(resources->GetObject(L"animation1.SlideCoeff")));
animation1->TimeCoeff = 0;
animation1->TransparencyCoeff = 0;
this->animator1->DefaultAnimation = animation1;
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(282, 255);
this->Controls->Add(this->button1);
this->animator1->SetDecoration(this, AnimatorNS::DecorationType::None);
this->Name = L"MyForm";
this->Text = L"MyForm";
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
AnimatorNS::AnimationType ^ani = AnimatorNS::AnimationType::Scale;
MyForm1 ^mf;
animator1->Show(mf, false, AnimatorNS::Animation::Scale);
//mf.ShowDialog();
}
};
}
#pragma一次
#包括“MyForm1.h”
名称空间动画师{
使用名称空间系统;
使用名称空间System::ComponentModel;
使用名称空间系统::集合;
使用命名空间System::Windows::Forms;
使用名称空间System::Data;
使用名称空间系统::绘图;
///
///我的表格摘要
///
公共引用类MyForm:public System::Windows::Forms::Form
{
公众:
我的表格(作废)
{
初始化组件();
//
//TODO:在此处添加构造函数代码
//
}
受保护的:
///
///清理所有正在使用的资源。
///
~MyForm()
{
if(组件)
{
删除组件;
}
}
私有:系统::Windows::窗体::按钮^button1;
私有:AnimatorNS::Animator^animator1;
私有:系统::组件模型::IContainer^组件;
受保护的:
私人:
///
///必需的设计器变量。
///
#pragma区域Windows窗体设计器生成的代码
///
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
///
void初始化组件(void)
{
这->组件=(gcnewsystem::ComponentModel::Container());
AnimatorNS::Animation^animation1=(gcnew AnimatorNS::Animation());
System::ComponentModel::ComponentResourceManager^resources=(gcnew System::ComponentModel::ComponentResourceManager(MyForm::typeid));
此->按钮1=(gcnew System::Windows::Forms::Button());
this->animator1=(gcnew AnimatorNS::Animator(this->components));
此->SuspendLayout();
//
//按钮1
//
这->动画师1->设置装饰(这->按钮1,动画师::装饰类型::无);
此->按钮1->位置=系统::图纸::点(56,93);
此->按钮1->名称=L“按钮1”;
该->按钮1->尺寸=系统::图纸::尺寸(133,23);
此->按钮1->选项卡索引=0;
此->按钮1->文本=L“显示表单”;
此->按钮1->UseVisualStyleBackColor=true;
this->button1->Click+=gcnewsystem::EventHandler(this,&MyForm::button1\u Click);
//
//动画师1
//
这->animator1->AnimationType=AnimatorNS::AnimationType::Scale;
这->动画师1->光标=nullptr;
animation1->AnimateOnlyDifferences=true;
animation1->BlindCoeff=(cli::safe_cast(参考资料->获取对象(L“animation1.BlindCoeff”));
动画1->leafcoff=0;
动画1->MaxTime=1;
动画1->MinTime=0;
animation1->MosaicCoeff=(cli::safe_cast(参考资料->获取对象(L“animation1.MosaicCoeff”));
animation1->MosaicShift=(cli::safe_cast(参考资料->获取对象(L“animation1.MosaicShift”));
动画1->马赛克大小=0;
动画1->Padding=System::Windows::Forms::Padding(0);
animation1->rotateCeff=0;
动画1->RotateLimit=0;
animation1->ScaleCoeff=(cli::safe_cast(参考资料->获取对象(L“animation1.ScaleCoeff”));
animation1->SlideCoeff=(cli::safe_cast(参考资料->获取对象(L“animation1.SlideCoeff”));
动画1->时间系数=0;
动画1->透明度系数=0;
这->animator1->DefaultAnimation=animation1;
//
//MyForm
//
这->自动缩放尺寸=系统::图纸::尺寸(8,16);
这->AutoScaleMode=System::Windows::Forms::AutoScaleMode::Font;
这->ClientSize=System::Drawing::Size(282255);
此->控制->添加(此->按钮1);
this->animator1->SetDecoration(this,AnimatorNS::DecorationType::None);
此->名称=L“MyForm”;
此->文本=L“MyForm”;
此->恢复布局(错误);
}
#布拉格端区
私有:系统::无效按钮1\u单击(系统::对象^sender,系统::事件参数^e){
AnimatorNS::AnimationType^ani=AnimatorNS::AnimationType::Scale;
MyForm1^mf;
animator1->Show(mf、false、AnimatorNS::Animation::Scale);
//mf.ShowDialog();
}
};
}
Codeproject.com code永远缺少“仅在我的机器上工作”免责声明。您必须调试它,查看InnerException是第一个关键步骤。Codeproject.com代码永远缺少“仅在我的机器上工作”免责声明。您必须对其进行调试,查看InnerException是关键的第一步。