|
yuenli wrote: But it seem I am only getting a white blank screen
yuenli wrote: System.Drawing.Color newcolor = System.Drawing.Color.White;
bitmap.SetPixel(i, j, newcolor);
led mike
|
|
|
|
|
|
Copy over your current code export_Click method with this...
private void export_Click(object sender, RoutedEventArgs e) {
bitmap.Save(@"C:\concept1.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
MessageBox.Show("The created concept map has been exported to your local drive");
} Glad I could help,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi! Thanks a lot for the suggestion but I still cannot get the whole drawing of my shapes. Once the system being run, it will draws 3 shapes on the picture box, then when click on the export button it will produce an jpeg file with 3 shapes on it and a white background. Does anyone know how to do that? Thanks.
|
|
|
|
|
If your picture is in an Image control you can simply use the Image property and save the picture to a bitmap format.
Bitmap myimage = new Bitmap(pictureBox1.Image);
string savepath = @"C:\";
imgFormat = ImageFormat.Jpeg
myimage.Save(savepath, imgFormat);
Just because we can; does not mean we should.
|
|
|
|
|
I have a database that has one table (let's call it Cyl) that has several fields "linked" to other reference tables. The associated database editing application allows the user to enter new records for through a combination of textboxes and comboboxes. The comboboxes have as their datasource the linked tables. So, the user can select an item for the new record from a pre-set list of items stored in one of the other tables. The "linked" comboboxes are databound to the source datatable (Cyl) on the SelectedValue property and their datasource and value member are the linked tables values.
This works well unless the user needs to input data for a field in the Cyl table that is not currently present in one of the linked tables (let's say a Cust table). In that case, I can get the software to save the Cust field data even if the entry for the Cust field is not in the related Cust table, but the data does not display correctly on the form because the Cust field in the Cyl table is bound to the SelectedValue of the Cust combobox and if the entry for the Cust field is not represented in the Cust table, there is no value in Cust combobox.
So, basically what I need is to have the a field from one table, say the Cust table, loaded into a combobox that users will use to enter data for a field in another table while still allowing the user to enter data that is not in the Cust table.
I hope this question makes sense.
Thanks.
|
|
|
|
|
I've been tearing my hair out (and I can ill afford that!)
for hours trying to associate an icon in the toolbox for
a user control that I created. Whatever I do, the icon is
always the stock icon (the gear).
I created a 16x16 bitmap, and made it an embedded resource
in my control. I gave the control class an attribute as follows:
[ToolboxBitmap(typeof(CommentBox), "CommentBox.bmp")]
public class CommentBox : UserControl
I have a test form class, that when I bring it up in design mode,
I would like the control to show up in the toolbox (with its
correct icon). I have tried the "Choose item..." context menu item in the
toolbox to remove the control dll, and then reinsert it...to no avail.
Any suggestions what I'm missing?
Thanks,
Tom
|
|
|
|
|
what version of Visual Studio are you using? It's possible that you have to create a custom control to associate a custom icon with it.
led mike
|
|
|
|
|
VS 2008, Mike.
Actually, I just want an icon for the tool box.
|
|
|
|
|
hain wrote: Actually, I just want an icon for the tool box.
That's what I'm talking about. I seem to remember in VS2005 (which I am still using) that you can't associate a custom Icon to a User Control. You may need to do a Custom Control if you want that feature.
led mike
|
|
|
|
|
Other than having a
protected override void OnPaint(PaintEventArgs pe)
method, what makes a custom control "custom"?
I tried inheriting my control from System.Forms.Control,
rather than UserControl.
Still no luck.
modified on Thursday, March 13, 2008 12:54 PM
|
|
|
|
|
hain wrote: what makes a custom control "custom"?
It's not that it's "custom" it's that it is not a UserControl. It implements one of more interfaces that provide various integration capacity with Visual Studio.
http://msdn2.microsoft.com/en-us/library/ms180794(VS.80).aspx[^]
here is what I have in VS2005 that works for an extenderProvider
[ProvideProperty("ShowMRUList", typeof(ToolStripMenuItem)),
ToolboxItem(true), ToolboxBitmap( typeof(ToolStrip))]
public partial class MRUMenuItem : Component, IExtenderProvider, IDisposable, ISupportInitialize
led mike
|
|
|
|
|
Say you have a structure like this:
Root
\__ Bin
\__ Controls
\__ Commentbox.cs
\__ CommentBox.bmp
You could use the attribute as is above.
If however it exists in a another folder, you would have to refer to a type in that folder that has the same namespace of the folder.
Example if the BMP was in the Resources folder:
[ToolboxBitmap(typeof(Resources.ResourceManager), "CommentBox.bmp")]
|
|
|
|
|
|
|
Hi,
I am trying to access a webservice over the internet and getting the following exception.
'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond ' .
I am trying to access the web service with the help of following code and getting the above exception.
protected void Page_Load(object sender, EventArgs e)
{
GlobalWeather gw = new GlobalWeather();
string cities =gw.GetCitiesByCountry("India");
}
Please help.
|
|
|
|
|
I think you will get help better if you posted this question to the ASP.NET forum
M. Gouda
foreach(Minute m in MyLife)
{
myExperience++;
}
|
|
|
|
|
You are getting a general communication error, so it could be any number of things. Go through the basic diagnostics first: can you ping the web service server from where your code is running? Try also to load the web service URL in your browser, if it's http based.
|
|
|
|
|
Are you certain that the web service is running? Do you have the proper URL and permissions to access the WS? Try updating your web reference... does it work? If not, you either have an incorrect URL or the WS is down. If it does, then make sure the new Web Reference exports such a call. Let me know if you figure it out (or if both the WS responds to the update AND that method is exported).
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
My web service is down too, can you ask them to bring it up while you are at it?
|
|
|
|
|
Hello,
I am having problems with a tree control in a windows form application. Sometime yesterday a typecast that I was using wuit functioning and I can't figure out where the problem started. I have a class that is an extents the System.Windows.Forms.TreeNode class. It adds fine to the TreeControl, but when I go back and try to read the object and cast it as the new class it throws the following exception. What could have happened to make this start failing? I am including the adding and the locating a node. The adding program sometimes throws a duplicate value, which is tested by the FindChildNode before adding it. The FindChildNode is the biggest problem right now and is throwing the following Exception (Bolded line is throwing the error).
Message="Unable to cast object of type 'System.Windows.Forms.TreeNode' to type 'InternalApp.ECDTreeNode'."
<br />
public class ECDTreeNode : System.Windows.Forms.TreeNode<br />
{<br />
.<br />
.<br />
.<br />
public ECDTreeNode FindChildNode(string cText)<br />
{<br />
ECDTreeNode ret = null;<br />
for (int i = 0; i < Nodes.Count; i++)<br />
{<br />
ECDTreeNode tn = (ECDTreeNode)Nodes[i];<br />
if (cText.Trim().ToLower().CompareTo(tn.Text.Trim().ToLower()) == 0)<br />
{<br />
ret = tn;<br />
break;<br />
}<br />
}<br />
return ret;<br />
}<br />
}<br />
public void AddSorted(ECDTreeNode tn)<br />
{<br />
bool bFound = false;<br />
try<br />
{<br />
for (int i = 0; i < Nodes.Count; i++)<br />
{<br />
if (tn.Text.CompareTo(Nodes[i].Text) < 0)<br />
{<br />
Nodes.Insert(i, tn.Text.Trim());<br />
bFound = true;<br />
break;<br />
}<br />
}<br />
if (!bFound)<br />
Nodes.Add(tn);<br />
}<br />
catch (Exception e) <br />
{<br />
MessageBox.Show(e.Message, "Exception Error", <br />
MessageBoxButtons.Ok, MessageBoxIcon.Error);<br />
}<br />
}<br />
<br />
}<br />
<br />
Thanks for any help,
Leo T. Smith
Program/Analyst Supervisor
|
|
|
|
|
Leo Smith,
What is the collection "Nodes" ?, Is it a collection of System.Windows.Forms.TreeNode or ECDTreeNode?
Regards,
Gareth.
|
|
|
|
|
Nodes is a collection ECDTreeNodes.
Leo T. Smith
Program/Analyst Supervisor
|
|
|
|
|
My bet is that you are unintentionally adding a node somewhere using a string to the collection, instead of sending your pre-created node. Put a breakpoint in on the problem line to see what type the node is, and I bet it is just a TreeNode. Once you see which node is causing the problem, try to trace back to when it was created, and I bet you have a line like "tree.Nodes.Add("Some string")" instead of creating your own ECDTreeNode object, then adding that object. Good luck,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Leo Smith,
If this was true, why do you need to cast it?, since Nodes[i] would return a ECDTreeNode. Think it might be a good idea to:
Trace.WriteLine("node == " + Nodes[i].ToString());
Regards,
Gareth.
|
|
|
|