|
Hi,
Have you thought of creating another Form hosting your Panel ?
Regards
|
|
|
|
|
I don't understand... why should I create an entire form just to have a customized panel? I'm just looking for a a piece of code to stick in the OnPaint method of a custom panel that'll make it's background have opacity... I've seen it done in VB, but was unable to translate it to C#.
-M.
|
|
|
|
|
Something like this?
public partial class CustomPanel : Panel
{
Color color;
public CustomPanel()
{
InitializeComponent();
color = Color.FromArgb(100, Color.Blue);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x00000020;
return cp;
}
}
protected override void OnPaintBackground(PaintEventArgs e){}
protected override void OnPaint(PaintEventArgs e)
{
using (Brush brush = new SolidBrush(color))
{
e.Graphics.Clear(Color.Transparent);
e.Graphics.FillRectangle(brush, this.ClientRectangle);
}
}
}
|
|
|
|
|
Yes!
I've no idea why it works, but it does.
Many thanks!
-M.
|
|
|
|
|
Hi,
can any know how to create a horizantal in WINFROMS.NET?
Thanks in advance.
Thanks in avance
Narendra
|
|
|
|
|
What ??
Regards,
Bhupi Bhai
|
|
|
|
|
That's a lot of spelling checker work for such a small text!!
There is no line control available if you're looking for that, either create your own, or user a groupbox.
|
|
|
|
|
hi all
i need to know how to upgrade from SPS2003 to SPS2007 then apply this upgrade on my SPS2007 that i have ?
if any one have any info. or sites or pdf files .
i will be so greatfull for.
Regards,
abdallah zaid
|
|
|
|
|
Hi, Dear Respected Programmers
kindly let me know, how may I count specified character from any strin value?
for example => "ABC.ABC.ABC" <= I want to count only dots
Thank you in advance
|
|
|
|
|
hi,
i have 2 methods to do this in my head right now.
**FIRST METHOD:
<br />
string input = "ABC.ABC.ABC";<br />
Char c = '.';<br />
Regex regex = new Regex( c );<br />
int count = regex.Matches( input ).Count;<br />
**SECOND METHOD:
<br />
string input = "ABC.ABC.ABC";<br />
int result = input.Split('.').Length - 1;<br />
best regards,
Jamil abou khalil
|
|
|
|
|
Thank you Mr. Jamil abou khalil
|
|
|
|
|
You can use this
char MyChar = '.';
int TheCount = MyString.Split(new Char[] {MyChar}).GetUpperBound();
Points:
1- The split function returns the strings between the delimiter -in our case is the dot-. So these string segments will be more than the dots by one. ie. In your example: 3 segments, 2 dots. I used GetUpperBound() method to overcome this small glitch. Did you figure out how?
2- There are much more effecient ways of doing this in larger strings as paragraphs or long text. This was only a very simple way.
Regards
|
|
|
|
|
Thank you Mr. Nader Elshehabi
|
|
|
|
|
The most efficient way is to loop through the characters in the string and check each character.
There are methods that use less code, like using a Replace, a Split, a RegEx.Replace or a RegEx.Matches, but they all use more resources as they create objects that you are not going to use anyway.
---
b { font-weight: normal; }
|
|
|
|
|
you can use collections to reduce loops
like hashtable
|
|
|
|
|
Rohit Pandhi wrote: you can use collections to reduce loops
like hashtable
Yes, that would work if you would be doing a large number of searches in the same string. It's not efficient for a single search, though.
---
b { font-weight: normal; }
|
|
|
|
|
Hello,
Guffa wrote: but they all use more resources as they create objects
This means Memory, or not?
Do you know if it's also faster? (performance profiling)
Thanks for youre time.
Martin
|
|
|
|
|
Martin# wrote: This means Memory, or not?
Yes. It also means objects that needs to be garbage collected. Not very expensive, as short lived objects are handled rather efficiently, but still.
Martin# wrote: Do you know if it's also faster? (performance profiling)
Yes. Looping through the characters is the fastest and most efficient way of doing it. Any other method will also be looping through all the characters, and additionally create objects from what they find.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks a lot!
It always make sense after reading youre posts.
Martin
|
|
|
|
|
hi
You can try this
string str="ABC.ABC.ABC";
string[] strSplited=str.split('.');
If you don't have dot in end of string then
int NoOfDots=strSplited.length-1;
otherwise
int NoOfDots=strSplited.length;
|
|
|
|
|
I have created c# desktop application and created its installation.
I want the program to run immediately after the installation of the program finishes.
Is there any way to do this?
Thanks
tandukar
|
|
|
|
|
Yeah you can do it ...
Override the function "OnAfterInstall" in installer class and get the current working folder
then type this command
System.Diagnostics.Process.Start("");
Cheers
|
|
|
|
|
<br />
int Mode = 12;<br />
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Mode="+Mode+";Data Source=|DataDirectory|x.mdb;";<br />
I have seen people ask questions about this, and i decided to help.
Liviu Catrina
|
|
|
|
|
I have a usercontrol which contains a tablelayoutpanel. The tablelayout panel contains a number of textboxes and comboboxes (showing data from a single row in a table) *and* a number of dataviewgrids (showing childrelation rows). I also have an event handler on my datatables handling the rowchange-event which saves any change in any row to the database.
All my controls shows the right data from the dataset, but only changes in my dataviewgrids gets saved. The rowchange-event handler does not get called when I change data in my textboxes and comboboxes.
I do this for binding:
((TextBox)dataControl).DataBindings.Add("Text", MainForm.theDataView, this.theDataRow.Table.TableName + "." + column.ColumnName);<br />
this.tableLayoutPanel1.Controls.Add(dataControl, -1, -1);
(the actual code is a bit more complex as I create the controls on the run based on the columns in the table. My GUI is able to show data from different tables)
What I do not get is why the data get shown through the databinding in the textbox, then why does it not get updated? Please help!!!
|
|
|
|
|
Data binding doesn't work that way.. You should implement a method to explicitly save the data back to the DataTable s using a DataAdapter. And sure the DataTable.ColumnChanged won't fire, because while editting the DataGridView the bound DataTable does change; TextBoxe s isn't the same. This event fires after ending the editting in the DataGridView , while typing in a TextBox would be like editting a cell in a DataGridView without ending the editting.
Regards
|
|
|
|