|
Quit simply you can call RichTextBox.Paste . You can either do this using the first available and acceptable format by calling the method with no parameters, or pass the data format you want. See the documentation[^] for the Paste method for more information.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have an asynchronis socket class written by my manager that uses Socket.BeginSend(...) to send messages over the socket. He uses this overload of the function:
public IAsyncResult BeginSend(
byte[] buffer,
int offset,
int size,
SocketFlags socketFlags,
AsyncCallback callback,
object state
);
where the delegate callBack should call another function in the code, HandleSend, which does some important things after a packet is sent. The program goes all the way through the BeginSend function, but randomly, the callBack delegate seems to stop calling HandleSend. I am not sure if this is the problem, but it really looks that way. I don't think I understand how the function BeginSend works in conjunction with the AsyncCallBack delegate. Could there be a thread safe problem with this logic?
Please help!
Thanks,
Lilli
|
|
|
|
|
Hi every one. Can any one please help me with ideas on how I can insert/paste text from a clipboard into the current cursor position in a textbox.
Nana
|
|
|
|
|
Hi Nana!
Use RichTextBox.Paste() .
Regards,
mav
|
|
|
|
|
Its working. Thank you Thank you.;)
Nana
|
|
|
|
|
Here is my problem. I'm trying to draw a vector on a graph on a WinForm.
I want an arrow (triangle) on the end of the line. I have two files.
My pens are "cycled" on each paint event (0, 1, 2.. repeat). Everything works ok. I just can't seem to figure out how to draw an arrow....
Complex.cs
///////////////////////////////////////
private double x
private double y
//Constructor
public Complex()
{
x = 0;
y = 0;
}
public Complex( double _x, _y)
{
x - _x;
y = _y;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////Form1.cs
public Pen[] activePen = new Pen[] { new Pen( Color.Blue, 2 ), new Pen( Color.Green, 2 ), new Pen(Color.Red, 2) };
private int _penIndex = -1;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
private Pen GetNextPen()
{
_penIndex = (_penIndex + 1) % 3;
return activePen[_penIndex];
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
g.DrawLine(GetNextPen(), 250, 250, x, y );
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
Look at the Pen.EndCap property. There is an enumeration that will allow you to put arrows on your line.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
Andy . Thanks. My problem is I can't figure out HOW to put the code in.
Where would it go?
|
|
|
|
|
Pen p = new Pen( Color.Blue );<br />
<br />
p.EndCap = System.Drawing.Drawing2D.LineCap.Triangle<br />
You need to do this for the pens that you want to have a cap.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
Have you read what I wrote you?
I gave you the code and I said you could place it in the constructor...
|
|
|
|
|
Sorry - I'm new to this. WHICH Constructor? The Form or the Complex class?
Thanks.
|
|
|
|
|
In the constructor of the class where the Pen array field is defined and being used.
|
|
|
|
|
I'm starting up on big project that will take much of my time in next year or two. Until now I was mostly self-employed on small projects so I didn't spent so much time modeling system before implementation. Sure, I wrote use cases now and then, draw UML in Visio but it wasn't matter of life and death.
But because of scope in next project I'm kinda frighten that sooner or latter I along my team will get lost in poorly documentet envoirement where no one will know what is truly purpose of system's part that they are working on or how to connect it to another.
So, since lot of envisioning and planning are up ahead I was thinking about sharing tought or two regarding UML modeling, drawing use case diagrams and similar subject. What programs for creating solution architecture you people recommend? I'm in need of something that can truly succesfuly reverse-engeenier and forward-engeneer (UML <-> C#.NET solution). What are your views on 2005 generation of tools (VS.NET 2005 with Visio 2005) that are comming next month? Anyone played long enough with Beta?
Tnx!
|
|
|
|
|
How can I rotate a picturebox? Not just the image inside, but the box as well. I want to rotate the WHOLE control. Any help would be great. Thanks.
D
|
|
|
|
|
I don't think it's possible...
The one and only Niklas Ulvinge aka IDK
|
|
|
|
|
|
I need to alter a C# Windows application to be a C# Web application.
From the documentation I have read that IIS needs to be installed on the development machine to effect this. Is this true ?
I don't have IIS installed as I use Apache. Can this be made to work ?
Regards,
Alf Stockton
|
|
|
|
|
StrayGrey wrote:
I need to alter a C# Windows application to be a C# Web application
=> it's not easy
StrayGrey wrote:
From the documentation I have read that IIS needs to be installed on the development machine to effect this. Is this true ?
Yes
StrayGrey wrote:
I don't have IIS installed as I use Apache. Can this be made to work ?
I'm not sure. just try it
<< >>
|
|
|
|
|
I need to alter a C# Windows application to be a C# Web application.
From the documentation I have read that IIS needs to be installed on the development machine. Is this true ?
I don't have IIS installed as I use Apache. Can this be made to work ?
Regards,
Alf Stockton
|
|
|
|
|
|
Ok, so here is the problem. I'm working on a headless server program
implemented as a .NET C# Console project. There is a UPS mounted to
this server (though not a windows compliant UPS). I can only talk to
the UPS over a special device driver.
Through this device driver I can detect that the UPS is going to notify
Windows 2000 server to shut down. So I start doing a graceful
termination. But Windows shuts down pretty quickly and there isn't time
to close my files and gracefully shut down. Apparently, the default
console application in .NET has a default behavior of terminating
immediately -- at least that is what seems to happen.
What I need to do is to delay windows for long enough (just a few
seconds really) so that I can gracefully terminate. How do I do that
with a console project? How do I delay the time between the time that
Windows 200 Server is told to shut down and the time it actually
teminates it's applications and shuts down? I've done a lot of web
searches and .NET searches but haven't found a console solution. Maybe
all I need is a steer to the right approach.
Thanks.
David W. Griffin
Lockheed Martin Aeronautics Company
|
|
|
|
|
I got a reply on microsoft.public.dotnet.languages.csharp on this that fixed my problem. I'll reprint it here with his permission in case someone searches here and would like to know how this was resolved:
Willy Denoyette [MVP] Oct 5, 12:23 pm
You can register your own Console control handler by calling Win32 API
SetConsoleCtrlHandler.
Conside following snippet as a sample.
enum CtrlType {
CTRL_C_EVENT = 0,
CTRL_BREAK_EVENT = 1,
CTRL_CLOSE_EVENT = 2,
CTRL_LOGOFF_EVENT = 5,
CTRL_SHUTDOWN_EVENT = 6
}
static object locker = new object();
private delegate bool EventHandler(CtrlType sig);
private static bool Handler(CtrlType sig)
{
bool handled = false;
switch (sig)
{
case CtrlType.CTRL_C_EVENT:
case CtrlType.CTRL_LOGOFF_EVENT:
case CtrlType.CTRL_SHUTDOWN_EVENT:
case CtrlType.CTRL_CLOSE_EVENT:
{
.. do whatever you need to do at shutdown time (here for all
other events too), but keep in mind that the system will kill the process
when you fail to return within 30 seconds.
}
// return true when handled, this signals the system to remove
the process
handled = true;
break;
default:
// return false when not handled
return handled;
}
return handled;
}
static EventHandler _handler;
[DllImport("Kernel32")]
private static extern bool SetConsoleCtrlHandler (EventHandler handler,
bool add);
static void Main()
{
// install the handler
_handler += new EventHandler(Handler);
SetConsoleCtrlHandler(_handler, true);
// and go on
...
Willy.
David W. Griffin
Lockheed Martin Aeronautics Company
|
|
|
|
|
I've been trying to find a solution to this problem. Searching here, Business Objects and several other sites, I'm finding many requests outlining the same problem but in none have I found an answer to it.
Given the programatic declaration of a Crystal Report as defined below, it works great in all reports except when I need to use a variable that has to accept multiple values such as prmStatusCodes. With this parameter, the user identifies with check boxes the status' of orders they wish to view.
rptCustomerSummary newRpt = new rptCustomerSummary();
CrystalDecisions.CrystalReports.Engine.ReportDocument rptDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
rptDocument.Load(ReportsPath+"rptCustomerSummary.rpt");
crViewer.ShowGotoPageButton = true;
crViewer.ShowPageNavigateButtons = true;
CrystalDecisions.Shared.TableLogOnInfo rptLogin = new CrystalDecisions.Shared.TableLogOnInfo();
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in newRpt.Database.Tables)
{
rptLogin = tbl.LogOnInfo;
rptLogin.ConnectionInfo.ServerName = dbServer;
rptLogin.ConnectionInfo.UserID = dbReportLoginName;
rptLogin.ConnectionInfo.Password = dbReportLoginPwd;
tbl.ApplyLogOnInfo(rptLogin);
}
currParamValue = new ParameterValues();
paramValue = new ParameterDiscreteValue();
paramValue.Value = CompanyId.ToString();
currParamValue.Add(paramValue);
paramFieldDefs = newRpt.DataDefinition.ParameterFields;
paramFieldDef = paramFieldDefs["prmCustomerId"];
paramFieldDef.ApplyCurrentValues(currParamValue);
currParamValue = new ParameterValues();
paramValue = new CrystalDecisions.Shared.ParameterDiscreteValue();
foreach (int i in ReportOptionIntAry)
{
paramValue.Value = ReportOptionIntAry[i].ToString();
currParamValue.Add(paramValue);
}
paramFieldDefs = newRpt.DataDefinition.ParameterFields;
paramFieldDef = paramFieldDefs["prmStatusCodes"];
paramFieldDef.ApplyCurrentValues(currParamValue);
crViewer.ReportSource = newRpt;
In Crystal Reports, I've defined the parameter prmStatusCodes as a Discrete of type Number and Allow Multiple Values. In the report Select Expert I have
RPT_CUSTOMER_SUMMARY_V.CUSTOMER_ID} = {?prmCustomerId} and
{RPT_CUSTOMER_SUMMARY_V.STATUS_ID} in {?prmStatusCodes}
In the report, if I change {?prmStatusCodes} to [5, 7, 9, 24] as if the user selected those four statuses, it gives the expected results. If I use the parameter and pass in a set of statuses, only those orders that are the status of the first parameter display. It does matter what parameters are passed in, only the first parameter is recognized.
Can someone point out the error of ways?
|
|
|
|
|
I want to populate bool array with all true value
in java there is a method called Arrays.Fill to populate all the elements in an array in one go
Is there anything similar in C# ?
jills
|
|
|
|
|