|
I will try that, although I'm pretty sure the firewall is going to block anything else
Thank you for your help with this.
|
|
|
|
|
I have Question
1-how to applay undo/redo for draw panel
2-how to draw string on panel with keypress event
3-how to make image that i draw it in panel not dipeared
even click another buttun to draw another ship
|
|
|
|
|
I have Question
1-how to applay undo/redo for draw panel
2-how to draw string on panel with keypress event
3-how to make image that i draw it in panel not dipeared
even click another buttun to draw another ship
|
|
|
|
|
The answer can be found here, on the second link on the page.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Please do not post the same question more than once: delete your other version before it gets a reply!
I'm not going to answer your questions directly: I don't think you are quite ready to go that far, from your questions so far. Instead, some basics which should help you to do some of it, and will set you on the right path.
At present, you are using CreateGraphics to get the Graphics object for drawing, probably in a timer event, or a loop. Am I right?
Don't do that. Instead, handle the Panel.Paint event. (Click on the panel in the designer, select events in the Properties pane - the lightning bolt button - and double click the Paint event).
In the handler routine, you have two parameters:
void panel_Paint(object sender, PaintEventArgs e)
{
}
The sender is the panel that need to be painted, and e is the information you need to know about how to paint it.
Convert the sender to a Panel, and get the Graphics object from e :
void panel_Paint(object sender, PaintEventArgs e)
{
Panel myPanel = sender as Panel;
if (myPanel != null)
{
Graphics g = e.Graphics;
}
}
Don't worry about the conversion code: it just means you can use the same method for more than one Panel if you need to.
You can now use g to draw on the Panel, and it will not disappear.
So, that solves question 3!
How do you draw text? Simple:
g.DrawString("Hello", new Font("Arial",16), Brushes.Black, new Point(0,0));
How do you make the Panel draw when you want? Simple:
myPanel.Invalidate();
Call that when you have changed the information that you want to draw - the position of the text, for example. (Don't call it in the Paint handler, that won't work!)
So that solves question 2!
Question 1 is probably way too complex at the moment - which makes me think you have asked the wrong question! If it is still a problem, try asking in more detail about what you are trying to do.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Hi,
Is there a way to know from the browser object, whether the mouse is on a link (clickable data) or not? What I mean is, when we move the mouse on the content displayed, we can see that the mouse cursor changes if its a link. Normally we get the hand cursor.
I would like to know, is there a way (through query or event or something) to know this information (mouse is on clickable data) from the browser object? Do we have any means to obtain this?
Also, how does it actually work? My understanding is, whenever the mouse moves on a link, the browser object informs the OS which in turn inoforms the mouse driver to re-draw the mouse arrow cursor to a hand cursor. Is my understanding correct?
Any inputs/pointers on this is really appreciated.
Thanks in advance.
|
|
|
|
|
Window.status can be parsed to understand if the mouse is in somewere area
Piccadilly Yum Yum
|
|
|
|
|
Hi,
I didn't get you. May be I have not explained clearly about my requirement.
I have a requirement where in the mouse events like click and move are obtained through external events. Then I have to use these events and send them to browser object. For this as a part of POC, what I have done is
a) A simple form on which I have AxWebBrowser object to render the content.
b) Another from which will send the mouse events (move or click) along with the position.
c) TCP socket communication to send and receive mouse events.
d) On receiving the events, I will send them to browser object through SendMessage or PostMessage.
Now what I want is, when there is a mouse move event, after sending the event to browser object through SendMessage/PsotMessage, is there any way to find out if the mouse is on a clickable link or object of the content being rendered. I have to use these events to redraw the cursor manually. Do we get any events or way to get this information from the browser object. If yes, please give let me know how to do it in C#.
Any help is appreciated.
|
|
|
|
|
I would use css - take a look at this: CSS Cursors[^]
Regards
Espen Harinn
|
|
|
|
|
create an email application for own website
|
|
|
|
|
OK. Go ahead. We don't mind if you do.
Did you have a question?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
May be he is seeking Code Project's permission...
|
|
|
|
|
|
Here is a VB.Net version I wrote some time ago, you can easily convert to c#.
Imports System
Imports System.Net
Imports System.Net.Mail
Imports System.Net.Mail.MailMessage
Imports System.Net.Mail.SmtpClient
Partial Class contacts
Inherits System.Web.UI.Page
Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
End Sub
Protected Sub ContactName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ContactName.TextChanged
End Sub
Protected Sub ContactAddress_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ContactAddress.TextChanged
End Sub
Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged
End Sub
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Public Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strName As String
Dim strAddress As String
Dim strMessage As String
Dim strType As String
Dim strSendTo As String
Dim strSendFrom As String = "website@address.com"
Dim CompleteMessage As String
strName = ContactName.Text()
strAddress = ContactAddress.Text()
strMessage = TextBox1.Text()
strType = RadioButtonList1.SelectedValue
Select Case strType
Case "sales"
strSendTo = "Person1@address.com"
Case "contractors"
strSendTo = "Person2@Address.com"
Case "general"
strSendTo = "Person3@Address.com"
Case Else
strSendTo = "Person4@Address.com"
End Select
CompleteMessage = "Message From Website " & vbNewLine & strSendFrom & vbNewLine & strSendTo _
& vbNewLine & vbNewLine & strType & vbNewLine & strMessage
Dim mailClient As New SmtpClient()
Dim Message As New MailMessage()
Dim ToEmail As New MailAddress("Person1@address.com", "")
Dim FromEmail As New MailAddress(strSendFrom, "")
'String builder is used for performance reasons whil appending strings
Dim messageBody As New System.Text.StringBuilder()
messageBody.Append("Message Received From Website")
messageBody.AppendLine()
messageBody.Append(strType)
messageBody.AppendLine()
messageBody.Append(strSendFrom)
messageBody.AppendLine()
messageBody.Append(strSendTo)
messageBody.AppendLine()
messageBody.Append(strMessage)
Message.Body = HttpUtility.HtmlDecode(messageBody.ToString)
Message.Subject = strType
'Message is sent in html format
Message.IsBodyHtml = True
Message.To.Add(ToEmail)
Message.From = FromEmail
Try
mailClient.Send(Message)
Catch ex As Exception
End Try
End Sub
End Class
You call it in the ASP page with something like this:
</td>
<td colspan="2" bgcolor="#CCFFCC">
We are happy to hear from you on any matter, so please feel free to make
any comments or ask any questions using this form.<br />
<br />
<asp:TextBox ID="ContactName" runat="server" Width="300px">Your Name</asp:TextBox>
<asp:TextBox ID="ContactAddress" runat="server" Width="300px">Email Address</asp:TextBox>
<br />
<br />
Please indicate what type of contact:<br />
<asp:RadioButtonList ID="RadioButtonList1" runat="server" Width="237px">
<asp:ListItem Value="sales">Sales Enquiry</asp:ListItem>
<asp:ListItem Value="contractors">Contractors Enquiry</asp:ListItem>
<asp:ListItem Value="general">General Enquiry</asp:ListItem>
<asp:ListItem Value="other">Other</asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="TextBox1" runat="server" Height="130px" TextMode="MultiLine"
Width="618px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Height="36px" Text="Send"
Width="102px" />
</td>
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
This is a very good answer...
|
|
|
|
|
You could up vote it if you like
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Over my head, Sir; (I upvoted you.)
Help people,so poeple can help you.
|
|
|
|
|
Search on the internet. You will get plenty of examples / samples for download.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
|
Hi guys,
I have the above exception that appears to me when executing my code:
protected void Page_Load (object sender, EventArgs e)
{
if (this.Request ["ActionButton"] == "Generate")
{
string Json = "";
SLSalariesCollection salaries = new SLSalariesCollection (this._Session);
salaries.Init ();
string fileName = @"D:\New Folder\MyXmlff.xml";
if (System.IO.File.Exists (fileName))
{
System.IO.File.Delete (fileName);
}
XmlTextWriter myXmlTextWriter = new XmlTextWriter ("D:/New Folder/MyXmlff.xml",System.Text.Encoding.UTF8);
myXmlTextWriter.Formatting = Formatting.Indented;
myXmlTextWriter.WriteStartDocument(false);
myXmlTextWriter.WriteStartElement("root");
myXmlTextWriter.WriteAttributeString("xmlns","urn:iso:std:iso:20022:tech:xsd:pain.001.001.02");
myXmlTextWriter.WriteStartElement("pain.001.001.02");
int j = 0;
DateTime Now = DateTime.UtcNow;
string datevir = Now.ToString();
Boolean batch = true;
foreach (SLSalarie salari in salaries)
{
j++;
Json = Json + "{succeed : 1}";
myXmlTextWriter.WriteStartElement("Salarié", salari.Matricule);
}
myXmlTextWriter.Flush();
myXmlTextWriter.WriteEndElement();
myXmlTextWriter.WriteEndElement();
myXmlTextWriter.Close();
this.Response.ClearContent();
this.Response.Write(Json);
this.Response.End();
}
the problem that the code is sometimes excuting very well,sometimes no and appear to me this fatal EXCEPTION.
I think that it is problem of refreshing my references.i did this.The first time, ok running very well,the second time EXCEPTION appears.
when doing breakpoints,the problem appears in the collection'initiation.How can I solve that?
also when reading about the class xmltextwriter,i know that i should treat that in my code c#.So do i should to add to my code to solve that?
Thank u very much for u help
hugs
|
|
|
|
|
Where does the exception happen? The message should tell you which line...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Hello,
The exception appears when initiating my collection always:
SLSalariesCollection salariers = new SLSalariesCollection (this._Session);
salariers.Init ();
also xmltextwriter,as I read in msdn it provides also an exception but i don't know how to treat it
ty
|
|
|
|
|
Then either the problem is in the constructor (which you don't show) or in the _Session class variable.
We would need the code for the constructor and / or the variable load.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
hi,
this is the code of my load :
protected override void OnLoad (EventArgs e)
{
try
{
_ApplyCacheStrategy ();
string pageTitle = this.PageTitle;
if (pageTitle != null && (
this.Title == null || this.Title == this.SessionData.PageTitleToOverride))
{
this.Title = pageTitle;
}
_AddCheckServerErrorScript ();
_AddJsReportingScript ();
if (this.RootToken == null)
this.RootToken = _GetRootToken ();
this._PageTask = new WEAppPageTask (this.PageTaskString);
WEAppPageAccess pageAccess;
pageAccess = GetAccess ();
WEAppCheckingAccessResult checkResult = _CheckPageAccess (pageAccess);
pageAccess = GetAccess ();
if (checkResult != WEAppCheckingAccessResult.AUTHORIZED_ACCESS && !_TryChangePageAccess (pageAccess, checkResult))
{
pageAccess = GetAccess ();
_PageAccessDenied (pageAccess, checkResult);
throw new BSCInvalidOperationException ("Method _PageAccessDenied must throws exception or aborts current thread");
}
pageAccess = GetAccess ();
if (pageAccess == null)
throw new BSCInvalidOperationException ("Null access");
if (pageAccess.AccessWeight > -1)
pageAccess.AccessWeight --;
pageAccess.PageAccessState = WEAppPageAccess.GetPageAccessState ();
this.PageAccessState = pageAccess.PageAccessState;
if (pageAccess.PageAccessClean == null)
pageAccess.PageAccessClean = new WEAppPageAccessClean (PageAccessClean);
Thread.CurrentThread.CurrentCulture = this.AppCultureInfo;
base.OnLoad (e);
if (this.BindablePage)
DataBind ();
}
catch (Exception exception)
{throw BSCExceptionPropagation.Throw (exception, MethodBase.GetCurrentMethod (), GetType ());}
}
ty
|
|
|
|
|
That code doesn't set your _Session variable...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|