|
Don't cross post your question and you may get answer
|
|
|
|
|
Basically, you can't use the AxWebBrowser control is an ASP.NET app. The control REQUIRES a Windows Form in order to work.
Besides, ASP.NET code only runs on the server side. This code would print the web page on the printer attached to the web server. Is this what you really want??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Yes. This application is a web application and I want the print at the server end since the user is server in our case.
If it is not possible to print with this control in a web application, Is there any other way to print an html page without loading it and not to show any print dialog at the user end.
Please help me with this case.
Thanks in advance,
Sai.
|
|
|
|
|
Hi all,
I have a picture box on a form that shows an image. The user has the ability to zoom in on the picture. this means that not all the picture is visible at once.
what i am trying to do is implement a grab hand - you hold the mouse button down and can reposition the image within the picture box.
I have placed the picture box on a panel - this gives me the panels scrollbars I have then set the picture box to auto size. then using the following code i am able to move the image
private void picBox_MouseMove(object sender, MouseEventArgs e)
{
pnl.VerticalScroll.Value = pnl.VerticalScroll.Value + e.Y / 8;
pnl.HorizontalScroll.Value = pnl.HorizontalScroll.Value + e.X / 8;
}
I have been trying for ages with little luck ! i gather that it will be possible using the MouseDown MouseMove and MouseUp events however i seem to be running into all kinds of problems
I would be most grateful if someone could give it a blast and let me know how they get on
Thanks Lots
John
|
|
|
|
|
The easiest way is to ditch the picture box and draw the image in your own paint handler. Then you have full control.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
yes I think you'll have to handle the mentioned mouse events to get it done. Without being tested the following solution might work:
private void picBox_MouseDown(object sender, MouseEventArgs e)
{
downX = e.X;
downY = e.Y;
vertValue = pnl.VerticalScroll.Value;
horizValue = pnl.HorizontalScroll.Value;
inMove = true;
}
private void picBox_MouseMove(object sender, MouseEventArgs e)
{
if (inMove)
{
int diffX = e.X - downX;
int diffY = e.Y - downY;
pnl.VerticalScroll.Value = vertValue + diffX;
pnl.HorizontalScroll.Value = horizValue + diffY;
}
}
private void picBox_MouseUp(object sender, MouseEventArgs e)
{
inMove = false;
}
The general approach here is to save the values of the scrollbars and the mouse position when the button was pressed and then use those to calculate the new scrollbar positions when the mouse moves.
|
|
|
|
|
Ahem - shameless plug :-> - You might want to checkout my article on Runtime Movable Controls[^].
Seriously take a look at the download sample. It's a more complex version of the control than is described in the article and the Sandbox test app gives you something you can play around with.
Since a Label control can show an image, all you would need to do is use the MovableLabel control in the article, set the Image property to the bitmap you want, then set it's Size property to the size of the Image. Done!
The MovableLabel will scroll around exactly the way you describe in your post.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Whipped this up in about 20 minutes. (I couldn't wrap my brain around the stinking math for a little while!)
Create a new UserControl, call it ScrollablePicture or whatever. Drop a Panel on the design surface and set its Dock property to Fill, then it's AutoScroll property to True. Drop a PictureBox control on the Panel. You don't have to change any of it's properties.
Then:
public class ScrollablePicture {
private Point m_CursorOffset;
private int m_CurrentHScroll;
private int m_CurrentVScroll;
private bool m_Scrolling = false;
public ScrollablePicture() {
InitializeComponent();
this.Cursor = Cursors.Hand;
}
public Image Image {
get {
return PictureBox1.Image;
}
set {
if (value != null) {
PictureBox1.Size = value.Size;
PictureBox1.Image = value;
}
}
}
private void PictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) {
if ((e.Button == Windows.Forms.MouseButtons.Left)) {
m_CursorOffset = Panel1.PointToClient(System.Windows.Forms.Cursor.Position);
m_CurrentHScroll = Panel1.HorizontalScroll.Value;
m_CurrentVScroll = Panel1.VerticalScroll.Value;
m_Scrolling = true;
}
}
private void PictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) {
if (m_Scrolling) {
Point Offset = Panel1.PointToClient(System.Windows.Forms.Cursor.Position);
int newH = (m_CurrentHScroll
+ (m_CursorOffset.X - Offset.X));
int newV = (m_CurrentVScroll
+ (m_CursorOffset.Y - Offset.Y));
if ((newH < Panel1.HorizontalScroll.Minimum)) {
newH = Panel1.HorizontalScroll.Minimum;
}
else if ((newH > Panel1.HorizontalScroll.Maximum)) {
newH = Panel1.HorizontalScroll.Maximum;
}
if ((newV < Panel1.VerticalScroll.Minimum)) {
newV = Panel1.VerticalScroll.Minimum;
}
else if ((newV > Panel1.VerticalScroll.Maximum)) {
newV = Panel1.VerticalScroll.Maximum;
}
Panel1.HorizontalScroll.Value = newH;
Panel1.VerticalScroll.Value = newV;
}
}
private void PictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) {
m_Scrolling = false;
}
}
* Code coverted from VB.NET to C# by CarlosAg.net[^]
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 16:21 Thursday 13th July, 2006
|
|
|
|
|
A grat big thanks to everyone who replyed !!!!
It now works perfectly !
Thanks
|
|
|
|
|
I have a page redirect in which I pass a variable. I'd like to pass two, but not sure on the correct syntax. Here is what I have currently:
Response.Redirect ("Add_Cost.aspx?strPartNumberInputReference=" + strPartNumberInputReference);
Can someone help me with the correct syntax?
Thanks!
|
|
|
|
|
Query string paramaters are seperated by &
mypage.aspx?var1=1&var2=2&...
|
|
|
|
|
I like an own ToolStripItem trackbar that acts like a TrackBar. Can’t find any artickle how to do that…
All tips are welcomed!!
_____________________________
...and justice for all
APe
|
|
|
|
|
d00_ape wrote: All tips are welcomed!!
How about looking at the source code to one of the "control" ToolStripItems, e.g. the ComboBox one in Reflector. Then just code something similar but using a trackbar instead.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
How do I convert a System.Drawign.Color to RGB int value?
_____________________________
...and justice for all
APe
|
|
|
|
|
See this:
int valueInRGB = Color.Red.ToArgb();
|
|
|
|
|
...no, but I made it with Microsoft.VisualBasic.Information.RGB(...)
ToArgb() returns the ARGB value
_____________________________
...and justice for all
APe
|
|
|
|
|
The A is almost always going to be 255, and therefore be irrelevant. Color doesn't HAVE an A. The alpha tells you how strongly the color is blended with the background. So if it's 255, you can ignore it. If it's not, I guess you can scale the values according to how they'd draw over white or black, if you really want to.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Yeah... that's right.
If you set A to 255, then you will see always the color.
If you set A to 0, then you cannot see the color.
To take only the RGB value, just do this:
int onlyRGB = Color.Red.ToArgb() & 0x00FFFFFF;
|
|
|
|
|
Hi guys,
I need some help! Is there a way to run a store procedure or a .SQL file when running a setup of an application designed in Visual C#. I have already created a windows installer setup in Visual studio and I have an SQL file that I would like to run during installation.
Please help!
sasa
|
|
|
|
|
I don't think you can do it from an MSI. Your SQL script can't be executed, it doesn't know what to connect to, for a start. You could write an exe that runs as a post install step and runs the script on the DB that I assume you know will be there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I know it can be done, look at the ASPX Starter Kits. I just don't know how they do it, never looked into it. Probably with the MSI SDK, not Studio.
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
Thank you Christian for your answer. I appreciate you taking the time on this. I will probably run the sql statement in manual setup.
sasa
|
|
|
|
|
hi all,
i dont want my exe to start more than once if it's started before.
let's say i start my program and minimize it to taskbar.
if i click on its exe again, it first should check whether it was started before or not. if started before, just maximize it again. if not started before, then should start my application...
how can i do this ?
help me please.
thanks in advance, bye.
|
|
|
|
|
I usually use something like this:
Process[] sameProcesses = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
if(sameProcesses.Length == 1)
{
}
else
{
}
|
|
|
|
|