At a glance
Verb (dictionary form) + ときに means "when (I) do ~" or "at the time of doing ~". The main action happens at that time, or on the way to doing it.
Verb (dictionary form) + ときに、[main clause]
家を出るときに、鍵をかけます。 I lock the door when I leave the house.
How to form it
Put the verb in dictionary form (or ない form for "when not ~"), then add ときに.
| Verb group | Dictionary form + ときに | Negative + ときに |
|---|---|---|
| う-verb | 行くときに | 行かないときに |
| る-verb | 食べるときに | 食べないときに |
| する | するときに | しないときに |
| 来る | 来るときに | 来ないときに |
The verb before ときに stays in dictionary form. Past tense and politeness go at the end of the sentence: 出るときに、鍵をかけました.