|
I have set the alpha values of the brushes and pen, why isn't it blending into the form?
http://img153.imageshack.us/img153/2372/ss0001cn7.png[^]
Is there anyway to do this correctly?
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
<br />
this.AutoSize = false;<br />
this.BackColor = Color.Transparent;<br />
<br />
Graphics g = e.Graphics;<br />
<br />
g.SmoothingMode = SmoothingMode.AntiAlias;<br />
g.CompositingMode = CompositingMode.SourceOver;<br />
g.CompositingQuality = CompositingQuality.HighQuality;<br />
<br />
LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, Color.FromArgb(alpha, Color.Gray), Color.FromArgb(alpha, Color.Silver), LinearGradientMode.Horizontal);<br />
g.FillRectangle(brush, this.ClientRectangle);<br />
<br />
Pen pen = new Pen(Color.FromArgb(alpha, Color.Red));<br />
g.DrawRectangle(pen, 0, 0, this.Size.Width - 1, this.Size.Height - 1);<br />
<br />
SolidBrush fontBrush = new SolidBrush(Color.FromArgb(alpha, Color.Black));<br />
g.DrawString("Crap", this.Font, fontBrush, 10.0f, 10.0f);<br />
}<br />
|
|
|
|
|
Hello,
Zerox MXI wrote: why isn't it blending into the form?
Because the Color.Transparent only means, that the Control shows the BackColor of the ContainerControl.
Apart from that, you have to care about your instanciated GDI object (Brushes, Pen, ...)!
They have to be" Dispose()";
You could call "fontBrush.Dispose();" or use a "using"- block:
using(SolidBrush fontBrush = new SolidBrush(Color.FromArgb(alpha, Color.Black)))
{
g.DrawString("Crap", this.Font, fontBrush, 10.0f, 10.0f);
}
Or hold the objects as long as the Control get's disposed and do the disposing there!
All the best,
Martin
|
|
|
|
|
As I am developing one windows application, I want to show one report to user. Previously iwas using datagrid but it dosen't solve the purpose as format of this report some thing like values in multiple rows and their respective totals. so I request you to please help me to create database driven dynamic table.
Thanx
Gurudatta B. Shelke
|
|
|
|
|
Hi,
You should try using the DataGridView control. It provides numerous basic and advanced features that are missing in the DataGrid control. Additionally, the architecture of the DataGridView control makes it much easier to extend and customize than the DataGrid control.
The following are the primary features available in the DataGridView control that are missing from the DataGrid control.
DataGridView control feature
Multiple column types
The DataGridView control provides more built-in column types than the DataGrid control. These column types meet the needs of most common scenarios, but are also easier to extend or replace than the column types in the DataGrid control.
Multiple ways to display data
The DataGrid control is limited to displaying data from an external data source. The DataGridView control, however, can display unbound data stored in the control, data from a bound data source, or bound and unbound data together. You can also implement virtual mode in the DataGridView control to provide custom data management.
Multiple ways to customize the display of data
The DataGridView control provides many properties and events that enable you to specify how data is formatted and displayed. For example, you can change the appearance of cells, rows, and columns depending on the data they contain, or you can replace data of one data type with equivalent data of another type.
Multiple options for changing cell, row, column, and header appearance and behavior
The DataGridView control enables you to work with individual grid components in numerous ways. For example, you can freeze rows and columns to prevent them from scrolling; hide rows, columns, and headers; change the way row, column, and header sizes are adjusted; change the way users make selections; and provide ToolTips and shortcut menus for individual cells, rows, and columns.
Below is small code snippet showing how we can bind the grid to a data source
BEGIN CODE
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'nwindDataSet.Customers' table. You can move, or remove it, as needed.
this.customersTableAdapter.Fill(this.nwindDataSet.Customers);
customersDataGridView.DataSource = nwindDataSet;
customersDataGridView.DataMember = "Customers";
customersDataGridView.Sort(customersDataGridView.Columns["ContactName"], ListSortDirection.Ascending);
}
END CODE
I hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
I am looking for a UI control where you can associate to any other control and as you mouse over the associated control, it will pop up to show more information or just about anything that I want to assign it to display. This control will remained visible until I move the mouse away from the associated control or the control itself. While the control is visible showing information, it can be updated to show some live results for instance progress of some value, etc.
I wonder if such a control have already existed or not and I won't have to reinvent the wheel if someone else had made it. If it's not, I guess I would have to make one for myself but unfortunately I'm not good at graphics related programming when it comes to winforms. I hope someone can point me to the right direction, probably some tutorials or certain articles in codeproject.com
Thanks in advance.
|
|
|
|
|
Zerox MXI wrote: I'm not good at graphics related programming when it comes to winforms.
In what context are you good at graphics related programming?
led mike
|
|
|
|
|
i "know" i did this once long ago, but for the life of me i can neither recall how nor find it on the web. any help would be greatly appriciated. (not sure if it's a IE7 vs IE 6 thing (im that lost))
i have a WebBrowser control on my form and i would like to invoke the "Send page by email" functionality. i tried stuff like this
<br />
int WM_COMMAND = 0x0111;<br />
int ID_IE_FILE_SENDPAGE = 279;<br />
m_NullPointer = IntPtr.Zero;<br />
m_hWBShellDocObjHandle = (IntPtr)0;<br />
<br />
HandleRef hr = new HandleRef(this.web, this.web.Handle);<br />
IntPtr ret = SendMessage(hr, (uint)WM_COMMAND, (IntPtr)ID_IE_FILE_SENDPAGE, m_NullPointer);<br />
Taken from here at the CP[^] )
and stuff like
<br />
web.Document.ExecCommand(......<br />
none work.
please point me the way
|
|
|
|
|
cechode wrote: i have a WebBrowser control on my form and i would like to invoke the "Send page by email" functionality.
Is there some problem with just sending the email using System.Web.Mail ?
led mike
|
|
|
|
|
This is a web browser control sitting on the clients’ machine. I want the default email client to send the email not an application configured email server. (figured the functionality should already be there) also tried the mailto option but then it seems that the body length is limited and I can not control the html format
|
|
|
|
|
|
I am trying to get a grasp of how to build some simple applications. So I went out and bought the .NET Framework Foundation Fundamentals book. It has taken me through some Labs to create console and Windows Form apps but other than those simple things I dont know how to use the classes I find here on this site and put them into a project. I know how to add the class to the project and drag some controls onto the page. I know some namespaces.
For example,
Read, write and delete from registry with C#
This is SUPER useful to us and I want to use it.
I wanted to take this class and create a windows form with a Button, TextBox, and Label. I wanted to be able to enter a keyword into the textbox and onbutton click it would search my registry and delete displaying the results in the label.txt.
Sounds simple enough? Other than dragging controls onto the form I have no clue how to put it together.
|
|
|
|
|
I would suggest two things. One is to stick with basic WinForms or Console applications, and focus on one small thing at a time, such as reading/writing a file, using collection classes, creating and using a class library, etc. until you are very comfortable with C#, the IDE, and these three project types: WinForms, Console, Class Library.
The second thing I would suggest is NOT messing with the registry just yet while you are learning. The registry is vital to Windows and should your program logic be off, your entire system may become unbootable.
When you focus on tdeveloping your building blocks, you'll start to naturally see how to combine them to create the solution you want.
|
|
|
|
|
In our application we are Using Infragistics 6.1.Some of the comboboxes in my application are not getting populated .Can someone TELL ME A sOLUTION
B.RAMYA
|
|
|
|
|
Ramya Bhaskaran wrote: Can someone TELL ME A sOLUTION
Go populate the combo boxes.
|
|
|
|
|
Could U tell the Problem in Clear?.
Sabarinathan T, India.
The interests are to know something about everything and everything about something...
|
|
|
|
|
I need to customize gridview control to display 2 rows in header.
Something like this
Name
First | Last
FN1 | LN1
FN2 | LN2
i.e.
"Name" is a group and "First" and "Last" are the columns under group "Name". These should be the header rows of my GridView.
this is very similar to Sheridan grid control for VB6.0.
Does any one know how to start with such a customization?
SPD
|
|
|
|
|
I have a lot of forms in my project and would like to better organize my code. I'd like to put certain forms in one name space and other forms in another namespace. How can I assign the namespace to a windows form?
|
|
|
|
|
weirbear wrote: How can I assign the namespace to a windows form?
Edit the code-behind and designer file.
|
|
|
|
|
I'm not sure what or where to put something in. I previously tried putting the namespace there but I just get a lot of errors. Can you show me an example?
|
|
|
|
|
weirbear wrote: I'm not sure what or where to put something in. I previously tried putting the namespace there but I just get a lot of errors.
I don't know where, I put it there? WTF does that mean?
If you generated the forms using Visual Studio they already have namespace declarations so just find them and change it to whatever you want. Look at the files listed in the Solution Explorer view.
led mike
|
|
|
|
|
What do the namespace declarations look like in the designer.vb file? I tried ...
Namespace MySpace
...
End Namespace
That's where I get a lot of errors.
|
|
|
|
|
weirbear wrote: What do the namespace declarations look like in the designer.vb file?
Sorry, I don't do VB. Perhaps you need to get a decent beginners book.
led mike
|
|
|
|
|
I got it. I needed to add the Namespace MySpace ... End Namespace declurations in both the designer and the form module. Simple enough to do but if you've never changed the name space for a form the documentation isn't that clear.
|
|
|
|
|
You can create separete project with Library Type,
All forms will be in separete namespace,
It is a good way if you want you these forms in another project.
Also you can create Directory in Visual Studio Solution and store forms
but it will not help you with namespaces
but dramaticaly increase time when you search forms.
|
|
|
|
|
hi,
sorry for second time writing actually i missing one line to tell you.
in my windows application users enters theirs dateofbirth details like 02/05/1983.and my problem is i want show the Date of births between specified month and date values.i am using sqlserver 2005 as backend.but in that todate function is not there.
'Select Convert(datetime ,'2002/01/01') '
this function gives us entire date
but i want retrive the DD/MM only from specified date.
in oracle we have to date('DD/MM','02/05/1983')
but in sql server it was not working
please help me in this problem.
thank you.
regards
|
|
|
|