|
<might help>
make sure the result of the GetEncoderInfo(mimetype) gives a compatible codecinfo.
Namely you can compare your codecinfo instance with the one built by GDI+ by trying a direct call to GdipGetImageDecoders(...).
</might help>
(the reason is that behind the wheel the run-time uses GDI+ and these calls to obtain the infos : there might be a bug (in which case you could help yourself by interoping GDI+ directly); or you might make an approriate use of the System.Drawing.Bitmap logic).
|
|
|
|
|
I'm developing a control derived from the ListView control and need it to find it's position relative to the Form it's contained on.
In my test Form I have the ListView positioned on a TabPage, and all the normal positioning references (this.Bounds, this.Location, this.Top, this.Left, this.ClientRectangle etc) return 0 - which is it's correct position within the TabPage, but obviously has nothing to do with it's position on the parent Form.
Note that I do not need a reference to it's Screen location, just the X and Y coordinates to it's upper-left corner within the parent form - can anyone help?
|
|
|
|
|
you need to offset the location by adding the parent location.
int x = Left;<br />
for (Control thisParent = parent; thisParent != null; thisParent = thisParent.parent)<br />
x += thisParent.Left;
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Many thanks for the quick reply!
I tried implementing your suggestion as follows:
int x = Left;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
x += thisParent.Left;<br />
<br />
int y = Top;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
y += thisParent.Top;
No go though I'm afraid - what that ends up giving me is a screen reference, not a refence relative to the containing form. Perhaps it has something to do with the fact the the test app is MDI? Even if so, I'd like to make a control that will work reliably in both SDI and MDI apps.
|
|
|
|
|
just stop one level earlier
int x = Left;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
{<br />
if (this.Parent != null)<br />
x += thisParent.Left;<br />
}
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Thanks for the tips Philip - after stopping one level before the MDI parent I still had a problem where the MDI child form was reporting negative location values. The final code I came up with looks like this:
int x = Left;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
{<br />
if (thisParent.Parent != null && thisParent.Left > 0)<br />
x += thisParent.Left;<br />
}<br />
<br />
int y = Top;<br />
for (Control thisParent = Parent; thisParent != null; thisParent = thisParent.Parent)<br />
{<br />
if (thisParent.Parent != null && thisParent.Top > 0)<br />
y += thisParent.Top;<br />
}
|
|
|
|
|
Hi,
I'm not too sure how to explain what I'm trying to do. Basically I want a developer to go "File | Add New Item" and choose an option like "Paul's XMLDB Form". This will then prompt the user for a connection string to a DB where it should store the form definition, and create a "form" in design view for them to edit. I've made some custom controls that I want the developer to be able to add to the form. I'd like the editing to look as close to the standard form editing in VS.Net, and when they choose to save it, it will write the definition off to the DB as an XML field.
Now I've tried looking at Designers, IDesignerHost, IRootDesigner, ComponentDesigner, etc, etc. But I'm not finding an easy way to do this. I thought I'd create my own add-in, which docks a window in VS.Net but now I can't get the toolbox to activate so I can drag components off it.
Does anyone know how I could do this?
Thanks
From
Paul
|
|
|
|
|
Hello,
How to generate a graphic in the c# asp .net? For example I build a graphic with the class GDI+ but I would like to transfer this image in asp .net. For example, I have two button in my web page with a graphic and texts (title ….), one button can add a circle the second choose the color for this. How to built that ?
Thanks in advance….
Thank in advance
-=zoltix=-
|
|
|
|
|
Look at my WebBoxes article.
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
|
|
Thanks a lot......it s percfect !!!!
-=zoltx=-
|
|
|
|
|
I know leppie has already given you an article, however here is another[^].
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
|
|
|
|
|
i downloaded someones....(spellcheck)dll as freeware and incorperated it into my program...what it does when it checks the spelling it logs onto a website and basicly runs like a script on that site typing in the word to check. anyways it works perfect....but i made my program from scratch..and it just doesnt feel right using someone else's code......so my question is how can i go about creating a spell checking system (that has the library to search located on system)... i would need to store the words in a string like setting (like a really huge listbox being as there is 11,000 words in the english lan(about))....additionally how can i get all the correctly spelt words naturally i cant write all the words..and if you can tell yet....i cant spell lol... i would love some thoughts on how too do this..... or someone to help with the project would be great.... i love freeware...and would love too give it out...for use in other .Net apps... anyways.... thanks for reading... all thoughts help
|
|
|
|
|
i want to pass a string address of pre-allocated memory from c# dll to c dll.how to allocate the memory for string and pass the address to c dll.pl reply.
|
|
|
|
|
IntPtr address = Marshal.AllocHGlobal(int cbSize);
|
|
|
|
|
Can anyone point me in the right direction. We are developing an application in C# and would like to create a framework where 3rd party developers can develop forms in HTML/JScript and be able to plug them into our application.
We are developing a CRM system. The main framework will obtain data from the database and then if the user wants to access this 3rd party form, we will load the form in an embedded IE. What we would like is for the JScript inside this page to be able to access our internal object and access the same data that the rest of our framework has access to.
I know that I can access my object as a COM object from within the script, but that would be a different instance of my object.
The other possibility is to have the framework call a known function within the JScript and make itself know.
We are at very early stages of this project. Can you suggest resources where I can find more about this integration? Do you think this scheme is workable?
Patrick Hill
|
|
|
|
|
hey guys....and girls.. i need some help with the crownwood magic libray if you are fimiliar with it... i shouldnt need help cause i have had this problem before..and fixed it....but i lost the source code i fixed it on..and im stumped lol......anyways i need to know how i can display my pop up menu even infront of a richtextbox..... here the code on how i display it
<br />
protected override void OnMouseDown(MouseEventArgs e){<br />
if(e.Button == MouseButtons.Right)<br />
{<br />
try{<br />
OnControlButtonUp(this,e);<br />
}catch(Exception ex){MessageBox.Show(ex.ToString());}<br />
}<br />
return;<br />
}<br />
protected void OnControlButtonUp(object sender, MouseEventArgs e)<br />
{<br />
if (e.Button == MouseButtons.Right)<br />
{<br />
Control ctl = sender as Control;<br />
PopupMenu popup = new PopupMenu();<br />
MenuCommand menu0 = new MenuCommand("-"); <br />
MenuCommand menu1 = new MenuCommand("&m3");<br />
MenuCommand menu2 = new MenuCommand("&m2");<br />
MenuCommand menu3 = new MenuCommand("&m1");<br />
MenuCommand menu5 = new MenuCommand("&m4");<br />
MenuCommand menu4 = new MenuCommand("-");<br />
MenuCommand menu6 = new MenuCommand("&m5");<br />
MenuCommand menu7 = new MenuCommand("m6");<br />
MenuCommand menu8 = new MenuCommand("m7");<br />
popup.MenuCommands.AddRange(new MenuCommand[]{menu0,menu1, menu2,menu5,menu3,menu4,menu8,menu6,menu7,menu4});<br />
MenuCommand selected = popup.TrackPopup(ctl.PointToScreen(new Point(e.X, e.Y)));<br />
if (selected != null)<br />
{<br />
if (selected == menu1)<br />
{}<br />
else if(selected ==menu2)<br />
{<br />
} <br />
}<br />
}<br />
}<br />
thank you..for reading this..... Magic Library [^]
|
|
|
|
|
richTextBox.ContextMenu = null; if I rememebr correctly.
Who is this miscrosoft, and what devilish plans have they for us?
|
|
|
|
|
|
I am trying to figure out how to perform a bulk insert from C#.
Can anyone help me?
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
Darryl Borden wrote:
I am trying to figure out how to perform a bulk insert from C#.
Not sure of the exact criterion you have, however BCP works extrememly well when dealing with really large datasets. We used it with SQL Server 2000 often.
Nick Parker
The only man who never makes a mistake is the man who never does anything. - Theodore Roosevelt
|
|
|
|
|
I am trying to compile a project using the command line compile and I am running into a problem. I have two forms (Form1.cs and Form2.cs) Form2 includes an IE WebBrowser (AxSHDocVw.AxWebBrowser). The program compiles and runs fine when compile within VS.Net; however, when I use csc.exe I compiles, but when I try to run the form with WebBrowser embedded in it, I receive
“Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly. Make sure “Form2.resources” was correctly embedded or linked into assembly “xxx”"
I used the following lines to compile:
> <code>resgen Form1.resx</code>
> <code>resgen Form2.resx</code>
> <code>csc /t:winexe /out:xxx.exe
/r:Interop.SHDocVw.dll
/r:AxInterop.SHDocVw.dll
/r:Microsoft.mshtml.dll
/resource:Form1.resources
/resource:Form2.resources
Form1.cs Form2.cs AssemblyInfo.cs</code>
Any suggestions are welcome.
Patrick Hill
Myers Internet, Inc.
|
|
|
|
|
Try the /compile option on resgen, (resgen /compile Form1.resx ).
Also, when VS.NET compiles the resx it gets named [DefaultNamespace].[Form].resources. So the /resource option to csc might need to be changed to /resource:Form1.resources,[DefaultNamespace].Form1.resources .
Good luck,
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Thanks James!
The key is specifying the fully qualified Namespace for the csc.exe
namespace Foobar
{
public class Form2 : System.Windows.Forms.Form
{
...
csc.exe ... /resource:Form2.resources,Foobar.Form2.resources ...
Patrick Hill
|
|
|
|