|
I have MDI form. MDI form contains toolstrip control. Toolstrip control contains menus so that I can call to the other forms
e.g.
client option
I can call client form by clicking the toolstrip client option
Client form act as child of MDI form
It works
Now client form contains one label. With the same functionality I want the forms appears under the MDI form that is MDI form can be display with child form .
It display but cannot capture the whole space of child form.
I am not using the maximize and minimize property
|
|
|
|
|
I'm executing SQL Server stored procedures from C# and I'm having problem figuring out a few things. My stored procedure have become pretty complex and I need to check whether the SP executed successfully or not. What should I do? Should i use a RAISEERROR in the SP, should i use RETURN <value> or should i use SELECT? Once i find out in my C# code that an error has occurred, i want to display the appropriate message to the user. How do I do this? Would i have to enclose the C# code to execute the SP in a try-catch block?
Thanks in advance guys!
|
|
|
|
|
I'd return an error code, and have it map to an enum in the C# for all possible errors, or success.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
what is the best method to reading and analizing binary files?
My file looks like:
3 bytes - tag type
2 bytes - tag lenght
x bytes - tag value
but in tag value can be many things like:
00 0F 00 - tag type
00 20 00 - tag lenght - 32 bytes
XX XX XX ... tag value where : first 16 bytes is a company name and last 16 bytes company address.
Here is full file structure: image
Any proposition?
Greetings
|
|
|
|
|
You obviously need a binary file class, and not a text class. In VS2005, File.ReadAllBytes should do to get the data into memory.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I'd use the .NET BinaryReader .
Read the first 5 Bytes, then read the N bytes of the tag value and so on.
Should be easy enough to read.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have one main form.
there are 4-5 label control and i want to call forms with associated with that label control.
if you instead of label How can i used Linklabel control to call the form.
How can i call.
|
|
|
|
|
The linklabel has an onclick, you use that to open your new form. You can't create links to forms, you have to fake it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Is it possible to perform a trap or catch of an application that is forcibly killed from the Windows Task Manager or similar alternative, so that I can perform some late backing up of data just before the process disappears?
I wonder if Windows applications are as forgiving as Linux processes where I can make use of signal handlers.
Please advise, naturally it's in C# .NET 2.0, thanks in advance.
|
|
|
|
|
You should be able to achieve this by registering an event handler to the Application.Exit event or even the Form.FormClosing event.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Well... for that matter, I tried, but it only works if you exit the application normally. Clicking the close button on the form. But if you attempt to kill it from the Windows Task Manager, neither events will be handled. The application was forcibly killed off and nothing happens, not my event handler codes will run upon ending task. What I'm talking about is you pull our Windows Task Manager, go to processes tab, right-click on the process for the context menu, kill process.
|
|
|
|
|
I dont expect this to be possible: AFAIK task manager kills without the process getting
involved in whatever way, independent of programming languages, .NET, e.a.
I also expect, but am not sure, a user could not kill:
1) another user's app
2) a service
not even with task manager.
So other than removing task manager (probably not wise), that is the direction you
might want to go, but it has its consequences of course (e.g. other user = other
access rights).
Added: but an administrator (or a user with sufficient clearance) always could kill it...
PS: hope someone can confirm or rectify this.
-- modified at 16:36 Sunday 4th February, 2007
-- modified at 16:37 Sunday 4th February, 2007
Luc Pattyn
|
|
|
|
|
I would like to be able to "reveal" an image with the mouse (mouse down + mouse move) to mimic the way those lottery scratch cards work. Any help would be appreciated.
|
|
|
|
|
Create a texture brush of your bitmap. Create a path out of the movement of the mouse, and paint that path using the texture brush. The bits of the bitmap that are in the path will be drawn.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I'm missing something here, obviously, here's the test code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
Image scratchimage;
public Form1()
{
InitializeComponent();
scratchimage = Image.FromFile(@"C:\usntps\aircraft\fa-18b.bmp");
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
GraphicsPath graphicsPath = new GraphicsPath();
graphicsPath.AddEllipse(new Rectangle(e.X - 10, e.Y - 10, 20, 20));
pictureBox1.Region = new Region(graphicsPath);
pictureBox1.BackgroundImage = scratchimage;
graphicsPath.Dispose();
}
}
}
}
This will paint a circle of the correct part of the image to the picturebox after I release the mousebutton, but I can only click within that painted portion on subsequent attempts, and only the new image portion is maintained.
|
|
|
|
|
Throw away the picturebox, it's useless for what you want to do. Do what I said to do, create a texturebrush, and then draw with it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks, figured it out:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
TextureBrush myBrush = new TextureBrush(new Bitmap(@"C:\usntps\aircraft\fa-18b.bmp"));
public Form1()
{
InitializeComponent();
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Graphics g = pictureBox1.CreateGraphics();
g.FillEllipse(myBrush, new Rectangle(e.X - 10, e.Y - 10, 20, 20));
}
}
}
}
|
|
|
|
|
How do you make a text box that will let you only format certain words? For example, in Word, you can change the font and size of a certain word. Is there such a Control that will do this? Thanks in advance.
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
The RichTextBox control can do this. There are some articles on this site regarding how to do this, as well as plenty of documentation on MSDN.
|
|
|
|
|
Could anyone tell me how I could get my program to go from this...
Old[^]
to this?
New[^]
Sorry for the links... I don't think you can post actual images onto the forums.
I would like for the toolbar and main menu to resemble those of Office 2003.
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
If you're working with .NET 2.0, the default ToolStrip and MenuStrip controls look like Office 2003.
If you're still using .NET 1.1, taske a look at this[^] for menus; for toolbars, you'll have to find something or write your own custom drawing code.
|
|
|
|
|
I am working with .NET 2.0, and using Application.EnableVisualStyles(); . The first image is the end product.
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|
|
Have you made sure that you're using the ToolStrip and MenuStrip classes instead of the old MenuBar and Toolbar classes, and that their RenderMode properties are set to ToolStripRenderMode.Professional , or are set to ToolStripRenderMode.ManagerRenderMode with the Renderer set to an instance of the ToolStripProfessionalRenderer class?
|
|
|
|
|
The first one is using the System.Windows.Forms.Menu. The second one is using the System.Windows.Forms.MenuStrip.
|
|
|
|
|
Ahh... Thanks!
-----
Note: *** Never give me an answer have anything to do with Visual Studio. I don't have this program, and it'll be that way for a long, long time. ***
|
|
|
|