|
Hi,
there are lots of articles that demonstrate how to paint things. My Sokoban article is a simple example, the playing board actually is a Panel.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: My Sokoban article is a simple example
nice work man, you got ma 5
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Now I take it you can not only write an image to a panel, but you can retrieve an image from it?
|
|
|
|
|
simple drawing method
Draw image and set it to global variable. Then in OnPaint() draw that image. In this way, you can have image anytime. But if you just want to set a single image from file or stream, I'll suggest you to use BackgoundImage property. No coding required. Plus you can use styles, Tiles, Center, Zoom...etc
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi Jacob,
first of all, if you have code to paint/draw something (that is a "Paint handler" which is called automatically with a "Graphics" parameter), you have all the information and the same code could be used to draw onto another Graphics object, e.g. one you obtain from Bitmap.CreateGraphics().
Furthermore there is a Control.DrawToBitmap() method available for all Controls, it creates a bitmap showing the Control the way it looks on screen. Since a Panel does not draw anything by itself, Panel.DrawToBitmap() paints your own content to the bitmap, which is quite handy.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
ohh.. ok that sounds like something I might be able to use to show a picture of our floor plan. Thanks for all of your guys help
|
|
|
|
|
Xmen wrote: you should use the appropriate control.
Yes, when available.
Xmen wrote: PB is for pictures and panel for containing other controls.
A PB can hold other controls as well. So it is doing (or trying to do) more than what a Panel does.
When not containing other Controls, a Panel is just like a piece of canvas, ideal for painting and drawing whatever you want.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: A PB can hold other controls as well.
aye aye but not like panel...you have to add programmatically.
Luc Pattyn wrote: When not containing other Controls, a Panel is just like a piece of canvas, ideal for painting and drawing whatever you want.
aha but no support for gif
but no worries, this is end of discussion
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I have text file data and I upload that data to DataGridView. Then, i want to save that data to Table in MySQL. I have tried to make the code. But, when I execute there are some error. Please help me. This is my code :
MySqlConnection con = new MySqlConnection();
con.ConnectionString = "Persist Security Info=False;database=skripsiku;server=localhost;Connect Timeout=90;user id=root; pwd=";
MySqlCommand cmd = con.CreateCommand();
try
{
con.Open();
cmd.CommandText = "INSERT INTO output" +
"(id_output, path, global_effect, direct_effect, path_mult, total_effect , persen_global , cum_persen) " +
"VALUES " + "(@id_output, @path, @global_effect, @direct_effect, @path_mult, @total_effect , @persen_global , @cum_persen)";
cmd.Parameters.Add("@id_output", MySqlDbType.Int32, 5);
cmd.Parameters.Add("@path", MySqlDbType.VarChar, 7);
cmd.Parameters.Add("@global_effect", MySqlDbType.VarChar, 7);
cmd.Parameters.Add("@direct_effect", MySqlDbType.VarChar, 7);
cmd.Parameters.Add("@path_mult", MySqlDbType.VarChar, 7);
cmd.Parameters.Add("@total_effect", MySqlDbType.VarChar, 7);
cmd.Parameters.Add("@persen_global", MySqlDbType.VarChar, 7);
cmd.Parameters.Add("@cum_persen", MySqlDbType.VarChar, 7);
// Masukkan data ke masing-masing kolo
for (int i = 0; i <= this.dataGridView1.Rows.Count; i++)
{
cmd.Parameters["@id_output"].Value = i+1;
cmd.Parameters["@path"].Value = this.dataGridView1[0,i].Value;
cmd.Parameters["@global_effect"].Value = this.dataGridView1[1,i].Value;
cmd.Parameters["@direct_effect"].Value = this.dataGridView1[2,i].Value;
cmd.Parameters["@path_mult"].Value = this.dataGridView1[3,i].Value;
cmd.Parameters["@total_effect"].Value = this.dataGridView1[4,i].Value;
cmd.Parameters["@persen_global"].Value = this.dataGridView1[5,i].Value;
cmd.Parameters["@cum_persen"].Value = this.dataGridView1[6,i].Value;
cmd.ExecuteNonQuery();
}
}
finally
{
con.Close();
}
thanks for your help
|
|
|
|
|
and what error you've got?
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
i am having a problem to connect the client with an ftp server. the error lies at the line
"Stream requeststream = request.GetRequestStream();"
unable to connect the error message. so plz help me fast
|
|
|
|
|
Are you setting UseBinary to true?
Are you connected to the FTP server?
Is your network connected?
Does the FTP server require authentication?
|
|
|
|
|
hi according to all the needs i am still connected to a server named cerberus ftp server, which is listening on port 21, i think when server client is connected it means thats the authentication is valid.
kindly elaborate use binary to true and how to browse a remote directory.
|
|
|
|
|
I'm working on an InfoPath form that is going to have a repeating table. In this form i'm using C# and WMI to retrieve hardware information for an inventory database. I've managed to figure out how to populate each row with the Network Interface and MAC Address, but i'm having difficulty when trying to get the IP Address, and I suspect i'll have the same problem trying to get the Subnet Mask, so if i can solve one i'll be able to solve the other.
The code i'm using is listed below (i stripped out the other code in there for the hardware not related to the Network Info), but when i use this code, in the IP Address field, it shows "System.String[]" instead of displaying the actual IP Address. Can some one please help me? I got my code samples from the WMI Code Creator and manipulated it to fit in with my existing code. It's pretty ugly right now, but so long as it works i dont care.
using Microsoft.Office.InfoPath;
using System;
using System.Xml;
using System.Xml.XPath;
using System.Management;
namespace Inventory_Rev1
{
public partial class FormCode
{
ManagementObjectSearcher searcherNetwork =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_NetworkAdapterConfiguration");
public void InternalStartup()
{
EventManager.FormEvents.Loading += new LoadingEventHandler(FormEvents_Loading);
}
public void FormEvents_Loading(object sender, LoadingEventArgs e)
{
foreach (ManagementObject queryObj in searcherNetwork.Get())
{
int counter = 1;
{
string nicName = queryObj["Description"].ToString();
string nicMac = (queryObj.Properties["MACAddress"].Value != null) ? queryObj.Properties["MACAddress"].Value.ToString() : "";
string nicIp = (queryObj.Properties["IPAddress"].Value != null) ? queryObj.Properties["IPAddress"].Value.ToString() : "";
XPathNavigator xnMyForm = this.CreateNavigator();
XmlNamespaceManager ns = this.NamespaceManager;
xnMyForm.SelectSingleNode("/my:myFields/my:Network/my:AdapterInfo/my:nicName", ns)
.SetValue(nicName);
xnMyForm.SelectSingleNode("/my:myFields/my:Network/my:AdapterInfo/my:nicMac", ns)
.SetValue(nicMac);
xnMyForm.SelectSingleNode("/my:myFields/my:Network/my:AdapterInfo/my:nicIp", ns)
.SetValue(nicIp);
counter++;
AddItem(nicName, nicMac, nicIp);
DeleteFirstEmptyItemNIC();
}
}
}
private void AddItem(string nicName, string nicMac, string nicIp)
{
XmlDocument doc = new XmlDocument();
XmlNode group = doc.CreateElement("AdapterInfo",
NamespaceManager.LookupNamespace("my"));
XmlNode field = doc.CreateElement("nicName",
NamespaceManager.LookupNamespace("my"));
XmlNode node = group.AppendChild(field);
node.InnerText = nicName;
field = doc.CreateElement("nicMac",
NamespaceManager.LookupNamespace("my"));
node = group.AppendChild(field);
node.InnerText = nicMac;
field = doc.CreateElement("nicIp",
NamespaceManager.LookupNamespace("my"));
node = group.AppendChild(field);
node.InnerText = nicIp;
doc.AppendChild(group);
MainDataSource.CreateNavigator().SelectSingleNode(
"/my:myFields/my:Network",
NamespaceManager).AppendChild(doc.DocumentElement.CreateNavigator());
}
private void DeleteFirstEmptyItemNIC()
{
XPathNavigator domNav = MainDataSource.CreateNavigator();
XPathNavigator itemNav = domNav.SelectSingleNode(
"/my:myFields/my:group1/my:group2[1]",
NamespaceManager);
if (itemNav != null)
itemNav.DeleteSelf();
}
}
}
|
|
|
|
|
Look into the System.Net.NetworkInformation namespace, in particular the NetworkInterface.GetAllNetworkInterfaces method. For each one you can call the GetPhysicalAddressMethod. That should make your code cleaner (and faster). This will also allow access to each interface's IP address using the UnicastAddresses property of the GetIpProperties() method
|
|
|
|
|
Hi,
from MSDN: Object.ToString() returns a String that represents the current Object.
The default implementation returns the fully qualified name of the type of the Object.
This method can be overridden in a derived class to return values that are meaningful for that type.
So the output you are getting tells you it isn't a string, it is an array of strings; so have a closer look and discover how you may use that information to your advantage. Chances are string.Join() will come in handy.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
here is the mistake
string nicMac = (queryObj.Properties["MACAddress"].Value != null) ? queryObj.Properties["MACAddress"].Value.ToString() : "";
string nicIp = (queryObj.Properties["IPAddress"].Value != null) ? queryObj.Properties["IPAddress"].Value.ToString() : "";
IPAddress, MACAddress, IPSubnet...all returns string array and you are calling ToString() of string array
here is a code snippet I used
string[] ipaddresses = (string[])netCI["IPAddress"];
string[] subnets = (string[])netCI["IPSubnet"];
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
This has happened a few times to me. I have a form with 3 radio buttons. Here is the code for the form's load event handler: (Ignore variable naming)
this.isLoading = true;
this.RadioButton1.Checked = false;
this.RadioButton2.Checked = false;
this.RadioButton2.Checked = false;
this.isLoading = false;
I have an event handler which handles the checkedchanged of all the three radio buttons. The handler should exit if isLoading is true. However, after the last statement in form's load event, the radio button checkedchanged event is fired and I can not figure out why/how it is fired. Since isLoading is false it goes into the eventhandler of the radio button and one of the radio buttons is checked but how? I have no idea.
How can I figure this out? This has happened to me a few times.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
put a breakpoint inside the event handler and then view the call stack when the breakpoint gets hit. that should help you figure out how it's getting called.
|
|
|
|
|
What might be happening is that if the radioButtons are in a group (all in the same control will do for that), one of them should be checked. They are option selectors, so, one option should be true.
The solution for this depends on what you are using them for, but one way is to add an extra radioButton labelled 'None' and set that to checked.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
how about this:
first your Form_Load handler gets executed on the GUI thread; it fires three Button_Changed events, which sit in the event queue since the GUI thread is still busy loading your form. When that is done, and well after you have set isLoading true again, the three Button_Changed handlers get executed by the GUI thread, and they do what you don't want to be done...
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thank you all for the wonderful suggestions. I will try your suggestions to see what might be causing it.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Hi , Have a good day ...
I have a little problem in my router simulation program
here is an explaining for it :
suppose I have 5 pionts : pt 1 , pt 2 , pt 3 , pt 4 , pt 5
--------------------------------
pt 1 is connected to pt 2
pt 1 is also connected to pt3
pt 2 is connected to pt 4
pt 4 is connected to pt 5
--------------------------------
so it's very clear that there are two points btween pt 1 , pt 5
pt 1 --- > pt 2 ----> pt 4 ------> pt 5 ...
How I can figure that out in my application ?
I don't need you to write for me a code ( I will glade if you did )
but may be you can help .. in an algorthim , or something like that ...
or provide me with hint ..
and many thank in advance ?
----
P.S
is this is the right place for my Question ?
may be you can tell me where should I ask , such a Question ..
Kind regards
I know nothing , I know nothing ...
|
|
|
|
|
Try googling for "shortest path algorithm".
You might have got more help in the 'Algorithms' Forum.
However, if you do as suggested above and then get stuck in a particular place whilst trying one of the hits out, so long as you are using C#, this would be the right place.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Well, if the points are just a few, I would go with brute force algo.
BTW the right place to post such a question is the Algorithms forum [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|