|
Set the form to owner-drawing, and check out the Paint event of the form; You can draw your bitmap on the Graphics object.
|
|
|
|
|
dear friends,
I would like to ask some help. I am a beginner in vb.net programming and right now we have a thesis in school to develop an Application of Programming to Chemistry Dama. I already have a sample codes that I attached below.
The problem that I have right now is how can I capture 2 or 3 chips in one move. The code that I have is for capturing 1 chip per move. Need some help to have some idea on how I can modify my codes.
Thank you
sample code that I have in my program
'-----single chip taken-----------------'chip 9
If picCheckers9.Location = square17 And picCheckers13.Location.X > 307 And picCheckers13.Location.Y > 189 And Open14 = True And Open17 = False Then
picCheckers13.Location = square14
str13 = 14
Open17 = True
Open14 = False
Open21 = True
picCheckers9.Location = square40
lblTurn.Text = "Red"
DataGridView1.Rows.Add(New Object() {"Al", "3,4", "Al", "AlAl", "-54"})
'----extra for double taken chips----- chip 9
ElseIf picCheckers9.Location = square17 And picCheckers1.Location = square9 Or picCheckers2.Location = square9 Or picCheckers5.Location = square9 Or picCheckers6.Location = square9 And picCheckers13.Location.X > 307 And picCheckers13.Location.Y > 189 And Open14 = True And Open17 = False And Open9 = False And Open5 = True Then
picCheckers13.Location = square14
str13 = 14
Open17 = True
Open14 = False
Open21 = True
picCheckers9.Location = square40
DataGridView1.Rows.Add(New Object() {"Al", "3,4", "Al", "AlAl", "-54"})
'----extra for double taken chips-----
'Else
'lblTurn.Text = "Red"
|
|
|
|
|
Chips? Checkers? Moves?? Capture?? What in the hell are you talking about??
And I'm getting the vibe that this should have been posted in the Algorithms forum.
|
|
|
|
|
Hello Enzomatriz,
It looks like a game of checkers?
And you say your code to take one chip works?
Ok so as I see it maybe you can place the (YOUR CODE) code block which takes the oppositions chips in a LOOP where, after taking one chip you see if there are other chips to take (as partof the same same move using the same peice/chip/counter that you use to make the initial move and if not another then obviously let the otherplayer have his/her turn.
So to explain roughly you would end up with....
PSEUDO CODE
===========
Start game
Player 1 turn (your code)
My_Turn_Complete = False
My_Turn_Partial = False
Do
'The next line looks for pieces that can be taken by your Piece
If I can take opposition pieces Then
Take oppostion peice
YOUR CODE FROM HERE
'i have started a move which may let me take take more pieces
My_Turn_Partial = True
ElseIf My_Turn_Partial = true Then
'I took opposition peice and no more can be taken (so my turn is finished now)
My_Turn_Complete = True
Else
'I could not take any opposition peices
'and My_Turn_Partial was false so i will defend my lines
YOUR CODE HERE (to defend your lines NOT take oppososiotn peices
My_Turn_Complete = True
End IF
Loop until My_Turn_Complete
Player 2 turn
Let player 2 make his/her move
Loop until end of game
There is a bit more than above obviosuly,
because you cannot use a different piece/chip/counter once you have started a move,
so you need to check if its the same piece that allows you continue.
but i think there is enough above to give you an idea
|
|
|
|
|
I would like information to be able to design an application that will show me the number, date and time of the person to call me by phone. A Caller ID using TAPI3
|
|
|
|
|
|
I have a problem with the project i need load the modem in a combobox and then be able to select the device with a button to put it in the listening mode.
When i do a new project and add the class gives me this error:
Interop type 'TAPIClass' cannot be embedded. Use the applicable interface instead.
I want to use this class with a form..if you can help me..
|
|
|
|
|
Can you post a snippet of the code where the error occurs?
|
|
|
|
|
Hi man thx for you help i fix the problem, the end i can't see who call, jajaja..
Pls help with this problem...
I am desperate looking for someone to help me in a project that I want to perform, I have a Windows XP sp3 activated the routing and remote access service (remoteaccess) for some users will be able to connect via modem. What I need to know is if i can control and monitor the users that may be connected as well as the time they had connected them disconnect, you know of any project, bookstore, code, something for such a thing.
|
|
|
|
|
Hi,
Can anyone guide me on how to do the following cenerio:
I have a table:
ID type int
Data type image
Now on a form in vb.net, I drop the control data field as a picturebox.
I want to double click on the picturebox to load a pdf file so that i can store in the table.
a button to view the pdf file.
I tried to do it as a simple picturebox for gif, etc.. it does not work.
the idea behind this is to be able to store the pdf in a table as normally do for a picture.
Also once I acheive this, i would like to view the pdf file.
I would appreciate if anyone can send the code to do this. even if it is not with my approach but the same result.
Thanks a lot.
|
|
|
|
|
Since a PictureBox control knows nothing about the PDF file format, it can't render one at all.
You'll have to use another control, such as PdfSharp or some other PDF Viewing control.
|
|
|
|
|
thanks for your response.
I load the pdf file into webbrowser control. Now i need to save into a table. the form in question already has a dataset binding into it. I neesd to take the pdf file that's showing in the webbrowser control and to be saved with every control on the form.
Here the code below that I used:
Dim Response As DialogResult
OpenFileDialog1.FileName = ""
OpenFileDialog1.Filter = "PDF Files(*.pdf)|*.pdf|All Files(*.*)|*.*"
Response = OpenFileDialog1.ShowDialog()
If Response <> Windows.Forms.DialogResult.Cancel Then
If OpenFileDialog1.FileName <> "" Then
cmdBrowse.Navigate(OpenFileDialog1.FileName)
End If
End If
i have a table name ManifestTD with dataset ManifestTD_dataset with column (ID as PK, Data as Binary(MAX)
How to get this save into the table ; also be able to doubleclick to the webbrowser command to view the entire pdf document through adobe
Thanks again.
|
|
|
|
|
You can save the contents of the PDF file to the database the exact same way you save any other image format. Like this[^] or this[^].
|
|
|
|
|
I have a form that has various pictureboxes that are populated by the user. Once the form has all the pictureboxes full, the user needs to save the whole form and its contents as a jpg. The only problem is that the only thing that is saved is the picturebox.1.
Case 1
form2.PictureBox1.Image.Save(fs, _
System.Drawing.Imaging.ImageFormat.Jpeg)
I can see that in Case 1 section I am telling the program to save the PictureBox1 in form 2 but I want it to merge all the PictureBoxs in form 2 and save as a jpg. Can anyone tell me where I am going wrong
Dim saveFileDialog1 As New SaveFileDialog()
saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif"
saveFileDialog1.Title = "Save an Image File"
saveFileDialog1.ShowDialog()
If saveFileDialog1.FileName <> "" Then
Dim fs As System.IO.FileStream = CType _
(saveFileDialog1.OpenFile(), System.IO.FileStream)
Select Case saveFileDialog1.FilterIndex
Case 1
form2.PictureBox1.Image.Save(fs, _
System.Drawing.Imaging.ImageFormat.Jpeg)
Case 2
Me.Button2.Image.Save(fs, _
System.Drawing.Imaging.ImageFormat.Bmp)
Case 3
Me.Button2.Image.Save(fs, _
System.Drawing.Imaging.ImageFormat.Gif)
End Select
fs.Close()
End If
|
|
|
|
|
tuffhamster wrote: I have a form that has various pictureboxes that are populated by the user. Once the form has all the pictureboxes full, the user needs to save the whole form and its contents as a jpg.
Call the DrawToBitmap[^] method of the form.
|
|
|
|
|
I have used the drawtobitmap as suggested but still only copies the form background. There are about 8 picture boxes in the form but none of these are saved within the jpg. Here is the code.
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim savefiledialog1 As New SaveFileDialog
savefiledialog1.Title = "Render"
savefiledialog1.FileName = "Render Image"
savefiledialog1.Filter = "jpg |*.jpg| png |*.png| bmp |*.bmp| gif |*.gif"
If savefiledialog1.ShowDialog() = DialogResult.OK Then
Dim bmp As New Drawing.Bitmap(Form2.Width, Form2.Height)
Form2.DrawToBitmap(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height))
bmp.Save(savefiledialog1.FileName, Imaging.ImageFormat.Icon)
End If
End Sub
|
|
|
|
|
As should be; that's how the stuff works. If you want a "mashup", you'll have to draw the pictureboxes by hand, on the forms' paint event.
|
|
|
|
|
Can anybody help me to solve this problem...
I am facing the below problem while trying to send mail in Vb6.0
Problem was encountered when trying send mail- ActiveX component can't create object.
Would Appreciate help...
|
|
|
|
|
Check the outlook is configured on particular machine.
Also check the outlook reference is added or not in your application.
Still problem is not resolved, then send the line of code, i will correct it.
|
|
|
|
|
Can anybody help me to solve this problem...
I am facing the below problem while trying to send mail in Vb6.0
Problem was encountered when trying send mail- ActiveX component can't create object.
Appreciate your help...
|
|
|
|
|
From this Google search I think the top 2 results might be a good place to start
Google: VB6 sendmail - ActiveX component can't create object[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Hi
how to give Chinese characters as in put in a Text box in vb.net. i need to enter the charecter through key bord.
and how display the chineses charectes in datagrid in vb.net.
|
|
|
|
|
Install a Chinese keyboard with the Language Bar of Windows. Set the focus to your text box, then select "Chinese" from the Language Bar, and type: "川宫" (don't know what it means, just typed some characters on my German keyboard with the Chinese keyboard selected in the LanguageBar...)
|
|
|
|
|
Hello all,
I have built a C++ class like this:
class MyClass {
public:
int x;
MyClass();
virtual void f1(int);
virtual void f2();
virtual void f3();
};
extern "C" DLLIMPORT void* MCSet(int);
extern "C" DLLIMPORT void MCKill();
extern "C" DLLIMPORT int MCGet();
extern "C" DLLIMPORT void DoStuff(MyClass); I also made a client *.exe that uses all MyClass features. Can someone tell me if it is possible to call MyClass from vba and do the same? If so, how? (A sample code would be very helpfull )
[]'s
|
|
|
|
|
I developed a hotel bill In Windows form application(visual basic 2010)
i created a database with Column names
1.S_No
2.ItemName
3.Quantity
4.Price
5.Total
6.GrandTotal
And i added this database to my form and i dragged and dropped as Details view. I arranged columns in horizontal format. Grand total button at end form. i selected all text boxes excluding grand total textbox. by holding Ctrl key i made duplicates to all text boxes in the same horizontal columns. The first text boxes are correctly working correctly.but the duplicates box values although i inserted they are not assigning to database(when i pressed save icon on top)(only first Row boxes are saved) what to do please help me. provide the code in visual basic 2010 format. if you don't understand i will mail my complete project to you please please help me
|
|
|
|