|
The answer to your question is no, you can not show a control onto 2 separate forms in the same time... you could acces the panels data instead if you pass it as a parameter to your other form, or by any other way prefered by you...
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
Hi all,
In a MDI form container, I tried to add a splitter to seperate two child forms at two different sides (left and right) but failed to do so. What I can do is to use a splitter to seperate a window control(such as panel) and a form, but not two forms, why ?
Thanks
|
|
|
|
|
The MDIParent child client area cannot be split into two seperate client areas. This behavior is by design.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi
Whether exist way to trim from string all occurency of unreadable characters.
Examp:
<br />
string str = "Hello world\t\n...something unreadable else..";<br />
<br />
string res = str.SomeFunction();<br />
<br />
Thank
|
|
|
|
|
|
Thank
But i didn't wont to enum all unreadable characters in some array, and pass one as parameter to Trim. I just wish to invoke some single function to achive my result.
|
|
|
|
|
String.Trim() is a single function I doubt there is colection of whitespace - {space}. What does exactly what you want is reading XML with "ignore whitespace" flag. I'll look how it's done there... wait a moment
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
hehe this is how they do it! I've found these functions in url parser, I doubt there is common collection or something like that. If you want single function write it by yourself
ROTOR (Microsoft CLI implemenation) says:
<br />
<br />
PRIVATE inline BOOL IsInsignificantWhite(WCHAR ch)<br />
{<br />
return (ch == TAB ||<br />
ch == CR ||<br />
ch == LF);<br />
}<br />
<br />
#define IsWhite(c) ((DWORD) (c) > 32 ? FALSE : TRUE)<br />
<br />
PRIVATE void TrimAndStripInsignificantWhite(WCHAR *psz)<br />
{<br />
ASSERT(psz);<br />
<br />
if(*psz)<br />
{<br />
<br />
LPCWSTR pszSrc = psz;<br />
LPWSTR pszDest = psz;<br />
LPWSTR pszLastSpace = NULL;<br />
<br />
while(*pszSrc && IsWhite(*pszSrc)) {<br />
pszSrc++;<br />
}<br />
<br />
while (*pszSrc)<br />
{<br />
if(IsInsignificantWhite(*pszSrc)) {<br />
pszSrc++;<br />
} else {<br />
if (IsWhite(*pszSrc)) {<br />
if (pszLastSpace==NULL) {<br />
pszLastSpace = pszDest;<br />
}<br />
} else {<br />
pszLastSpace = NULL;<br />
}<br />
<br />
*pszDest++ = *pszSrc++;<br />
}<br />
}<br />
<br />
if (pszLastSpace) {<br />
*pszLastSpace = L'\0';<br />
} else {<br />
*pszDest = L'\0';<br />
}<br />
<br />
}<br />
}<br />
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
|
Hi~
How to remove the control box (The 3 buttons of a window at the top right corner) of a MDI Form?
I have set the formborderstyle to none. However, when I set the form to be maximized, the control box still in there.
How to remove them? Thanks
|
|
|
|
|
|
Try this three Form class properties ControlBox , MaximizeBox , MinimizeBox , you can hide an show them during run time as you wish
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
im doing a remoting program. I'm just wondering why i always get this error message "An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll. Additional information: Because of security restrictions, the type clsServiceApp.CallContextString cannot be accessed. " on my second test in the client side.
Here's my code in the server:
public static void Main(string[] Args)
{
HttpChannel channel = new HttpChannel(8080);
ChannelServices.RegisterChannel(channel);
WellKnownServiceTypeEntry WKSTE = new WellKnownServiceTypeEntry(typeof(clsServiceApp.ContextBoundType),"TcpCBOService", WellKnownObjectMode.SingleCall);
RemotingConfiguration.RegisterWellKnownServiceType(WKSTE);
Console.WriteLine("Press enter to stop this process.");
Console.ReadLine();
}
---------------------------------
Here's my code in my middle tier:
public interface IContextBoundType
{
void ConnectToServer();
string SendToServer(string strValue);
}
public class ContextBoundType : ContextBoundObject//, IContextBoundType
{
private DateTime starttime;
private HttpChannel channel;
public ContextBoundType()
{
Console.WriteLine("#Connecting...");
starttime = DateTime.Now;
}
public void ConnectToServer()
{
channel = new HttpChannel();
ChannelServices.RegisterChannel(channel);
WellKnownClientTypeEntry remotetype = new WellKnownClientTypeEntry(typeof(ContextBoundType),"http://localhost:8080/TcpCBOService");
RemotingConfiguration.RegisterWellKnownClientType(remotetype);
// CallContext.SetData("ServerThreadData", new CallContextString(remotetype==null ? "Could not locate server" : "#Done Connecting..."));
}
public void DisConnectFromServer()
{
ChannelServices.UnregisterChannel(channel);
// CallContext.SetData("ServerThreadData", new CallContextString(remotetype==null ? "Could not locate server" : "#Done Connecting..."));
}
~ContextBoundType()
{
Console.WriteLine("ContextBoundType being collected after " + (new TimeSpan(DateTime.Now.Ticks - starttime.Ticks)).ToString() + " seconds.");
}
public DateTime GetServerTime()
{
return DateTime.Now;
}
public string SendMessageToServer(string strValue)
{
CallContext.SetData("ServerThreadData", new CallContextString(strValue));
// Console.WriteLine(strValue);
return strValue;
}
}
[Serializable]
public class CallContextString : ILogicalThreadAffinative
{
String _str ="";
public CallContextString(String str)
{
_str = str;
Console.WriteLine(str);
}
public override String ToString()
{
return _str;
}
}
-------------------------------------
Here's my code in the client side:
private void SendMessageToServer()
{
clsServiceApp.ContextBoundType();
clsServiceApp.ContextBoundType _service1 = new clsServiceApp.ContextBoundType();
lvwStatus.Items.Add("Sending messages to server...");
string s = _service1.SendMessageToServer(txtMessage.Text);
lvwStatus.Items.Add("Server already received message (" + ") <" + s.ToString() + ">");//_service.GetServerTime().ToLongTimeString() +
txtMessage.Text="";
}
private void Form1_Load(object sender, System.EventArgs e)
{
clsServiceApp.ContextBoundType _service = new clsServiceApp.ContextBoundType();
_service.ConnectToServer();
}
-chinimimita-
|
|
|
|
|
hello,
Can anybody explain me here how I can save some drawed rectangles in a jpg or bmp file?
thx
mathon
|
|
|
|
|
hi mathon,
try something like:
<br />
Bitmap bmp = new Bitmap(100,50);<br />
Graphics g = Graphics.FromImage(bmp);<br />
<br />
g.DrawString("myText",FontFamily.GenericMonospace,Brushes.Black,0,0);<br />
<br />
bmp.Save("filename.bmp");<br />
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hello,
Thank you very much for your reply. Beside the drawed rectangles I have some labels on the form. Is it possible to save also these labels in this bmp file? If yes how does it work?
thx
mat
|
|
|
|
|
mathon wrote:
Beside the drawed rectangles I have some labels on the form. Is it possible to save also these labels in this bmp file?
Don't you want to take a screenshot?
http://www.codeproject.com/csharp/ImageCapture.asp[^]
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
Hello,
I tried it with something like that:
public void DrawStringRectangleF(int a, int b, int c, int d, System.Drawing.Color color, string text)
{
Bitmap bmp = new Bitmap(1400,1000);
Graphics g = Graphics.FromImage(bmp);
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(color);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
String drawString = text;
// Create font and brush.
Font drawFont = new Font("Verdana", 8);
SolidBrush drawBrush = new SolidBrush(Color.White);
// Create rectangle for drawing.
int x = a;
int y = b;
int width = c;
int height = d;
Rectangle drawRect = new Rectangle( x, y, width, height);
// Draw rectangle to screen.
Pen blackPen = new Pen(Color.Black);
//e.Graphics.DrawRectangle(blackPen, x, y, width, height);
g.FillRectangle(myBrush,drawRect);
GraphicsUnit units = GraphicsUnit.Pixel;
g.DrawString(drawString, drawFont, drawBrush, drawRect);
bmp.Save("filename.bmp");
}
But that does not work. The bmp-file is created but nothing in it. And when I want to open the file, an error occurs that the format is incorrect. Does anbody know what went wrong??
patrick
|
|
|
|
|
hi,
it works fine for me... I did only copy&paste... maybe check input parameters. I've called it with DrawStringRectangleF(0,0,100,100,Color.Red,"Hello");
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
hello everybody,
I'm creating a web applocation in ASP.Net using C# as page behind code.
I've one form named WebForm1.aspx and there is a textbox control TextBox1 on it. Then I added a class Class1.cs in the application. There are some functions in the class. Now i want to acces the TextBox1 control of WebForm1.aspx in my class Class1.cs . I think we can not acces Webform controls inside a class. Is there any way to acces the control in the class.
Thanks in advance.
|
|
|
|
|
I am trying to display data from a table using the datagrid. This is the code l have used.
cnnOverdueBooks.Open(); <br />
string querySearch = @"SELECT RefNumber, Title, DateOut, DateDue FROM Book WHERE Status = 'On loan' "; <br />
<br />
OleDbCommand cmdDisplayBooks = cnnOverdueBooks.CreateCommand(); <br />
OleDbDataReader drDisplayBooks; <br />
cmdDisplayBooks.CommandType = CommandType.Text; <br />
cmdDisplayBooks.CommandText = querySearch; <br />
drDisplayBooks = cmdDisplayBooks.ExecuteReader(); <br />
grdOverdueBooks.DataSource = drDisplayBooks;
Error message "Complex databinding accepts as a data source either an IList or an IListSource"
Thanks in advance,
Steve
|
|
|
|
|
You can only use databinding with datasets, collections and arrays, not with a DataReader (you're using an OleDbDataReader).
Yes, even I am blogging now!
|
|
|
|
|
Does any one know how to map a network drive using manage c++/C#?
|
|
|
|
|
You either call NetUseAdd API using P/Invoke or try to execute a "net use" command from with System.Diagnostic.Process.Start
Note that if you need the error and status codes of the mapping operation (e.g., access denied, etc), you'll need to choose the NetUseAdd API.
Yes, even I am blogging now!
|
|
|
|
|
Hi,
I have two software system. Each one has a database in SqlServer 2000. One of both have to use another one database and it is better that there was some relation between some tables in two databases. So I think that I must add all tables of first database to second. But DB management will be so difficult because tables of both systems will mixed together.
Can anyone suggest a solution for this problem?
regards,
Mehdi
|
|
|
|