|
|
I couldnt get the result.
Pls change my coding and sent . you can get my coding part in the previous thread.Pls help .
santhosh
|
|
|
|
|
How can I set the image property of a picturebox object at run time?
I have added to images (jpg) to my solution both with build action Embedded Resource, and I want to switch at run time which image is displayed. I can not use the ImageList because the image size exceeds 256x256 and is not the same for both pictures. (I might want to include more pictures in the future).
I also know that I can use the following code:
this.myPictureBox.Image = new Bitmap("C:\\myfolder\\myImage.jpg");
but if I use that code there better be an image at that location and that is not what I want. I want to embedd the image in the exe and then populate the image property of the picture box with the embedded images at runtime.
I thought a little more about this problem and I think I want to create an array of bitmaps and then load all the images into the bitmap array then I can use the following code to change the picturebox image property at runtime:
private void ChangeImage(int ImgIndex)
{
this.myPictureBox.Image = this.myBitmapArray[ImgIndex];
}
Well the problem still remains to find a way to load an image into a bitmap object. It is very easy to do if I specify the path and the filename but again that is not something I want to do.
I did find some information using the System.Reflection.Assembly class, but I could not quite figure out how to load the resource that is embedded.
Any assistance would be greatly appreciated.
Sincerely,
Einar
|
|
|
|
|
Hi Einar,
Check out this link on the Microsoft Newsgroups: howto load an embedded resource[^]
Basically, it involves this:
Assemly myAssembly = GetType().Module.Assembly;
Bitmap bmp = myAssembly.GetResourceStream("Namespace.Folder.File.Ext");
Replace the Namespace.Folder.File.Ext path accordingly. Of course, make sure your bitmap is actually embedded first!
Good luck.
This space for rent!
My Blog
|
|
|
|
|
I am looking for suggestions on a good way to visually layout database designs and class designs. I have seen in some articles where the database looks to be a screen shot from the SQL diagram and some articles show class designs.
|
|
|
|
|
I personally use a good ol' whiteboard. I invested in a 1200x900mm magnetic one a few weeks ago - I can't live without it now! However, a lot of people swear by Visio, as well.
If you're looking for a free alternative, you could try Dia[^]. Dia is an open-source diagram modelling tool which appears to be fairly good.
This space for rent!
My Blog
|
|
|
|
|
If you have a control on a windows form that has a ContextMenu enabled, and you would like to know WHICH control it is that the user has right-clicked, is it possible to pass the name of the control through to the menu click event so that it could process the control using that information? The sender object only retrieves the MenuItem object and not the name of the control that activated the menu click. How would I acquire the name of the control that activated the ContextMenu click event?
|
|
|
|
|
Like this:
MenuItem miSender = (MenuItem)sender;
ContextMenu cmSender = (ContextMenu)miSender.Parent;
TextBox tbSender = (TextBox)cmSender.SourceControl;
|
|
|
|
|
Thank You, Guinness4Strength ! Much appreciated.
New_Phoenix
|
|
|
|
|
I didn't see a DirectX board so I thought I'd post here since I am writing in C#.
I am having an issue with setting some vectors on a CustomVertex. Here is my code:
<br />
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)<br />
{<br />
device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI/4, this.Width/this.Height, 1f, 50f);<br />
device.Transform.View = Matrix.LookAtLH(new Vector3(0,0,30), new Vector3(0,0,0), new Vector3(0,1,0));<br />
device.RenderState.Lighting = false;<br />
device.RenderState.CullMode = Cull.None;<br />
<br />
CustomVertex.PositionColored[] vertices = new CustomVertex.PositionColored[3];<br />
vertices[0].SetPosition(new Vector3(0f, 0f, 0f));<br />
vertices[0].Color = Color.Red.ToArgb();<br />
vertices[1].SetPosition(new Vector3(10f, 0f, 0f));<br />
vertices[1].Color = Color.Green.ToArgb();<br />
vertices[2].SetPosition(new Vector3(5f, 100f, 0f));<br />
vertices[2].Color = Color.Yellow.ToArgb();<br />
<br />
device.Clear(ClearFlags.Target, Color.DarkSlateBlue, 1.0f, 0);<br />
<br />
device.BeginScene();<br />
device.VertexFormat = CustomVertex.PositionColored.Format;<br />
device.DrawUserPrimitives(PrimitiveType.TriangleList, 1, vertices);<br />
device.EndScene();<br />
<br />
device.Present();<br />
<br />
this.Invalidate(); <br />
}<br />
The problem is with the vertices[x].SetPosition(new Vector3(0f, 0f, 0f));
When I try to compile, I get the error message: Microsoft.DirectX.Direct3D.CustomVertex.PositionColored does not contain a definition for SetPosition.
I have also tried: vertices[x].Position.Add(new Vector3(0f, 0f, 0f));
This doesn't give me an error, but it also doesn't render anything on the screen.
Also, I can render the triangle if I use CustomVertex.TransformedColored so I know that is working, but I need to use CustomVertex.PositionColored
In most of the examples I have seen, this is how it is done. If you know DirectX, then you also know it is very hard to find any sort of good documentation on it too. I don't know if most examples I am following are 8.0 and earlier. Is there another way to do this? Am I doing it right but missing something?
|
|
|
|
|
Hey!
I Have two list box the second list box need to be updated when the first listbox is updated with an item.
Is there any event that i can use on the first Listbox and by that update my secon list box?
I are adding data to my first list box from many places!
//SnowJim
|
|
|
|
|
What do you mean with updated; adding a value to the ListBox or a change of the selected value?
In case of the latter write an event handler for either the SelectedIndexChanged or the SelectedValueChanged event and update the second ListBox according to the selected value.
www.troschuetz.de
|
|
|
|
|
As soon as an item is addad i whant i event to be raised there i can write the new item into the seond listbox.
Else i will have to do i funktion that al are using, there i also change the second listbox but this will be alot to change.
So i thought that maby there is an event that is raised when an item is added that i can use?
//SnowJim
|
|
|
|
|
|
I've written an Add-in that creates a CommandBar with a CommandBarButton and CommandBarComboBox control. It looks and works great the very first time the add-in is run (when the OnConnection method executes). But if I close VS and re-open it, only the CommandBarButton control is the only control present. Below is the OnConnection method I use to create the CommandBar. Do I need to add the CommandBarComboBox control in a different way ?
public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
{
applicationObject = (_DTE)application;
addInInstance = (AddIn)addInInst;
if(connectMode == Extensibility.ext_ConnectMode.ext_cm_UISetup)
{
object []contextGUIDS = new object[] { };
Commands commands = applicationObject.Commands;
_CommandBars commandBars = applicationObject.CommandBars;
try
{
Command cmd = null;
try
{
cmd = commands.Item(FullCommandName,0);
}
catch(Exception Err)
{
Debug.WriteLine("OnConnection: "+Err.Message);
}
if(cmd!=null)
cmd.Delete();
cmd = commands.AddNamedCommand(addInInstance,CodeDepotRes.ProgID,CodeDepotRes.CommandName,CodeDepotRes.ToolTip,false, 102,ref contextGUIDS,(int)vsCommandStatus.vsCommandStatusSupported+(int)vsCommandStatus.vsCommandStatusEnabled);
CommandBar Bar = GetCommandBar(CodeDepotRes.ProgID);
if(Bar!=null)
commands.RemoveCommandBar(Bar);
Bar=(CommandBar)commands.AddCommandBar(CodeDepotRes.ProgID,vsCommandBarType.vsCommandBarTypeToolbar,null,0);
CommandBarButton btn = (CommandBarButton) cmd.AddControl(Bar, 1);
btn.Style = MsoButtonStyle.msoButtonIcon;
CommandBarComboBox DropBox = (CommandBarComboBox) Bar.Controls.Add(
MsoControlType.msoControlDropdown,oMissing,oMissing,oMissing,oMissing);
DropBox.Width=300;
DropBox.AddItem("[Open Code Depot Manager]",oMissing);
DropBox.Caption = "Snipets:";
DropBox.Style = MsoComboStyle.msoComboLabel;
}
catch(System.Exception Err)
{
Debug.WriteLine("OnConnect:"+Err.Message);
}
}
}
Any thoughts would be greatly appreciated...
|
|
|
|
|
hi
how to create arraylist files?
i want to add modifi and erase inside datas
help me
thanks
|
|
|
|
|
suthagar wrote:
how to create arraylist files?
An arraylist is a data structure. What do you want to do, place the contents of an arraylist into a file ? All you need to do is use for each to step through the array list.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
i'd like to make an application that runs on the site without posting back, like the java applet, but i don't want to write java, so my questions is , is there anyway that let me make somethin like the java applet in C# ASP.NET ??
where can i look at ?
thanx
|
|
|
|
|
Why would you want to do that ? Your users would have to download it, and they would have to have the .NET runtime installed. What's the benefit of embedding it in a browser if you're just going to send them the .exe anyhow ?
You could do that with ActiveX controls, so I don't see any reason why you couldn't do it in C#, given that C# can be used to write COM components.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
i want to do that coz i'd like to make somthin like playing chess on the web, that don't require posting back to the server, actually i didn't use activex b4, so i'll take a look,
thanx for reply
|
|
|
|
|
Maybe you are thinking of web services? Im somewhat confused by the question.
You can find how the description of how to set them up here:
http://www.codeproject.com/cs/webservices/
You will need a server running IIS with ASP.Net going on too. Basically, you can call a void function or something like this? This isn't a site though. I think there is a way to call managed code just from a script so you can just use that if you want.
I hope this helps,
|
|
|
|
|
Hi,
How do i show all tables from a Ms-Access database using OleDBConnection?
Thank u very much,
Dirso
|
|
|
|
|
I am working with an application that requires the utilization of the System.Diagnostics namespace. It involves the creation of a new process(), but I would like the process to NOT open a new window when process.start() occurs. I would prefer the process to run transparently in the background.
I realize that there is a System.Diagnostics.process.startinfo.createnowindow method that I believe would prevent the process from opening a new window with the required file information (ie a compressed .zip file using WinZip) but when I use this method, it still opens the winzip program with the appropriate process.FileName that I pass to it.
What is the proper syntax to use the process.startinfo.createnowindow method? How could I prevent the winzip application from opening? Any ideas?
|
|
|
|
|
Hello,
I have a structure that I want to fill with bytes from a byte array.
public struct DUMMY<br />
{<br />
public ushort dummy1;<br />
public ushort dummy2;<br />
public ushort dummy3;<br />
public ushort[] dummy4;<br />
}<br />
<br />
private byte [] filedata = new byte[512];<br />
<br />
public void MemCopy(ref byte [] source, ref object dest)<br />
{<br />
IntPtr Ptr = Marshal.AllocHGlobal(Marshal.SizeOf(dest));<br />
Marshal.StructureToPtr(dest, Ptr, true);<br />
int size = Marshal.SizeOf(dest);<br />
Marshal.Copy(source, 0, Ptr, size);<br />
}<br />
<br />
<br />
I tried to do it with the MemCopy function but after the Copy dest is still empty. All I'm looking for is a c++ memcpy replacement. If possible in a Managed way.
Thanks,
Arjan
|
|
|
|
|