|
Cool. That helped. I'm doing this to add it to my existing form and add the existing control that I was previously showing in the tab:
Form newForm = new Form();
InitializeControls(controls[i]);
newForm.Size = (controls[i].Size);
newForm.Width += 20;
newForm.Height += 100;
this.Width = newForm.Width + 20;
this.Height = newForm.Height + 50;
newForm.Controls.Add(controls[i]);
newForm.ShowDialog();
But it's filling up my entire area. Do you know how to scale the control's contents down to 1/4 the size? I think once I do that, it won't be tough to figure out how to position it (tiled) in the right location in my form with the other 4 controls I'm adding. It didn't let me say newForm.size = controls[i].size/4. (operator / can't be applied to system.drawing.size and int)
|
|
|
|
|
Loko at what type the Size property takes, it's an instance of Size. Look at the properties of Size, Height and Width. Sooooo, you just make a new instance of a Size with the new values:
using System.Drawing;
.
.
.
Size newSize = new Size(controls[i].Size.Width / 4, controls[i].Size.Height / 4);
controls[i].Size = newSize;
|
|
|
|
|
Hi,
I want to know how can I force beep using C# and:
[DllImport("kernel32.dll")]
private static extern int Beep(int dwFreq, int dwDuration);
even if Microsoft Windows volume is switched to mute?
Technology News @ www.JassimRahma.com
|
|
|
|
|
Jassim Rahma wrote: even if Microsoft Windows volume is switched to mute? That is the user's choice. I would be very annoyed if some application started beeping after I had set my PC to silent.
Use the best guess
|
|
|
|
|
The only way you can override the sound setting is to change the volume yourself, do the beep, then put the volume back where you found it. There is no little magic "override" method you can call.
The big problem with the is that you're changing a setting the user has set for a reason. THe other one is that if you turn the volume up to some arbitrary level, you have no idea how loud the sound really is. It still might not be audible or you might blast the user right out of their chair!
|
|
|
|
|
Why not use Console.Beep ?
Along with what the others say, the user may have the speakers physically turned down or off.
Or headphones could be plugged in but the user not wearing them.
There is also the possibility that the user is remoted into a system halfway 'round the world.
Perhaps you could allow the user to set a configuration setting to specify the volume to use.
For one application I wrote for a former employer I allowed the user to specify what sound to make (if any) as an alert.
|
|
|
|
|
Jassim Rahma wrote: even if Microsoft Windows volume is switched to mute?
Make sure you weld the PC-case shut. I'd rip that speaker out before you have the correct P/Invoke.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
if Microsoft Windows volume is switched to mute?
first you can change volume to 100% for playing sound and then change it back to 0%.
-Amir Mohammad Nasrollahi
/* LIFE RUNS ON CODE */
|
|
|
|
|
Hi,
I have problem with adding asp.net usercontrol in Usercontrol.
The 1st user control is DataList where the Companies are listed.
Now i need another usercontrol inside this one where i will list the products from each Company.
hope some one will explain how to combine this 2 controls or tell me some easy way to do this.
thanks
|
|
|
|
|
You should not post your questions in multiple places. ASP.NET UserControl In UserControl[^]
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
Hi,
I am creating a setup project for my solution in C#, and I created a merge module that include all obfuscated assembly files (.dll files, and the .exe file), then add it to the setup project
Before building the setup project, I replace assembly files (in the Bin/Debug) by obfuscated files. After building the project, .dll files still are obfuscated, however the .exe file isn't obfuscated.
Are there anyone know how to fix that ?
Thank you very much !
|
|
|
|
|
I suspect, from this question, that you are manually obfuscating the file. When your setup is built, though, it rebuilds the executable, so that the file is no longer obfuscated - (you'll see the same behaviour if you manually apply a certificate to your code). The trick is to run the obfuscation process as a PostBuild process - which means that the setup will get the obfuscated version.
|
|
|
|
|
Thanks Pete very much,
Could you please tell me more how to use PostBuild process ?
I'm using the Crypto Obfuscator software to obfuscate assembly files.
And I can see the properties of Setup project include the PostBuildEvent but I don't know how to use it (I am using Visual Studio 2010)
Thanks and regards,
Tai
|
|
|
|
|
|
Hi Pete, thank you
Could you tell me more detail about creating obfuscated setup project ?
My solution includes some project:
1. Start up project (create application file)
2. Library projects (create dll files)
3. Merge project (include obfuscated assembly files)
4. Setup project
Thanks and regards,
|
|
|
|
|
Hi, You can drag and drop the project file to Eazfuscator.Net and it will handle the Obfuscation of your binaries every time you compile with release, if you are using different Obfuscator check how to obfuscate the project file, I believe rebuilding your solution is recompiling the .exe and overwrite your Obfuscated .exe then the setup project will include the new non-Obfuscated file.
|
|
|
|
|
Thanks Samer,
I am trying to use Crypto Obfuscator and Dotfuscator. I only rebuild setup project (not the solution) but it make the .exe recompiling. I don't know why ?
|
|
|
|
|
how to perform update and delete operations on a grid view in which the data is already bounded on the time of page load
here is my code:
<asp:GridView ID="gvUsers" runat="server" CellPadding="4" ForeColor="#333333"
GridLines="None" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
OnRowEditing = "gvUsers_RowEditing" OnRowDeleting = "gvUsers_RowDeleting" OnRowUpdating = "gvUsers_RowUpdating" >
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
c# Code:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Office"] == null)
{
Response.Redirect("Login.aspx");
}
else
{
Session.Timeout = 1;
L1.Text = "District: " + Session["district"].ToString();
L3.Text = "Department: " + Session["department"].ToString();
L4.Text = "Office: " + Session["Office"].ToString();
con.Open();
if (Session["department"].ToString() == "NIC")
{
SqlCommand cmd1 = new SqlCommand("select * from DeptMaster", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd1);
SqlCommandBuilder cmb = new SqlCommandBuilder(da);
da.Fill(ds, "deptmaster");
gvUsers.DataSource = ds.Tables["deptmaster"];
gvUsers.DataBind();
}
else
{
SqlCommand cmd1 = new SqlCommand("select * from OfficeMaster where Office ='" + Session["Office"].ToString() + "'", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd1);
SqlCommandBuilder cmb = new SqlCommandBuilder(da);
da.Fill(ds, "deptmaster");
gvUsers.DataSource = ds.Tables["deptmaster"];
gvUsers.DataBind();
}
con.Close();
}
}
Mohan@Coding.com
|
|
|
|
|
Hi,
This question looks like ASP.Net not C#, you might get a better answer, if you ask this question under ASP.Net category
Jegan
Think! Don't write a line of code unless you absolutely need to.
|
|
|
|
|
I thought I would show you guys a quick tutorial on how to build native cocoa apps using C# and MonoMac. I will be showing you how to make the famous "Hello World" app.
Lets Begin!
You will need the following:
MonoDevelop IDE
MonoDevelop Framework SDK
XCode 4.x
One you have those, open up MonoDevelop. Click on "new solution" Drop down the C# category and select "Mac (open source)" and create a MonoMac project.
Now once that is done you should have some files and folders. Double click the MainWindow.xib file and XCode should open. Add a button and a label. Now click the middle button above Editor in the top right of XCode. Find "Automatic" and click on it and go to "MainWindowController.h" Now right click and drag the button to the code and add an outlet called "guiButton" or whatever you want. Do the same with the label. Now right click and drag from the button again but this time select action and name it "buttonClicked."
Ok, that's done. Save and close XCode. Now go back to MonoDevelop and open MainWindow.designer. A bunch of new code should have been added. Verify that the outlets and action have been added before continuing.
Your file should look like this:
using MonoMac.Foundation;
namespace dontgivemeerrors
{
[Register ("MainWindowController")]
partial class MainWindowController
{
[Outlet]
MonoMac.AppKit.NSTextField guiTextField { get; set; }
[Outlet]
MonoMac.AppKit.NSButton guiButton { get; set; }
[Action ("buttonClicked:")]
partial void buttonClicked (MonoMac.Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
if (guiTextField != null) {
guiTextField.Dispose ();
guiTextField = null;
}
if (guiButton != null) {
guiButton.Dispose ();
guiButton = null;
}
}
}
[Register ("MainWindow")]
partial class MainWindow
{
void ReleaseDesignerOutlets ()
{
}
}
}
Ok, now open MainWindowController.cs and find "#endregion" Go under it and add the following line of code:
partial void buttonClicked (MonoMac.Foundation.NSObject sender)
{
}
Replace "buttonClicked" with name of your action. Now for the final step. Add this to that line of code:
partial void buttonClicked (MonoMac.Foundation.NSObject sender)
{
this.guiLabel.StringValue = "Hello World";
}
Now run the app by pressing the icon with 2 gears and a green gear on the top right of MonoDevelop. Press the button and the label text should change to "Hello World."
Thats it. Most of your code will be under the action void. To find your .app file, go to YourUserName -> Projects -> NameOfProject -> NameOfProject -> bin -> Debug
Happy Coding!
- Team HsM
HSM
|
|
|
|
|
Great! This is not the place for it though. Write it up as a tip/trick, or if oyu go into a lot more detail, an article.
|
|
|
|
|
24 hours from now this will be multiple pages deep in the forum, never to see the light of day again. As Dave suggested write it up as a tip/trick where it will come up as a result in the search most of us use.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hello there... please how kind design program that identifies the head from the image save in the computer
|
|
|
|
|
|
Something went wrong in trying to upvote your answer. I'll try again. It is kind of hard using this new interface from my Galaxy Tablet 7.
Edit: Seems I've got it right this time.
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|