Unable to write data to the control of other from in VC++ winforms - winforms

I am trying to show an image on the pictureBox of the second Form from First Form.
But I am not able to see any output....
My Code of Form1.cpp is like this
#include "SecondForm.h"
SecondForm^ obj=gcnew SecondForm();
System::Drawing::Bitmap ^bmp = gcnew System::Drawing::Bitmap(grf->width,grf->height,grf->widthStep,System::Drawing::Imaging::PixelFormat::Format24bppRgb,(System::IntPtr)grf->imageData);
obj->pictureBox1->Image=obj->pictureBox1->Image->FromHbitmap(bmp->GetHbitmap());
I don't know what is the problem.....
Can anybody please help me sort our this problem...
Thanks in Advance

Have you tried this simple code -
obj.pictureBox1.Image = bmp; // [You may write the C++ equivalent]
Instead of this -
obj->pictureBox1->Image=obj->pictureBox1->Image->FromHbitmap(bmp->GetHbitmap());

Related

CSFML : Draw Line

i'm working on a school project using CSFML (The SFML library but in C), i'm trying to display a line between two points but impossible for me to find any good documentation to do it, if someone know how to do it, please help me.
i've got his doc:
https://www.sfml-dev.org/tutorials/2.0/graphics-shape-fr.php
and my code look like this:
sfRenderWindow_clear(window.window, sfBlack);
sfRectangleShape *rectangle = sfRectangleShape_create();
sfRectangleShape line(rectangle);
sfRenderWindow_display(window.window);
but there is nothing on my window.
The doc tell something like window.draw(); to draw it but it's not recognized as a valid function so...
Thank you

Applescript and setting checkbox variable

I'm incredibly new to coding and the like, and I've started with applescript as it is relatively easy to learn. I'm building a simple gui tool with the help of Pashua and some sample code.
I have added following code for a checkbox:
urgent.type = checkbox
urgent.lable = Urgent
urgent.default =
I tested it with a simple if then return statement:
if urgent is 1 then
return "This is urgent!"
end if
But I'm told that the variable urgentis undefined.
I know I am missing something, but I am not sure what to do, and I've looked to no avail.
Thank you
Your code looks like JavaScript. If you want to use AppleScript, then it would be more like this:
set urgent to {type:"checkbox", lable:"urgent", default:1}
if (default of urgent) = 1 then
display dialog "This is urgent!"
end if
See the AppleScript Language Guide for record

How do I store dynamically a movieclip in a array in Haxe/HTML5?

This is my code:
var buttons:Array<Dynamic> = new Array<Dynamic>();
var mc2:flash.display.MovieClip = new MovieClip();
mc2.graphics.beginFill(0xFF0000);
mc2.graphics.moveTo(50,50);
mc2.graphics.lineTo(100,50);
mc2.graphics.lineTo(100,100);
mc2.graphics.lineTo(50,100);
mc2.graphics.endFill();
buttons.push(addChild(mc2));
buttons[0].x = 1000;
And my question is why this work in Flash but not work in HTML5 when I compile it? How do I solve the problem?
The last line “buttons[0].x = 1000;” is not working in HTML5… :/
Sorry for my english...
Because you use in "flash.display.MovieClip" class that does not available from HTML5.
In Haxe, if you use in class that belongs to specific target (like MovieClip) you can compile it only to that target.
Maybe you will found OpenFl library useful, It's library that let you develop with Flash API and target to almost any device(and also for HTML5) from same base code!
see Here for more
Are you using a framework?
Maybe it works if you split the addChild and the push into separate lines? Not sure if addChild returns a MovieClip?
Otherwise, try to trace the array trace(buttons) and observe the browser console.

how to save color using vcglib?

I'm trying to save color of vertices using vcglib but failed. Even if I read a file in and save it out without doing anything, the color of the original file is lost.
Here is the code I wrote:
vcg::tri::io::ImporterPLY<MyMesh>::Open(*srcMesh,"bunny.ply");
vcg::tri::io::ExporterPLY<MyMesh>::Save(*srcMesh,"out.ply");
After doing this, out.ply has no color while the source ply bunny.ply does.
Could anybody give me some sample code to make this thing done?
Thank you!
I had the exact same problem a couple of weeks ago.
After spending some time with the debugger and browsing through lots of source code, I discovered that the the open and save methods need to share an int mask. This allows the Open method to convey which attributes have been read from the original mesh (Also, make sure you've added the Colour4b attribute to your mesh definition.
int mask=0;
vcg::tri::io::ImporterPLY<MyMesh>::Open(*srcMesh,"bunny.ply",mask);
vcg::tri::io::ExporterPLY<MyMesh>::Save(*srcMesh,"out.ply",mask);
I hope that helps.

Trouble referencing movieClips

I am working on a flash project that dynamically generates navigation from an XML. For now I am trying to get it to work with arrays so that I can adapt it to xml once I know the logic works. I am new to as3 and learning has been a tiny bit bumpy. I have been searching for a solution to this but many of the examples I have seen have either been too simple to answer my question or too complex to understand since I am on the new side. This is the code I am working with.
var clientList:Array = new Array("Client1","Client2","Client3","Client4","Client5","Client6","Client7","Client8","Client9","Client10","Client11","Client12","Client13","Client14","Client15");
for each (var cName in clientList){
var newClientBtn:btnClientNav = new btnClientNav();
newClientBtn.x = workX;
newClientBtn.y = workY;
workY += newClientBtn.height;
newClientBtn.mcClientName.text = cName;
lContent.mcWork.addChild(newClientBtn.name);
trace(newClientBtn);
}
I can't fingure out how to properly refernce the dynamically created clips. I have a dynamic text box in the button but can't figure out how to reference it properly to change it, then my next issue will be referencing the buttons to make rollover and click code. I know this probably something simple to fix but I have been looking at it for too long and my eyes are starting to cross.. Thank you in advance for any advice you can give.
Why not store the clips you are creating in an object you can access later?
If you want to reference a movie clip by name though, one way to do it is:
var referenceMC:MovieClip = MovieClip(containerMC.getChildByName(“targetMC”));
If it was a text field or a button you were after, I believe you would do the same but instead cast the result of getChildByName to your desired control.
I also believe you want to add the button itself as a child, not pass its name into your addChild call?

Resources