|
Hi Peshkunta,
Thanks for the reply.
I tried adding your code to mine..
But the problem is that there are no properties of the form named as either AutoScaleDimensions or AutoScaleMode:
....<br />
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);<br />
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;<br />
....
I searched the MSDN too, but no such property is listed there. At the most, i was able to find AutoScaleBaseSize and ClientSize.
Here's my code. Can you please see, if there is anything which i need to add.
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
this.textBox1.BackColor = System.Drawing.Color.White;
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox1.ForeColor = System.Drawing.Color.Black;
this.textBox1.Location = new System.Drawing.Point(16, 168);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(269, 16);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox1.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(102)), ((System.Byte)(102)), ((System.Byte)(153)));
this.richTextBox1.Location = new System.Drawing.Point(16, 32);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedHorizontal;
this.richTextBox1.Size = new System.Drawing.Size(269, 128);
this.richTextBox1.TabIndex = 2;
this.richTextBox1.Text = "";
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(433, 260);
this.BackColor = System.Drawing.Color.Lime;
this.ClientSize = new System.Drawing.Size(312, 208);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.textBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "Form1";
this.TransparencyKey = System.Drawing.Color.Lime;
this.KeyPreview = true;
this.Resize += new System.EventHandler(this.Form1_Resize);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
this.Load += new System.EventHandler(this.Form1_Load);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
this.ResumeLayout(false);
}
Please see, if i am missing anything !!!!
Thanks.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
I think the problem is in the event handler functions Form1_Resize, and the others:
this.Resize += new System.EventHandler(this.Form1_Resize);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
this.Load += new System.EventHandler(this.Form1_Load);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseUp);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
If you can, I would like to see the code in those. I was wondering what method/way you use to minimize the form/dialog since your dialog has no border. Are you using a button, or just a hit-test location on the form to click? If you want to have your own custom minimize button, one easy way to do it is to create a normal button and set it to Flat style, with no text and your image in the button that can change when you press for button being pressed, etc. Make sure the Flat button BorderSize is set to 0 otherwise there will be a border there. And make sure the MouseDownBackColor and MouseOverBackColor are set to Transperent.
-- modified at 1:05 Wednesday 28th December, 2005
|
|
|
|
|
Hi Peshkunta...
Thanks...
That was a real help.
There is some problem with my code.
I had actually used an image which would minimze the window when clicked.
i had always wanted to create a custom button.
Hey, but i am not able to find any property of the button called as BorderSize, MouseDownBackColor and MouseOverBackColor.. Are you talking about VC or C#..??
Maybe i am missing something.. can you please figure it out.
Thanks in advance.
Amrit.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
I'm using C# - Visual Studio 8 (2005).
In the button Properties window look for FlatStyle property. Just above it is a propery called FlatAppearence and in front of the text is a + if you click on it it will expand and show you BorderSize, etc.
|
|
|
|
|
Oh great..
No wonder i am not able to find it.
I am using Visual Studio 7.1
I'll check it out... thanks for the help.
Sorry for disturbing you for so long.
I realy appreciate your help.
Thanks a lot.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Not a problem at all - glad to help.
If you don't have the option to do the transparent color in the flat button, alternatively you can use PictureBox or Panel control (I would go with PictureBox) for the same effect. I use PNG files for transparency - if it's transparent in the PNG file it comes out transparent in the button, imagebox, panel etc. Let me know if you find the flat style button transparency property and if you have any other question. You can also make a custom form/dialogbox. So it doesn't have to have the sharp edges - you can have a circle dialog box. If you don't know how to do it and need that, let me know.
PS.
Look and see if you have these properties:
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
this.button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
|
|
|
Yes..
thats exactly what i am doing.. i have made up the window using some images (using GDI+).
That minimize problem was occuring because of the code that i had written for detecting the click on that image used for closing the window. I havent worked down to the root of the problem yet.. i'll do it once i get out of my office.
I was actually inspired to make such a custom window when i used Google Talk.
Its cool... i have made seperate images for the titlebar, the body and the buttons. I had some problem while customizing the button, so i left it for the meanwhile. So, i use GraphicsPath to bring them all together and compose the window.
But i have a problem in store for me... how do i go about writing code to help the user in expanding the window. I mean how to detect when the mouse has been placed on the border of the window and how to expand the window.... because if i do so, the images will be distorted.
Can you tell me, how to go about doing it. Or simply put, what approach do you use... (something which i can implement in Visual Studio 7)
Thanks !!!!
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
That would be more challenging. Normally the skins in a custom app don't change - the app doesn't visually resize. What you could do in that case is have 4 pictureboxes and dock them in each corner. When the app resizes so will the pictureboxes automatically. What you would have to do in that case is make sure the picture of the border/frame is very high resolution/large picture - large enough so that when it explands it won't get pixelated.
-- modified at 3:37 Wednesday 28th December, 2005
|
|
|
|
|
Hmmm.. that would be nice.. i'll give it a try.
Well, you are right that such windows are rarely expandable..
Hey, but look at Google talk window... it is allowed to expand the window there. But very cleverly, they have the background of the window as white... must be some nice trick up their sleeves.
Anyway, i'll give it a try and let you know.
Thanks for all the cool advice.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
There is a way to make custom controls with custom properties that is much cleaner than this, but it requires more code.
Google talk doesn't seem hard to make, with exception of the semitransparent shadow if this shadow is not caused by the operating system.
Check this out:
http://www.ondotnet.com/pub/a/dotnet/2002/03/18/customcontrols.html
-- modified at 4:40 Thursday 29th December, 2005
|
|
|
|
|
thanks man..
its great !!!!
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Oh.. i am extremely sorry....
After reading your reply and sending my reply, i made a different form and created a button to help it minimize and also added code to help it move around.
But this one is working fine...
Seems that there is something wrong with my code.
I'll look into it and let you know whatever the problem was.
Thanks a lot man.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Hi
This question is related to printing in .NET winform application, I am working on a wizard kind of application (in.NET using C# language) where in user will be guided through a set of win forms that collects user response for a series of questions (and stores/saves as a file in a srialized format).
I am at a stage where in i have to implement the "print and print preview" functionality for this application, Could you please suggest what is the best method to accomplish this task?
Tricky bit for me is - wizard/questionnaire contains (at some stage) a list view that will have entries which opens into child windows where the detailed information is displayed.(for eg, if the wizard collects information about a student, at some stage it has to provide in a list view, number of subjects he/she enroled into and upon clicking it opens a child window with details of subject/enrolment).
Your help in any form is greately appreciated!! Sorry if i haven't explained the problem clearly!!!
Thanks
Sr
|
|
|
|
|
Check this out:
http://www.c-sharpcorner.com/winforms/texteditor.asp
http://www.ondotnet.com/pub/a/dotnet/2002/06/24/printing.html
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprintingprintdocumentclassprinttopic.asp
"Don't worry about the world coming to an end today. It's already tomorrow in Australia"
|
|
|
|
|
Hie,
I want to know is there any method to Stop File Creation,modification in C#.
Secondly,I also want to know is there any way to Stop Cookie creation from any Website in C#.
Please We need the answer urgently as we r working on a project and the time frames are very short.
SAM.
SAM
|
|
|
|
|
Hi,
I'm no expert in this field, but take a look at code based security. By applying 'evidence' to your assemblies (or somewhere) you can control what they do. This is the mechanism used to stop an untrusted control running in IE on a local user's machine maliciously damaging files etc.
Regards,
Rob Philpott.
-- modified at 8:09 Tuesday 27th December, 2005
.. or is it Code Access Security...
|
|
|
|
|
I need to add online help functionality in my project(.Net), how to do that?
|
|
|
|
|
I extend a textbox for keypress event.
a form includes one extended textbox and a button which is accept button of form.
But when after editing text when u press Enter key , doesnt raise button_click event. How can pass this event to FORM when user press ENTER key after edit text.
|
|
|
|
|
if your case what i understand that after the user enters or modify the text he/she will press enter and the form should the run the code for that button .
so Simply select the form in the design Area and click F4 for properties the at go to Accept Button And choose your button.
as simple as that if this was your case .
|
|
|
|
|
Make sure in the Form properties the property KeyPreview is set to true.
of if you can't find it there go to where the Form properties are initialized and put this code there:
this.KeyPreview = true;
//"this" refers to the Form
//or
KeyPreview = true;
//but make sure the code is in the Form class
//otherwise you'll get an error
-- Don't worry about the world coming to an end today. It's already tomorrow in Australia --
|
|
|
|
|
You got me wrong
Form has a button and ExtendedTextbox textBox
Button is already accept button of Form
ExtendedTextbox has keypress event to control entry ,So if u press ENTER, this event handles enter key.
|
|
|
|
|
I understand that, but you need to have KeyPreview = true; to be able to assign the AcceptButton property to a button for it to work without any extra code. (If the KeyPreview property is set to false, your case will only work if the only control on the Form is the button.)
This is part of the code and it doesn't include the Form initialization where you need to put KeyPreview = true;
This is all you need to be able to let's say write something in a textfield, press ENTER and even if your text still has focus it will work.
But if you don't have the KeyPreview set to true, it will not.
//**********************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ButtonPressedCsharpDELETETHIS
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = "Button is pressed";
}
}
}
//*******************************************
-- Don't worry about the world coming to an end today. It's already tomorrow in Australia --
|
|
|
|
|
thanks friend i solved my problem
|
|
|
|
|
Hello,
I would like to have this behavior too.
What is your solution ?
Please
Freg.
|
|
|
|
|
Im having trouble with a Windows application .......
When i run the Application in windows XP NO PROBLEMS
But when i run the APPLICATION ON WINDOWS2000 SP4 i dont get the same results as in XP
although all the nessecary Prerequisites are all installed (MDAC2.8,.NET Framework 2,Windows Installer 3)
The Application Opens up an excel file and read the data to a dataset and then copies one column that a user selects to an arraylist, then Open another excel file and also read the data to the dataset and copies the selected cloumn to another ArrayList and then compares the Arraylist from the first file with the arraylist from the second file and REPORTS in which rows there have been match's ........
so when i run the Application in the XP i GET about 342 Match's but in Windows2000 I GET ONLY 10 MATCHS
i dont know how the Application is Affected by the OS And HOW TO SOLVE THIS !!!!!!!!!
LIVE TO THE BEST WHILE GATHERING KNOWLEDGE AND LOVE IN LIFE
|
|
|
|