本文整理汇总了C#中IPlugin.GetImage方法的典型用法代码示例。如果您正苦于以下问题:C# IPlugin.GetImage方法的具体用法?C# IPlugin.GetImage怎么用?C# IPlugin.GetImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlugin
的用法示例。
在下文中一共展示了IPlugin.GetImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PluginToolStripItem
public PluginToolStripItem(IPlugin pi, EventHandler<PluginEventArgs> OnClick)
: base(pi.GetDescription(), pi.GetImage(), null, pi.ToString())
{
this.Plugin = pi;
InitializeComponent();
this.Click += new EventHandler((o, e) => OnClick(o, new PluginEventArgs(pi)));
}
示例2: LoadTexture
public void LoadTexture(string index, IPlugin plugin)
{
float tw = 1;
float th = 1;
Bitmap image = null;
int tex = -1;
//StreamReader sr = new StreamReader(index);
MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(index));
StreamReader sr = new StreamReader(ms);
bool datasection = false;
C2DImage img = null;
while (!sr.EndOfStream)
{
string line = sr.ReadLine();
if (line.StartsWith("repeat:") && tex >= 0)
{
datasection = true;
continue;
}
if (!datasection)
{
if (line.EndsWith(".png"))
{
string imgname = line.Substring(0, line.Length - 4);
try
{
if (plugin != null)
image = (Bitmap)plugin.GetImage(imgname);
else
image = (Bitmap)global::UV_DLP_3D_Printer.Properties.Resources.ResourceManager.GetObject(imgname);
tw = image.Width;
th = image.Height;
tex = LoadTextureImage(image);
}
catch (Exception)
{
tex = -1;
}
}
continue;
}
if (line[0] != ' ')
{
// a new image
img = new C2DImage();
img.name = line.Trim();
img.tex = tex;
img.scalex = tw;
img.scaley = th;
img.bmp = image;
ImgDbase[img.name] = img;
continue;
}
// a parameter
string[] tokens = line.Trim().Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
switch (tokens[0])
{
case "xy:":
img.x = float.Parse(tokens[1]);
img.y = float.Parse(tokens[2]);
img.x1 = (img.x + 0.5f) / tw;
img.y1 = (img.y + 0.5f) / th;
break;
case "size:":
img.w = int.Parse(tokens[1]);
img.h = int.Parse(tokens[2]);
img.x2 = img.x1 + (float)(img.w -1) / tw;
img.y2 = img.y1 + (float)(img.h -1) / th;
break;
}
}
}